Skip to content

Commit

Permalink
Run full automatic as extended test
Browse files Browse the repository at this point in the history
  • Loading branch information
nieznanysprawiciel committed Jul 29, 2024
1 parent 144db63 commit 4a3189c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
24 changes: 17 additions & 7 deletions src/process/automatic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ impl Runtime for Automatic {
})
}

async fn test(config: Self::CONFIG) -> anyhow::Result<()> {
gpu_detection(&config)
.map_err(|err| anyhow::anyhow!("Unable to detect GPU. Error: {err}"))?;

Ok(())
}

async fn stop(&mut self) -> anyhow::Result<()> {
log::info!("Stopping Automatic server");
let client = reqwest::Client::new();
Expand All @@ -87,6 +80,23 @@ impl Runtime for Automatic {
log::debug!("Automatic process has stopped");
res
}

async fn test(config: Self::CONFIG) -> anyhow::Result<()> {
gpu_detection(&config)
.map_err(|err| anyhow::anyhow!("Unable to detect GPU. Error: {err}"))?;

if config.extended_test {
let mut automatic = Self::start(None, config).await?;
automatic.stop().await?;
let status = automatic.wait().await?;

return match status.success() {
true => Ok(()),
false => anyhow::bail!("Automatic test failed with code: {:?}", status.code()),
};
}
Ok(())
}
}

fn build_cmd(model: Option<PathBuf>, config: &Config) -> anyhow::Result<Command> {
Expand Down
8 changes: 3 additions & 5 deletions src/process/automatic/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,26 @@ pub(crate) struct Config {
pub startup_script: String,

pub api_port: u16,

pub api_host: String,

pub api_shutdown_path: String,

pub model_arg: String,

pub additional_args: Vec<String>,

// Monitor
#[serde(with = "humantime_serde")]
pub startup_timeout: Duration,

#[serde(with = "humantime_serde")]
pub api_ping_delay: Duration,

pub monitored_startup_msg: String,

pub monitored_model_failure_msg: String,

pub monitored_msgs_w_trace_lvl: Vec<String>,

pub gpu_uuid: Option<String>,

pub extended_test: bool,
}

impl RuntimeConfig for Config {
Expand Down Expand Up @@ -63,6 +60,7 @@ impl Default for Config {
"\"GET / HTTP/1.1\" 404 Not Found".into(),
],
gpu_uuid: None,
extended_test: false,
}
}
}
Expand Down

0 comments on commit 4a3189c

Please sign in to comment.