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
3 changes: 2 additions & 1 deletion src/madengine/deployment/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,8 @@ def _prepare_slurm_multi_script(self, model_info: Dict, docker_image_name: str =
])

for key, value in env_vars.items():
script_lines.append(f"export {key}={shlex.quote(str(value))}")
escaped = str(value).replace('\\', '\\\\').replace('"', '\\"').replace('$', '\\$').replace('`', '\\`')
script_lines.append(f'export {key}="{escaped}"')

script_lines.append("")
script_lines.extend([
Expand Down
8 changes: 7 additions & 1 deletion src/madengine/execution/docker_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import os
import shlex
from pathlib import Path
import time
import json
import re
Expand Down Expand Up @@ -177,9 +178,14 @@ def build_image(
# Build the image with logging
build_start_time = time.time()

tools_build_context = ""
tools_dir = Path("scripts/common/tools")
if tools_dir.exists():
tools_build_context = f"--build-context tools={tools_dir} "

build_command = (
f"docker build {use_cache_str} --network=host "
f"--build-context tools=./tools "
f"{tools_build_context}"
f"-t {shlex.quote(docker_image)} --pull -f {shlex.quote(dockerfile)} "
f"{build_args} {shlex.quote(docker_context)}"
)
Expand Down
Loading