diff --git a/Cargo.lock b/Cargo.lock index 5a0146aa08..1147386e55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3595,6 +3595,7 @@ dependencies = [ "dotenv", "easyenv", "enums", + "envvar", "errors", "hostname", "hyper 0.14.24", diff --git a/Dockerfile b/Dockerfile index 2dafc2ba55..2d4fd8b744 100644 --- a/Dockerfile +++ b/Dockerfile @@ -226,6 +226,7 @@ RUN touch .env-secrets # Some services have default env files that live under their code directories # These should also be readable from the relative current path +COPY crates/service/job/inference_job/inference-job.env . COPY crates/service/web/storyteller_web/storyteller-web.env . EXPOSE 8080 diff --git a/crates/service/job/inference_job/Cargo.toml b/crates/service/job/inference_job/Cargo.toml index e246ca97cf..af6f418999 100644 --- a/crates/service/job/inference_job/Cargo.toml +++ b/crates/service/job/inference_job/Cargo.toml @@ -19,6 +19,7 @@ cloud_storage = { path = "../../../lib/api_clients/cloud_storage" } config = { path = "../../../lib/deprecated/config" } container_common = { path = "../../../lib/deprecated/container_common" } enums = { path = "../../../_types/enums" } +envvar = { path = "../../../lib/envvar" } errors = { path = "../../../lib/errors" } jobs_common = { path = "../../../lib/jobs_common" } memory_caching = { path = "../../../lib/caching/memory_caching" } diff --git a/crates/service/job/inference_job/inference-job.env b/crates/service/job/inference_job/inference-job.env new file mode 100644 index 0000000000..f54d58c915 --- /dev/null +++ b/crates/service/job/inference_job/inference-job.env @@ -0,0 +1 @@ +# inference-job default .env configurations (these can be overridden with k8s) diff --git a/crates/service/job/inference_job/src/main.rs b/crates/service/job/inference_job/src/main.rs index 96aea48563..7c560bed74 100644 --- a/crates/service/job/inference_job/src/main.rs +++ b/crates/service/job/inference_job/src/main.rs @@ -53,6 +53,7 @@ use r2d2_redis::r2d2; use sqlx::mysql::MySqlPoolOptions; use std::path::PathBuf; use std::time::Duration; +use crate::job_steps::main_loop::main_loop; // Buckets (shared config) const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY"; @@ -83,6 +84,10 @@ async fn main() -> AnyhowResult<()> { // This file should only contain *development* secrets, never production. let _ = dotenv::from_filename(".env-secrets").ok(); + let _ = envvar::read_from_filename_and_paths( + "inference-job.env", + &[".", "crates/service/job/inference_job"])?; + let matches = App::new("tts-inference-job") .arg(Arg::with_name("sidecar_hostname") .long("sidecar_hostname") @@ -285,7 +290,7 @@ async fn main() -> AnyhowResult<()> { } }; - let _job_dependencies = JobDependencies { + let job_dependencies = JobDependencies { scoped_temp_dir_creator: ScopedTempDirCreator::for_directory(&temp_directory), download_temp_directory: temp_directory, mysql_pool, @@ -329,7 +334,7 @@ async fn main() -> AnyhowResult<()> { }; // TODO: Main loop start - //main_loop_old(inferencer).await; + main_loop(job_dependencies).await; Ok(()) }