diff --git a/_sql/migrations/2023-04-22-085636_voice_conversion_results_change_columns/down.sql b/_sql/migrations/2023-04-22-085636_voice_conversion_results_change_columns/down.sql index 0dbc5daf97..7bff15781b 100644 --- a/_sql/migrations/2023-04-22-085636_voice_conversion_results_change_columns/down.sql +++ b/_sql/migrations/2023-04-22-085636_voice_conversion_results_change_columns/down.sql @@ -2,9 +2,6 @@ -- noinspection SqlNoDataSourceInspectionForFile -- noinspection SqlResolveForFile --- These columns are no longer useful. --- It's better to store booleans for each type of file we store and calculate the paths. - ALTER TABLE voice_conversion_results DROP COLUMN public_bucket_hash; ALTER TABLE voice_conversion_results DROP COLUMN bucket_has_wav; ALTER TABLE voice_conversion_results DROP COLUMN bucket_has_mp3; diff --git a/crates/lib/mysql_queries/src/payloads/generic_inference_args.rs b/crates/lib/mysql_queries/src/payloads/generic_inference_args.rs index d7113ac498..5713eb86b0 100644 --- a/crates/lib/mysql_queries/src/payloads/generic_inference_args.rs +++ b/crates/lib/mysql_queries/src/payloads/generic_inference_args.rs @@ -6,7 +6,7 @@ use tokens::voice_conversion::model::VoiceConversionModelToken; /// Used to encode extra state for the `generic_inference_jobs` table. /// This should act somewhat like a serialized protobuf stored inside a record. -#[derive(Clone, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub struct GenericInferenceArgs { /// The category of inference (probably also present in a top-level field) #[serde(rename = "cat")] // NB: DO NOT CHANGE. It could break live jobs. Renamed to consume fewer bytes @@ -20,7 +20,7 @@ pub struct GenericInferenceArgs { /// Same as `InferenceCategory`, but serialized in fewer characters /// Do not change the values. -#[derive(Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)] +#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, Serialize)] pub enum InferenceCategoryAbbreviated { #[serde(rename = "tts")] // NB: DO NOT CHANGE. It could break live jobs. Renamed to be fewer bytes. #[serde(alias = "text_to_speech")] @@ -31,7 +31,7 @@ pub enum InferenceCategoryAbbreviated { VoiceConversion, } -#[derive(Clone, Serialize, Deserialize)] +#[derive(Clone, Debug, Serialize, Deserialize)] pub enum PolymorphicInferenceArgs { TextToSpeechInferenceArgs { // No arguments yet. diff --git a/crates/lib/mysql_queries/src/queries/voice_conversion/results/insert_voice_conversion_result.rs b/crates/lib/mysql_queries/src/queries/voice_conversion/results/insert_voice_conversion_result.rs index 76934ce51e..f0dd51ab3e 100644 --- a/crates/lib/mysql_queries/src/queries/voice_conversion/results/insert_voice_conversion_result.rs +++ b/crates/lib/mysql_queries/src/queries/voice_conversion/results/insert_voice_conversion_result.rs @@ -14,10 +14,10 @@ pub struct SyntheticIdRecord { pub next_id: i64, } -pub struct InsertArgs<'a, P> where P: AsRef { +pub struct InsertArgs<'a> { pub pool: &'a MySqlPool, pub job: &'a AvailableInferenceJob, - pub bucket_audio_results_path: P, + pub public_bucket_hash: &'a str, pub file_size_bytes: u64, pub duration_millis: u64, pub is_on_prem: bool, @@ -25,8 +25,8 @@ pub struct InsertArgs<'a, P> where P: AsRef { pub is_debug_worker: bool, } -pub async fn insert_voice_conversion_result>( - args: InsertArgs<'_, P> +pub async fn insert_voice_conversion_result( + args: InsertArgs<'_> ) -> AnyhowResult<(VoiceConversionResultToken, u64)> { let result_token = VoiceConversionResultToken::generate(); @@ -89,16 +89,10 @@ LIMIT 1 maybe_creator_synthetic_id = Some(next_id); } - let bucket_audio_result_path = &args.bucket_audio_results_path - .as_ref() - .display() - .to_string(); - let vc_model_token = args.job.maybe_model_token.as_deref(); let creator_ip_address = args.job.creator_ip_address.as_str(); let creator_set_visibility = args.job.creator_set_visibility.clone(); - let record_id = { let query_result = sqlx::query!( r#" @@ -115,7 +109,8 @@ SET creator_ip_address = ?, creator_set_visibility = ?, - public_bucket_wav_audio_path = ?, + public_bucket_hash = ?, + bucket_has_wav = true, file_size_bytes = ?, duration_millis = ?, @@ -124,7 +119,7 @@ SET generated_by_worker = ?, is_debug_request = ? "#, - result_token.to_str(), + result_token.as_str(), args.job.maybe_model_token, "", @@ -135,7 +130,7 @@ SET args.job.creator_ip_address, args.job.creator_set_visibility.to_str(), - bucket_audio_result_path, + args.public_bucket_hash, args.file_size_bytes, args.duration_millis, diff --git a/crates/service/job/inference_job/src/job/job_types/vc/process_single_vc_job.rs b/crates/service/job/inference_job/src/job/job_types/vc/process_single_vc_job.rs index 1098a98764..bdca442af9 100644 --- a/crates/service/job/inference_job/src/job/job_types/vc/process_single_vc_job.rs +++ b/crates/service/job/inference_job/src/job/job_types/vc/process_single_vc_job.rs @@ -41,7 +41,7 @@ pub async fn process_single_vc_job(job_dependencies: &JobDependencies, job: &Ava let maybe_media_upload_token = job.maybe_inference_args .as_ref() - .map(|args| args.args) + .map(|args| args.args.as_ref()) .flatten() .map(|args| { match args { diff --git a/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/process_job.rs b/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/process_job.rs index 5f7e021ef1..ad3788b7f9 100644 --- a/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/process_job.rs +++ b/crates/service/job/inference_job/src/job/job_types/vc/so_vits_svc/process_job.rs @@ -236,7 +236,7 @@ pub async fn process_job(args: SoVitsSvcProcessJobArgs<'_>) -> Result) -> Result AnyhowResult<()> { }, vits: VitsDetails { inference_command: vits_inference_command()?, - } + }, + so_vits_svc: SoVitsSvcDetails { + inference_command: SoVitsSvcInferenceCommand::from_env()?, + }, }, };