From efdb0377f40400a813cdde2a3041ec2fddaf3a08 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Fri, 15 Sep 2023 06:15:11 -0400 Subject: [PATCH] serve bucket paths --- .../generic_inference/web/get_inference_job_status.rs | 7 +++++-- .../endpoints/inference_job/get_inference_job_status.rs | 6 ++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/lib/mysql_queries/src/queries/generic_inference/web/get_inference_job_status.rs b/crates/lib/mysql_queries/src/queries/generic_inference/web/get_inference_job_status.rs index 7e3cd0486f..ae5f202674 100644 --- a/crates/lib/mysql_queries/src/queries/generic_inference/web/get_inference_job_status.rs +++ b/crates/lib/mysql_queries/src/queries/generic_inference/web/get_inference_job_status.rs @@ -41,7 +41,7 @@ pub struct ResultDetails { pub entity_type: String, pub entity_token: String, - /// The bucket storage hash (for vc) or full path (for tts) + /// The bucket storage hash (for vc and media_files) or full path (for tts) pub public_bucket_location_or_hash: String, /// Whether the location is a full path (for tts) or a hash (for vc) that @@ -81,6 +81,7 @@ SELECT tts_results.public_bucket_wav_audio_path as maybe_tts_public_bucket_path, voice_conversion_results.public_bucket_hash as maybe_voice_conversion_public_bucket_hash, + media_files.public_bucket_directory_hash as maybe_media_file_public_bucket_directory_hash, jobs.assigned_worker as maybe_assigned_worker, jobs.assigned_cluster as maybe_assigned_cluster, @@ -100,6 +101,7 @@ LEFT OUTER JOIN voice_conversion_models ON jobs.maybe_model_token = voice_conver LEFT OUTER JOIN tts_results ON jobs.on_success_result_entity_token = tts_results.token LEFT OUTER JOIN voice_conversion_results ON jobs.on_success_result_entity_token = voice_conversion_results.token +LEFT OUTER JOIN media_files ON jobs.on_success_result_entity_token = media_files.token WHERE jobs.token = ? "#, @@ -128,7 +130,7 @@ WHERE jobs.token = ? // NB: A bit of a hack. We store TTS results with a full path. // Going forward, all other record types will store a hash. let (bucket_path_is_hash, maybe_public_bucket_hash) = match record.inference_category { - InferenceCategory::LipsyncAnimation => (true, Some("todo")), // TODO - these values are wrong + InferenceCategory::LipsyncAnimation => (true, record.maybe_media_file_public_bucket_directory_hash.as_deref()), InferenceCategory::TextToSpeech => (false, record.maybe_tts_public_bucket_path.as_deref()), InferenceCategory::VoiceConversion => (true, record.maybe_voice_conversion_public_bucket_hash.as_deref()), }; @@ -192,6 +194,7 @@ struct RawGenericInferenceJobStatus { pub maybe_voice_conversion_public_bucket_hash: Option, // NB: This is the bucket hash. pub maybe_tts_public_bucket_path: Option, // NB: This isn't the bucket path, but the whole hash. + pub maybe_media_file_public_bucket_directory_hash: Option, // NB: This is the bucket directory hash pub maybe_assigned_worker: Option, pub maybe_assigned_cluster: Option, diff --git a/crates/service/web/storyteller_web/src/http_server/endpoints/inference_job/get_inference_job_status.rs b/crates/service/web/storyteller_web/src/http_server/endpoints/inference_job/get_inference_job_status.rs index 93a81c3501..e3b7455c23 100644 --- a/crates/service/web/storyteller_web/src/http_server/endpoints/inference_job/get_inference_job_status.rs +++ b/crates/service/web/storyteller_web/src/http_server/endpoints/inference_job/get_inference_job_status.rs @@ -27,6 +27,7 @@ use std::borrow::BorrowMut; use std::fmt; use std::ops::Deref; use std::sync::Arc; +use buckets::public::media_files::original_file::MediaFileBucketPath; use tokens::jobs::inference::InferenceJobToken; /// For certain jobs or job classes (eg. non-premium), we kill the jobs if the user hasn't @@ -217,8 +218,9 @@ pub async fn get_inference_job_status_handler( maybe_result: record.maybe_result_details.map(|result_details| { let public_bucket_media_path = match inference_category { InferenceCategory::LipsyncAnimation => { - // TODO - "TODO".to_string() + MediaFileBucketPath::from_object_hash(&result_details.public_bucket_location_or_hash) + .get_full_object_path_str() + .to_string() } InferenceCategory::TextToSpeech => { // NB: TTS results receive the legacy treatment where their table only reports the full bucket path