|
|
@@ -44,7 +44,9 @@ pub async fn doctor(
|
|
|
let recipe = load_recipe(recipe_name).await?;
|
|
|
let dn = recipe.name.clone();
|
|
|
let de = recipe.engine.clone();
|
|
|
- let db = recipe.distributed_backend.to_string();
|
|
|
+ let db = recipe
|
|
|
+ .distributed_backend
|
|
|
+ .map_or("none".to_string(), |b| b.to_string());
|
|
|
println!(
|
|
|
"{}",
|
|
|
fluent_i18n::t!("doctor-header", {
|
|
|
@@ -64,7 +66,9 @@ pub async fn doctor(
|
|
|
let config = config.clone();
|
|
|
let node = node.clone();
|
|
|
let engine = recipe.engine.clone();
|
|
|
- let backend = recipe.distributed_backend.to_string();
|
|
|
+ let backend = recipe
|
|
|
+ .distributed_backend
|
|
|
+ .map_or("none".to_string(), |b| b.to_string());
|
|
|
let image = recipe.docker_image.clone();
|
|
|
handles.push(tokio::spawn(async move {
|
|
|
check_node(&config, &node, &engine, &backend, &image).await
|
|
|
@@ -281,7 +285,7 @@ async fn run_cluster_repair(
|
|
|
fn generate_repair_dockerfile(base_image: &str, recipe: &Recipe) -> String {
|
|
|
let mut lines = vec![format!("FROM {}", base_image)];
|
|
|
|
|
|
- if recipe.distributed_backend == crate::config::DistributedBackend::Ray {
|
|
|
+ if recipe.distributed_backend == Some(crate::config::DistributedBackend::Ray) {
|
|
|
lines.push("RUN pip install ray[default] || pip install ray".to_string());
|
|
|
}
|
|
|
|
|
|
@@ -339,7 +343,7 @@ mod tests {
|
|
|
env: HashMap::new(),
|
|
|
cluster: None,
|
|
|
entrypoint: vec![],
|
|
|
- distributed_backend: crate::config::DistributedBackend::Mp,
|
|
|
+ distributed_backend: Some(crate::config::DistributedBackend::Mp),
|
|
|
before_serve: vec![],
|
|
|
mods: Default::default(),
|
|
|
shm_size: String::new(),
|
|
|
@@ -360,7 +364,7 @@ mod tests {
|
|
|
#[test]
|
|
|
fn test_generate_repair_dockerfile_ray() {
|
|
|
let mut recipe = test_recipe();
|
|
|
- recipe.distributed_backend = crate::config::DistributedBackend::Ray;
|
|
|
+ recipe.distributed_backend = Some(crate::config::DistributedBackend::Ray);
|
|
|
let dockerfile = generate_repair_dockerfile("base/image:tag", &recipe);
|
|
|
|
|
|
assert!(dockerfile.contains("FROM base/image:tag"));
|