Skip to content

Support adding dependent CM script commands in CM dockerfile #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 27, 2024
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: 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
Loading