From 4b21830e2014363bc06a34b6e62a07238a9e8544 Mon Sep 17 00:00:00 2001 From: Dongge Liu Date: Thu, 14 Sep 2023 21:05:18 +1000 Subject: [PATCH] Change to `WORKDIR` before running commands in cloud project experiments. (#10918) Mitigates the known issue where we don't automatically change to the `WORKDIR` defined in `Dockerfile` when running cloud experiments. Question: Would it be preferred if I introduce a flag for this? (e.g., `--use_workdir` or `--workdir=/src/`) While this gives more flexibility, I feel `cd` to `WORKDIR` should always be preferred if we want the cloud experiments to behave the same as local ones. --- infra/build/functions/project_experiment.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/infra/build/functions/project_experiment.py b/infra/build/functions/project_experiment.py index 3dd76d37e..21f58e9e7 100644 --- a/infra/build/functions/project_experiment.py +++ b/infra/build/functions/project_experiment.py @@ -72,11 +72,12 @@ def run_experiment(project_name, command, output_path, experiment_name): ] }, { - 'name': project.image, + 'name': + project.image, 'args': [ 'bash', '-c', - command, + f'(cd "/src"; cd {project.workdir}; {command})', ] }, {