diff --git a/Cargo.lock b/Cargo.lock index ab7f8a587f..7301b5665c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -646,6 +646,15 @@ dependencies = [ "syn", ] +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "any_ascii" version = "0.1.7" @@ -995,6 +1004,21 @@ dependencies = [ "generic-array", ] +[[package]] +name = "clap" +version = "2.34.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" +dependencies = [ + "ansi_term", + "atty", + "bitflags", + "strsim", + "textwrap", + "unicode-width", + "vec_map", +] + [[package]] name = "cloudabi" version = "0.0.3" @@ -3837,6 +3861,12 @@ dependencies = [ "unicode-normalization", ] +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" + [[package]] name = "subprocess" version = "0.2.7" @@ -3915,6 +3945,15 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" +dependencies = [ + "unicode-width", +] + [[package]] name = "thiserror" version = "1.0.30" @@ -4348,6 +4387,7 @@ version = "0.0.1" dependencies = [ "anyhow", "chrono", + "clap", "config", "container_common", "database_queries", @@ -4687,6 +4727,12 @@ version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbdbff6266a24120518560b5dc983096efb98462e51d0d68169895b237be3e5d" +[[package]] +name = "vec_map" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" + [[package]] name = "version_check" version = "0.9.3" diff --git a/crates/service/tts_inference_job/Cargo.toml b/crates/service/tts_inference_job/Cargo.toml index 3eb90fd72b..a1178bfe1b 100644 --- a/crates/service/tts_inference_job/Cargo.toml +++ b/crates/service/tts_inference_job/Cargo.toml @@ -28,6 +28,7 @@ newrelic-telemetry = { path = "../../vendor/newrelic-telemetry-sdk-rust" } # External anyhow = "1.0.40" chrono = { version = "0.4.19", features = ["serde"] } +clap = "2.34.0" # TODO: This is really out of date, but has conflicts when updated dotenv = "0.15.0" easyenv = "0.0.6" hostname = "0.3.1" diff --git a/crates/service/tts_inference_job/src/main.rs b/crates/service/tts_inference_job/src/main.rs index c6652e7acf..cc09aa777f 100644 --- a/crates/service/tts_inference_job/src/main.rs +++ b/crates/service/tts_inference_job/src/main.rs @@ -67,6 +67,7 @@ use storage_buckets_common::bucket_client::BucketClient; use storage_buckets_common::bucket_path_unifier::BucketPathUnifier; use tempdir::TempDir; use tts_common::clean_symbols::clean_symbols; +use clap::{App, Arg}; // Buckets (shared config) const ENV_ACCESS_KEY : &'static str = "ACCESS_KEY"; @@ -164,7 +165,16 @@ async fn main() -> AnyhowResult<()> { // This file should only contain *development* secrets, never production. let _ = dotenv::from_filename(".env-secrets").ok(); - info!("Obtaining hostname..."); + let matches = App::new("tts-inference-job") + .arg(Arg::with_name("config") + .long("sidecar_hostname") + .value_name("HOSTNAME") + .help("Hostname for the TTS inference sidecar") + .takes_value(true) + .required(false)) + .get_matches(); + + info!("Obtaining worker hostname..."); let server_hostname = hostname::get() .ok() @@ -211,9 +221,15 @@ async fn main() -> AnyhowResult<()> { &py_script_name, ); - let sidecar_hostname = + let mut sidecar_hostname = easyenv::get_env_string_required(ENV_TTS_INFERENCE_SIDECAR_HOSTNAME)?; + if let Some(hostname) = matches.value_of("sidecar_hostname") { + sidecar_hostname = hostname.to_string(); + } + + info!("Sidecar hostname: {:?}", sidecar_hostname); + let tts_inference_sidecar_client = TtsInferenceSidecarClient::new(&sidecar_hostname);