diff --git a/crates/lib/api_clients/cloud_storage/src/bucket_client.rs b/crates/lib/api_clients/cloud_storage/src/bucket_client.rs index 8a84306f1c..943bf01e3e 100644 --- a/crates/lib/api_clients/cloud_storage/src/bucket_client.rs +++ b/crates/lib/api_clients/cloud_storage/src/bucket_client.rs @@ -4,11 +4,13 @@ use std::time::Duration; use anyhow::anyhow; use anyhow::bail; -use log::warn; +use log::{error, warn}; use log::{debug, info}; use s3::bucket::Bucket; use s3::creds::Credentials; +use s3::error::S3Error; use s3::region::Region; +use s3::request::ResponseData; use tokio::fs::File; use tokio::io::AsyncReadExt; @@ -143,7 +145,13 @@ impl BucketClient { let object_name = self.get_rooted_object_name(object_name); info!("Rooted filename for bucket: {}", object_name); - let response = self.bucket.put_object_with_content_type(&object_name, bytes, content_type).await?; + let response = self.bucket.put_object_with_content_type(&object_name, bytes, content_type).await; + + if let Err(err) = &response { + error!("S3 Upload Error for bucket name {}: {:?}", &self.bucket.name, err); + } + + let response = response?; let body_bytes = response.bytes(); let code = response.status_code(); diff --git a/crates/lib/bootstrap/src/bootstrap.rs b/crates/lib/bootstrap/src/bootstrap.rs index 37d0e40e03..a4e71a82d5 100644 --- a/crates/lib/bootstrap/src/bootstrap.rs +++ b/crates/lib/bootstrap/src/bootstrap.rs @@ -15,6 +15,11 @@ pub struct BootstrapArgs<'a, P: AsRef> { /// Where to look for env conf files. pub config_search_directories: &'a [P], + + /// If true, ignore the root '.env' file. + /// TODO(bt,2025-01-23): Make this the default behavior, then remove reading from '.env' entirely, + /// There are too many apps that share this file. + pub ignore_legacy_dot_env_file: bool, } /// Information about how the application is deployed. @@ -45,7 +50,11 @@ pub struct ContainerEnvironment { const SERVER_ENVIRONMENT : &str = "SERVER_ENVIRONMENT"; pub fn bootstrap>(args: BootstrapArgs<'_, P>) -> AnyhowResult { - easyenv::init_all_with_default_logging(args.default_logging_override); + if args.ignore_legacy_dot_env_file { + easyenv::init_env_logger(args.default_logging_override); + } else { + easyenv::init_all_with_default_logging(args.default_logging_override); + } info!("Bootstrapping application {}", &args.app_name); diff --git a/crates/service/job/inference_job/src/job/job_types/studio_gen2/download_file_for_studio.rs b/crates/service/job/inference_job/src/job/job_types/studio_gen2/download_file_for_studio.rs index adb92544cd..60e4cba32f 100644 --- a/crates/service/job/inference_job/src/job/job_types/studio_gen2/download_file_for_studio.rs +++ b/crates/service/job/inference_job/src/job/job_types/studio_gen2/download_file_for_studio.rs @@ -52,7 +52,7 @@ pub async fn download_file_for_studio( let suffix = get_suffix(&input_media_file); - let filesystem_path = args.input_paths.input_dir + let filesystem_path = args.input_paths.input_dir.path() .join(format!("{}{}", args.filename_without_extension, suffix)); info!("Downloading input file to {:?}", &filesystem_path); diff --git a/crates/service/job/inference_job/src/job/job_types/studio_gen2/stable_animator_command.rs b/crates/service/job/inference_job/src/job/job_types/studio_gen2/stable_animator_command.rs index 3b60593d97..49f9055d01 100644 --- a/crates/service/job/inference_job/src/job/job_types/studio_gen2/stable_animator_command.rs +++ b/crates/service/job/inference_job/src/job/job_types/studio_gen2/stable_animator_command.rs @@ -24,12 +24,11 @@ python inference_advanced.py \ --gradient_checkpointing */ -use std::io::BufReader; use std::path::{Path, PathBuf}; use std::process::Stdio; use std::time::Duration; use log::{debug, info, warn}; -use tokio::io::{AsyncBufReadExt, AsyncWriteExt}; +use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader}; use tokio::process::Command; use errors::AnyhowResult; use filesys::path_to_string::path_to_string; @@ -40,7 +39,7 @@ use crate::util::get_filtered_env_vars::get_filtered_env_vars_hashmap; #[derive(Clone)] pub struct StableAnimatorCommand { /// Where the code lives - comfy_root_code_directory: PathBuf, + root_code_directory: PathBuf, /// A single executable script or a much larger bash command. executable_or_command: ExecutableOrCommand, @@ -84,6 +83,16 @@ pub struct InferenceArgs<'s> { } impl StableAnimatorCommand { + pub fn new_from_env() -> AnyhowResult { + Ok(Self { + root_code_directory: PathBuf::from("/home/bt/dev/storyteller/storyteller-ml/animation/StableAnimator"), + executable_or_command: ExecutableOrCommand::Executable(PathBuf::from("inference_advanced.py")), + maybe_virtual_env_activation_command: Some(String::from("source venv/bin/activate")), + maybe_docker_options: None, + maybe_execution_timeout: None, + }) + } + pub async fn execute_inference<'a, 'b>( &'a self, args: InferenceArgs<'b>, @@ -91,7 +100,7 @@ impl StableAnimatorCommand { info!("InferenceArgs: {:?}", &args); let mut command = String::new(); - command.push_str(&format!("cd {}", path_to_string(&self.comfy_root_code_directory))); + command.push_str(&format!("cd {}", path_to_string(&self.root_code_directory))); if let Some(venv_command) = self.maybe_virtual_env_activation_command.as_deref() { command.push_str(" && "); diff --git a/crates/service/job/inference_job/src/job/job_types/studio_gen2/studio_gen2_dependencies.rs b/crates/service/job/inference_job/src/job/job_types/studio_gen2/studio_gen2_dependencies.rs index 2d597f0de5..649c43f85e 100644 --- a/crates/service/job/inference_job/src/job/job_types/studio_gen2/studio_gen2_dependencies.rs +++ b/crates/service/job/inference_job/src/job/job_types/studio_gen2/studio_gen2_dependencies.rs @@ -28,7 +28,7 @@ impl StudioGen2Dependencies { model_path: PathBuf::from("/tmp/model.pt"), input_directory: PathBuf::from("/tmp/input"), output_directory: PathBuf::from("/tmp/output"), - command: StableAnimatorCommand::new(), + command: StableAnimatorCommand::new_from_env()?, // TODO pretrained_model_name_or_path: Default::default(), diff --git a/crates/service/web/storyteller_web/config/storyteller-web.development.env b/crates/service/web/storyteller_web/config/storyteller-web.development.env index 5e31aa134a..f099858201 100644 --- a/crates/service/web/storyteller_web/config/storyteller-web.development.env +++ b/crates/service/web/storyteller_web/config/storyteller-web.development.env @@ -1,5 +1,8 @@ # storyteller-web default .env configurations (these can be overridden with k8s) +# Development +SERVER_ENVIRONMENT='development' + # We can't serve HTTPS locally without self-signed certificate nonsense. COOKIE_SECURE=false COOKIE_DOMAIN=.jungle.horse @@ -34,3 +37,7 @@ REDIS_0_URL="redis://localhost/0" #REDIS_1_URL="redis://localhost/1" GC_ENABLED_PUBLIC_BUCKET_NAME="REPLACE_ME" + +# Legacy configs +AUDIO_UPLOADS_BUCKET_ROOT=/user_uploaded_w2l_audio + diff --git a/crates/service/web/storyteller_web/src/main.rs b/crates/service/web/storyteller_web/src/main.rs index a82fdb6a3d..1c2bf9c7b3 100644 --- a/crates/service/web/storyteller_web/src/main.rs +++ b/crates/service/web/storyteller_web/src/main.rs @@ -132,6 +132,7 @@ async fn main() -> AnyhowResult<()> { app_name: "storyteller-web", default_logging_override: Some(DEFAULT_RUST_LOG), config_search_directories: &[".", "./config", "crates/service/web/storyteller_web/config"], + ignore_legacy_dot_env_file: true, })?; let common_env = CommonEnv::read_from_env()?;