Skip to content

Commit 797fca2

Browse files
authored
Merge pull request #707 from amd/dev
Merge from AMD
2 parents d7f1347 + e126ae0 commit 797fca2

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

automation/script/docker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def dockerfile(self_module, input_params):
155155

156156
# Prepare Docker-specific inputs
157157
docker_inputs, dockerfile_path = prepare_docker_inputs(
158-
input_params, docker_settings, script_directory)
158+
input_params, docker_settings, script, False, self_module.action_object)
159159

160160
# Handle optional dependencies and comments
161161
if input_params.get('print_deps'):
@@ -392,7 +392,7 @@ def docker_run(self_module, i):
392392

393393
# Prepare Docker-specific inputs
394394
docker_inputs, dockerfile_path = prepare_docker_inputs(
395-
i, docker_settings, script_path, True)
395+
i, docker_settings, script, True, self_module.action_object)
396396

397397
if docker_inputs is None:
398398
return {'return': 1, 'error': 'Error preparing Docker inputs'}

automation/script/docker_utils.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,14 +122,15 @@ def process_mounts(mounts, env, docker_settings, f_run_cmd, run_state):
122122

123123

124124
def prepare_docker_inputs(input_params, docker_settings,
125-
script_path, run_stage=False):
125+
script, run_stage, mlc):
126126
"""
127127
Prepares Docker-specific inputs such as Dockerfile path and runtime options.
128128
129129
Args:
130130
i: Input dictionary with user-specified overrides.
131131
docker_settings: Docker-specific settings from the script's metadata.
132-
script_path: Path to the script being executed.
132+
script: Script being executed.
133+
mlc: MLC action object
133134
134135
Returns:
135136
Tuple with Docker inputs dictionary and Dockerfile path or None in case of an error.
@@ -171,7 +172,13 @@ def prepare_docker_inputs(input_params, docker_settings,
171172
docker_base_image = docker_inputs.get('base_image')
172173
docker_path = docker_inputs.get('path')
173174
if not docker_path:
174-
docker_path = script_path
175+
script_meta = script.meta
176+
script_uid = script_meta['uid']
177+
script_alias = script_meta.get('alias')
178+
folder_name = f"""{script_alias}_{script_uid[:5]}"""
179+
docker_path = os.path.join(
180+
mlc.repos_path, 'local', 'docker', folder_name)
181+
# docker_path = os.getcwd()
175182
docker_filename_suffix = (
176183
docker_base_image.replace('/', '-').replace(':', '-')
177184
if docker_base_image else f"{docker_inputs['os']}_{docker_inputs['os_version']}"

0 commit comments

Comments
 (0)