Skip to content

Commit

Permalink
can_force_cache option added for get-ml-model-resnet50
Browse files Browse the repository at this point in the history
  • Loading branch information
arjunsuresh committed Jun 12, 2023
1 parent deae8d8 commit 3f9a9bc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cm-mlops/automation/script/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ def run(self, i):
(the developers have to support it in pre/post processing and scripts)
(skip_cache) (bool): if True, skip caching and run in current directory
(force_cache) (bool): if True, force caching if can_force_cache=true in script meta
(skip_remembered_selections) (bool): if True, skip remembered selections
(uses or sets env.CM_TMP_SKIP_REMEMBERED_SELECTIONS to "yes")
Expand Down Expand Up @@ -263,6 +264,7 @@ def run(self, i):
extra_recursion_spaces = ' '# if verbose else ''

skip_cache = i.get('skip_cache', False)
force_cache = i.get('force_cache', False)
fake_run = i.get('fake_run', False)
fake_deps = i.get('fake_deps', False)
run_state = i.get('run_state', self.run_state)
Expand Down Expand Up @@ -510,7 +512,7 @@ def run(self, i):
# Found 1 or more scripts. Scans cache tags to find at least 1 with cache==True
preload_cached_scripts = False
for script in list_of_found_scripts:
if script.meta.get('cache', False):
if script.meta.get('cache', False) == True or (script.meta.get('can_force_cache', False) and force_cache):
preload_cached_scripts = True
break

Expand Down Expand Up @@ -922,6 +924,7 @@ def run(self, i):
# Check if the output of a selected script should be cached
cache = False if i.get('skip_cache', False) else meta.get('cache', False)
cache = False if i.get('fake_run', False) else cache
cache = cache or (i.get('force_cache', False) and meta.get('can_force_cache', False))

cached_uid = ''
cached_tags = []
Expand Down
1 change: 1 addition & 0 deletions cm-mlops/script/download-and-extract/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"automation_alias": "script",
"automation_uid": "5b4e0237da074764",
"cache": false,
"can_force_cache": true,
"deps": [
],
"input_description": {},
Expand Down
2 changes: 2 additions & 0 deletions cm-mlops/script/get-ml-model-resnet50/_cm.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"env": {
"CM_EXTRACT_EXTRACTED_FILENAME": "<<<CM_ML_MODEL_FILE>>>"
},
"force_cache": true,
"extra_cache_tags": "ml-model,resnet50,raw,ml-model-resnet50",
"update_tags_from_env_with_prefix": {
"_url.": [ "CM_PACKAGE_URL" ]
}
Expand Down

0 comments on commit 3f9a9bc

Please sign in to comment.