From 3d5263ba673aa55ef8e5f762b1386242fabb2cf0 Mon Sep 17 00:00:00 2001 From: Ralf Grubenmann Date: Wed, 18 Mar 2026 09:14:06 +0100 Subject: [PATCH] only use coman init system for docker images --- coman/.config/config.toml | 4 +++- coman/src/cscs/handlers.rs | 9 ++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/coman/.config/config.toml b/coman/.config/config.toml index 6cc00ad..a567773 100644 --- a/coman/.config/config.toml +++ b/coman/.config/config.toml @@ -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 diff --git a/coman/src/cscs/handlers.rs b/coman/src/cscs/handlers.rs index adbcfed..bb37c7c 100644 --- a/coman/src/cscs/handlers.rs +++ b/coman/src/cscs/handlers.rs @@ -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 @@ -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 {