Skip to content

Commit d1420d0

Browse files
committed
Support adding dependent CM script commands in CM dockerfile
1 parent bc49ce5 commit d1420d0

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

script/app-mlperf-inference-mlcommons-python/_cm.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,6 @@ deps:
625625
enable_if_env:
626626
CM_MODEL:
627627
- rgat
628-
skip_if_any_env:
629-
CM_DATASET_IGBH_PATH:
630-
- "on"
631628
skip_if_env:
632629
CM_RUN_STATE_DOCKER:
633630
- 'yes'

script/build-dockerfile/customize.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,26 @@ def preprocess(i):
379379
if run_cmd_extra != '':
380380
x += ' ' + run_cmd_extra
381381

382+
if env.get('CM_DOCKER_RUN_SCRIPT_TAGS', '') != '' and str(env.get(
383+
'CM_DOCKER_ADD_DEPENDENT_SCRIPTS_RUN_COMMANDS', '')).lower() in ["yes", "1", "true"]:
384+
cm_input = {'action': 'run',
385+
'automation': 'script',
386+
'tags': f"""{env['CM_DOCKER_RUN_SCRIPT_TAGS']}""",
387+
'print_deps': True,
388+
'quiet': True,
389+
'silent': True,
390+
'fake_run': True,
391+
'fake_deps': True
392+
}
393+
r = self_module.cmind.access(cm_input)
394+
if r['return'] > 0:
395+
return r
396+
print_deps = r['new_state']['print_deps']
397+
fake_run_str = " --fake_run" if env.get('CM_DOCKER_FAKE_DEPS') else ""
398+
cmds = ["RUN " + dep for dep in print_deps]
399+
for cmd in cmds:
400+
f.write(cmd + fake_run_str + EOL)
401+
382402
f.write(x + EOL)
383403

384404
# fake_run to install the dependent scripts and caching them

0 commit comments

Comments
 (0)