Skip to content

Commit

Permalink
Support adding dependent CM script commands in CM dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsuresh committed Dec 27, 2024
1 parent c3550d2 commit 3771397
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
3 changes: 0 additions & 3 deletions script/app-mlperf-inference-mlcommons-python/_cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -625,9 +625,6 @@ deps:
enable_if_env:
CM_MODEL:
- rgat
skip_if_any_env:
CM_DATASET_IGBH_PATH:
- "on"
skip_if_env:
CM_RUN_STATE_DOCKER:
- 'yes'
Expand Down
20 changes: 20 additions & 0 deletions script/build-dockerfile/customize.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,26 @@ def preprocess(i):
if run_cmd_extra != '':
x += ' ' + run_cmd_extra

if env.get('CM_DOCKER_RUN_SCRIPT_TAGS', '') != '' and str(env.get(
'CM_DOCKER_ADD_DEPENDENT_SCRIPTS_RUN_COMMANDS', '')).lower() in ["yes", "1", "true"]:
cm_input = {'action': 'run',
'automation': 'script',
'tags': f"""{env['CM_DOCKER_RUN_SCRIPT_TAGS']}""",
'print_deps': True,
'quiet': True,
'silent': True,
'fake_run': True,
'fake_deps': True
}
r = self_module.cmind.access(cm_input)
if r['return'] > 0:
return r
print_deps = r['new_state']['print_deps']
fake_run_str = " --fake_run" if env.get('CM_DOCKER_FAKE_DEPS') else ""
cmds = ["RUN " + dep for dep in print_deps]
for cmd in cmds:
f.write(cmd + fake_run_str + EOL)

f.write(x + EOL)

# fake_run to install the dependent scripts and caching them
Expand Down

0 comments on commit 3771397

Please sign in to comment.