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
6 changes: 3 additions & 3 deletions internal/remote/firecrest/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,11 +648,11 @@ func addSessionMountsToScript(sessionScript string, fileSystems *[]FileSystem, s
mounts = append(mounts, fmt.Sprintf("%s:/secrets:ro", secretsPath))
}

// Format mount list for the environment.toml file
// Format mount list
for i := range mounts {
mounts[i] = fmt.Sprintf(" \"%s\",", mounts[i])
mounts[i] = fmt.Sprintf("\"%s\"", mounts[i])
}
mountsStr := fmt.Sprintf("mounts = [\n%s\n]", strings.Join(mounts, "\n"))
mountsStr := fmt.Sprintf("--container-mounts=%s", strings.Join(mounts, ","))
return strings.Replace(sessionScript, "#{{SESSION_MOUNTS_PLACEHOLDER}}", mountsStr, 1)
}

Expand Down
8 changes: 7 additions & 1 deletion internal/remote/firecrest/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ func TestRenderSessionScriptStatic(t *testing.T) {
assert.Contains(t, sessionScriptFinal, "#SBATCH --partition=my-partition")

// Check the mounts
mountsRegExp := regexp.MustCompile(`mounts(?:\s*)=(?:\s*)[[]([^]]*)]`)
// From `srun --help`:
// --container-mounts=SRC:DST[:FLAGS][,SRC:DST...]
// [pyxis] bind mount[s] inside the container. Mount
// flags are separated with "+", e.g. "ro+rprivate"
flagsRegExp := `:(?:ro|rprivate)(?:[+](?:ro|rprivate))*`
mountRegExp := `"[^:,"]+:[^:,"]+(?:` + flagsRegExp + `)?"`
mountsRegExp := regexp.MustCompile(`--container-mounts=(` + mountRegExp + `(?:,` + mountRegExp + `)*)`)
matches := mountsRegExp.FindStringSubmatch(sessionScriptFinal)
assert.Len(t, matches, 2)
foundMounts := matches[1]
Expand Down
4 changes: 2 additions & 2 deletions internal/remote/firecrest/session_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,13 @@ fi
# Create the environment.toml file to run the session
EDF_FILE="${SESSION_DIR}/environment.toml"
cat <<EOF >"${EDF_FILE}"
#{{SESSION_MOUNTS_PLACEHOLDER}}

[annotations]
com.hooks.cxi.enabled = "false"
EOF

srun_param_container_image="--container-image ${REMOTE_SESSION_IMAGE}"
srun_param_workdir="--container-workdir ${SESSION_WORK_DIR}"
srun_param_mounts=#{{SESSION_MOUNTS_PLACEHOLDER}}

export RENKU_MOUNT_DIR="${SESSION_WORK_DIR}"
export RENKU_WORKING_DIR="${SESSION_WORK_DIR}"
Expand Down Expand Up @@ -252,6 +251,7 @@ srun \
--environment "${EDF_FILE}" \
${srun_param_container_image} \
${srun_param_workdir} \
${srun_param_mounts} \
--no-container-entrypoint sh /etc/rc \
& pid=$!
wait
Expand Down
Loading