Skip to content

Commit 89cc7f0

Browse files
committed
only use coman init system for docker images
1 parent 48e58fa commit 89cc7f0

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

coman/.config/config.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ current_platform = "HPC" # what platform to execute commands on (valid: HPC, ML
2121
# environment_file: the path to the edf environment toml file in the cluster
2222
# command: the command to run
2323
# container_workdir: the working directory inside the container
24+
# coman_squash: the path to the coman squash file
25+
# coman_init: whether to use coman as an init system for the command. Needed for SSH/Portforwarding. Only work when using a docker container
2426
sbatch_script_template = """
2527
#!/bin/bash
2628
#SBATCH --job-name={{name}}
2729
#SBATCH --ntasks=1
2830
#SBATCH --time=10:00:00
29-
srun {% if environment_file %}--environment={{environment_file}}{% endif %} {% if coman_squash %}/coman/coman exec {% endif %}{{command}}
31+
srun {% if environment_file %}--environment={{environment_file}}{% endif %} {% if coman_init %}/coman/coman exec {% endif %}{{command}}
3032
"""
3133

3234
# the edf environment toml file template

coman/src/cscs/handlers.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,9 @@ async fn handle_script(
772772
context.insert("environment_file", &environment_path.to_path_buf());
773773
context.insert("container_workdir", &workdir);
774774
if let Some(path) = coman_squash {
775-
context.insert("coman_squash", &path);
775+
context.insert("coman_squash", &path); // path to coman squash file on remote
776+
// whether to use coman as an init system. Only do this if running an image
777+
context.insert("coman_init", &options.image.is_some());
776778
}
777779
let script = tera.render("script.sh", &context)?;
778780
api_client
@@ -845,6 +847,9 @@ pub async fn cscs_job_start(
845847
let image = image.try_into()?;
846848
Some(image)
847849
} else {
850+
println!(
851+
"Warning: No docker image specified (-i), functionality like SSH and port forwarding only works when running a docker image"
852+
);
848853
None
849854
};
850855
let image_meta = if let Some(docker_image) = docker_image {

0 commit comments

Comments
 (0)