Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion coman/.config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ current_platform = "HPC" # what platform to execute commands on (valid: HPC, ML
# environment_file: the path to the edf environment toml file in the cluster
# command: the command to run
# container_workdir: the working directory inside the container
# coman_squash: the path to the coman squash file
# coman_init: whether to use coman as an init system for the command. Needed for SSH/Portforwarding. Only work when using a docker container
sbatch_script_template = """
#!/bin/bash
#SBATCH --job-name={{name}}
#SBATCH --ntasks=1
#SBATCH --time=10:00:00
srun {% if environment_file %}--environment={{environment_file}}{% endif %} {% if coman_squash %}/coman/coman exec {% endif %}{{command}}
srun {% if environment_file %}--environment={{environment_file}}{% endif %} {% if coman_init %}/coman/coman exec {% endif %}{{command}}
"""

# the edf environment toml file template
Expand Down
9 changes: 8 additions & 1 deletion coman/src/cscs/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,11 @@ async fn handle_script(
context.insert("environment_file", &environment_path.to_path_buf());
context.insert("container_workdir", &workdir);
if let Some(path) = coman_squash {
context.insert("coman_squash", &path);
context.insert("coman_squash", &path); // path to coman squash file on remote
// whether to use coman as an init system. Only do this if running an image
context.insert("coman_init", &options.image.is_some());
} else {
context.insert("coman_init", &false);
}
let script = tera.render("script.sh", &context)?;
api_client
Expand Down Expand Up @@ -845,6 +849,9 @@ pub async fn cscs_job_start(
let image = image.try_into()?;
Some(image)
} else {
println!(
"Warning: No docker image specified (-i), functionality like SSH and port forwarding only works when running a docker image"
);
None
};
let image_meta = if let Some(docker_image) = docker_image {
Expand Down