mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 09:28:11 +00:00
serve batch token in job statuses
This commit is contained in:
1 parent
ff6ae55a4e
commit
67cfdf11bd
6 files changed
+28
No files matched your search
+7
@@ -11,6 +11,7 @@ use enums::common::job_status_plus::JobStatusPlus;
|
||||
use enums::traits::mysql_from_row::MySqlFromRow;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::anonymous_visitor_tracking::AnonymousVisitorTrackingToken;
|
||||
use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
use tokens::tokens::generic_inference_jobs::InferenceJobToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
use tokens::traits::mysql_token_from_row::MySqlTokenFromRow;
|
||||
@@ -102,6 +103,7 @@ SELECT
|
||||
|
||||
jobs.on_success_result_entity_type as maybe_result_entity_type,
|
||||
jobs.on_success_result_entity_token as maybe_result_entity_token,
|
||||
jobs.on_success_result_batch_token as maybe_result_batch_token,
|
||||
|
||||
model_weights.title as maybe_model_weights_title,
|
||||
tts_models.title as maybe_tts_model_title,
|
||||
@@ -230,6 +232,9 @@ fn raw_records_to_public_result(records: Vec<RawGenericInferenceJobStatus>) -> V
|
||||
ResultDetails {
|
||||
entity_type: entity_type.to_string(),
|
||||
entity_token: entity_token.to_string(),
|
||||
maybe_batch_token: record.maybe_result_batch_token
|
||||
.as_ref()
|
||||
.map(|token| BatchGenerationToken::new_from_str(token)),
|
||||
public_bucket_location_or_hash: public_bucket_hash.to_string(),
|
||||
maybe_media_file_public_bucket_prefix: record.maybe_media_file_public_bucket_prefix.clone(),
|
||||
maybe_media_file_public_bucket_extension: record.maybe_media_file_public_bucket_extension.clone(),
|
||||
@@ -293,6 +298,7 @@ struct RawGenericInferenceJobStatus {
|
||||
|
||||
pub maybe_result_entity_type: Option<String>,
|
||||
pub maybe_result_entity_token: Option<String>,
|
||||
pub maybe_result_batch_token: Option<String>,
|
||||
|
||||
pub maybe_model_weights_title: Option<String>,
|
||||
pub maybe_tts_model_title: Option<String>,
|
||||
@@ -349,6 +355,7 @@ impl FromRow<'_, MySqlRow> for RawGenericInferenceJobStatus {
|
||||
maybe_inference_args: row.try_get("maybe_inference_args")?,
|
||||
maybe_result_entity_type: row.try_get("maybe_result_entity_type")?,
|
||||
maybe_result_entity_token: row.try_get("maybe_result_entity_token")?,
|
||||
maybe_result_batch_token: row.try_get("maybe_result_batch_token")?,
|
||||
maybe_model_weights_title: row.try_get("maybe_model_weights_title")?,
|
||||
maybe_tts_model_title: row.try_get("maybe_tts_model_title")?,
|
||||
maybe_voice_conversion_model_title: row.try_get("maybe_voice_conversion_model_title")?,
|
||||
|
||||
+6
@@ -11,6 +11,7 @@ use enums::common::job_status_plus::JobStatusPlus;
|
||||
use enums::no_table::style_transfer::style_transfer_name::StyleTransferName;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::anonymous_visitor_tracking::AnonymousVisitorTrackingToken;
|
||||
use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
use tokens::tokens::generic_inference_jobs::InferenceJobToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
@@ -61,6 +62,7 @@ SELECT
|
||||
|
||||
jobs.on_success_result_entity_type as maybe_result_entity_type,
|
||||
jobs.on_success_result_entity_token as maybe_result_entity_token,
|
||||
jobs.on_success_result_batch_token as maybe_result_batch_token,
|
||||
|
||||
model_weights.title as maybe_model_weights_title,
|
||||
tts_models.title as maybe_tts_model_title,
|
||||
@@ -206,6 +208,9 @@ fn raw_record_to_public_result(record: RawGenericInferenceJobStatus) -> GenericI
|
||||
ResultDetails {
|
||||
entity_type: entity_type.to_string(),
|
||||
entity_token: entity_token.to_string(),
|
||||
maybe_batch_token: record.maybe_result_batch_token
|
||||
.as_ref()
|
||||
.map(|token| BatchGenerationToken::new_from_str(token)),
|
||||
public_bucket_location_or_hash: public_bucket_hash.to_string(),
|
||||
maybe_media_file_public_bucket_prefix: record.maybe_media_file_public_bucket_prefix.clone(),
|
||||
maybe_media_file_public_bucket_extension: record.maybe_media_file_public_bucket_extension.clone(),
|
||||
@@ -267,6 +272,7 @@ struct RawGenericInferenceJobStatus {
|
||||
|
||||
pub maybe_result_entity_type: Option<String>,
|
||||
pub maybe_result_entity_token: Option<String>,
|
||||
pub maybe_result_batch_token: Option<String>,
|
||||
|
||||
pub maybe_model_weights_title: Option<String>,
|
||||
pub maybe_tts_model_title: Option<String>,
|
||||
|
||||
@@ -6,6 +6,7 @@ use enums::by_table::generic_inference_jobs::inference_job_product_category::Inf
|
||||
use enums::common::job_status_plus::JobStatusPlus;
|
||||
use enums::no_table::style_transfer::style_transfer_name::StyleTransferName;
|
||||
use tokens::tokens::anonymous_visitor_tracking::AnonymousVisitorTrackingToken;
|
||||
use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
use tokens::tokens::generic_inference_jobs::InferenceJobToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
|
||||
@@ -67,6 +68,8 @@ pub struct ResultDetails {
|
||||
pub entity_type: String,
|
||||
pub entity_token: String,
|
||||
|
||||
pub maybe_batch_token: Option<BatchGenerationToken>,
|
||||
|
||||
/// The bucket storage hash (for vc and media_files) or full path (for tts)
|
||||
pub public_bucket_location_or_hash: String,
|
||||
pub maybe_media_file_public_bucket_prefix: Option<String>,
|
||||
|
||||
+7
@@ -13,6 +13,7 @@ use enums::common::job_status_plus::JobStatusPlus;
|
||||
use enums::traits::mysql_from_row::MySqlFromRow;
|
||||
use errors::AnyhowResult;
|
||||
use tokens::tokens::anonymous_visitor_tracking::AnonymousVisitorTrackingToken;
|
||||
use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
use tokens::tokens::generic_inference_jobs::InferenceJobToken;
|
||||
use tokens::tokens::users::UserToken;
|
||||
use tokens::traits::mysql_token_from_row::MySqlTokenFromRow;
|
||||
@@ -168,6 +169,7 @@ SELECT
|
||||
|
||||
jobs.on_success_result_entity_type as maybe_result_entity_type,
|
||||
jobs.on_success_result_entity_token as maybe_result_entity_token,
|
||||
jobs.on_success_result_batch_token as maybe_result_batch_token,
|
||||
|
||||
model_weights.title as maybe_model_weights_title,
|
||||
tts_models.title as maybe_tts_model_title,
|
||||
@@ -296,6 +298,9 @@ fn raw_records_to_public_result(records: Vec<RawGenericInferenceJobStatus>) -> V
|
||||
ResultDetails {
|
||||
entity_type: entity_type.to_string(),
|
||||
entity_token: entity_token.to_string(),
|
||||
maybe_batch_token: record.maybe_result_batch_token
|
||||
.as_ref()
|
||||
.map(|token| BatchGenerationToken::new_from_str(token)),
|
||||
public_bucket_location_or_hash: public_bucket_hash.to_string(),
|
||||
maybe_media_file_public_bucket_prefix: record.maybe_media_file_public_bucket_prefix.clone(),
|
||||
maybe_media_file_public_bucket_extension: record.maybe_media_file_public_bucket_extension.clone(),
|
||||
@@ -359,6 +364,7 @@ struct RawGenericInferenceJobStatus {
|
||||
|
||||
pub maybe_result_entity_type: Option<String>,
|
||||
pub maybe_result_entity_token: Option<String>,
|
||||
pub maybe_result_batch_token: Option<String>,
|
||||
|
||||
pub maybe_model_weights_title: Option<String>,
|
||||
pub maybe_tts_model_title: Option<String>,
|
||||
@@ -415,6 +421,7 @@ impl FromRow<'_, MySqlRow> for RawGenericInferenceJobStatus {
|
||||
maybe_inference_args: row.try_get("maybe_inference_args")?,
|
||||
maybe_result_entity_type: row.try_get("maybe_result_entity_type")?,
|
||||
maybe_result_entity_token: row.try_get("maybe_result_entity_token")?,
|
||||
maybe_result_batch_token: row.try_get("maybe_result_batch_token")?,
|
||||
maybe_model_weights_title: row.try_get("maybe_model_weights_title")?,
|
||||
maybe_tts_model_title: row.try_get("maybe_tts_model_title")?,
|
||||
maybe_voice_conversion_model_title: row.try_get("maybe_voice_conversion_model_title")?,
|
||||
|
||||
@@ -9,6 +9,7 @@ use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
use tokens::tokens::generic_inference_jobs::InferenceJobToken;
|
||||
use utoipa::{IntoParams, ToSchema};
|
||||
use tokens::tokens::batch_generations::BatchGenerationToken;
|
||||
|
||||
pub const LIST_SESSION_JOBS_URL_PATH: &str = "/v1/jobs/session";
|
||||
|
||||
@@ -111,6 +112,9 @@ pub struct ListSessionStatusDetailsResponse {
|
||||
pub struct ListSessionResultDetailsResponse {
|
||||
pub entity_type: String,
|
||||
pub entity_token: String,
|
||||
|
||||
/// If generated as part of a batch, the batch token.
|
||||
pub maybe_batch_token: Option<BatchGenerationToken>,
|
||||
|
||||
/// (DEPRECATED) URL path to the media file
|
||||
#[deprecated(note="This field doesn't point to the full URL. Use media_links instead to leverage the CDN.")]
|
||||
|
||||
+1
@@ -358,6 +358,7 @@ fn db_record_to_response_payload(
|
||||
ListSessionResultDetailsResponse {
|
||||
entity_type: result_details.entity_type,
|
||||
entity_token: result_details.entity_token,
|
||||
maybe_batch_token: result_details.maybe_batch_token,
|
||||
media_links: MediaLinksBuilder::from_rooted_path(media_domain, &public_bucket_media_path),
|
||||
maybe_public_bucket_media_path: Some(public_bucket_media_path),
|
||||
maybe_successfully_completed_at: result_details.maybe_successfully_completed_at,
|
||||
|
||||
Reference in new issue
Block a user