@@ -574,9 +574,7 @@ def _run(self, i):
574574
575575 cache_list = r ['cache_list' ]
576576
577- # print(list_of_found_scripts)
578577 meta = script_item .meta
579- # print(meta)
580578 path = script_item .path
581579
582580 # Check min MLC version requirement
@@ -711,7 +709,7 @@ def _run(self, i):
711709 # const)
712710
713711 variations = script_item .meta .get ('variations' , {})
714- state ['docker' ] = meta .get ('docker' , {})
712+ run_state ['docker' ] = meta .get ('docker' , {})
715713
716714 r = self ._update_state_from_variations (
717715 i ,
@@ -829,8 +827,8 @@ def _run(self, i):
829827 return r
830828
831829 if is_true (env .get ('MLC_RUN_STATE_DOCKER' , False )):
832- if state .get ('docker' ):
833- if is_false (state ['docker' ].get ('run' , True )):
830+ if run_state .get ('docker' ):
831+ if is_false (run_state ['docker' ].get ('run' , True )):
834832 logger .info (
835833 self .recursion_spaces +
836834 ' - Skipping script::{} run as we are inside docker' .format (found_script_item ))
@@ -853,7 +851,7 @@ def _run(self, i):
853851 'deps' : []}
854852 return rr
855853
856- elif is_false (state ['docker' ].get ('real_run' , True )):
854+ elif is_false (run_state ['docker' ].get ('real_run' , True )):
857855 logger .info (
858856 self .recursion_spaces +
859857 ' - Doing fake run for script::{} as we are inside docker' .format (found_script_item ))
@@ -946,10 +944,10 @@ def _run(self, i):
946944 #######################################################################
947945 # Check if the output of a selected script should be cached
948946 if cache :
949- # TBD - need to reuse and prune cache_list instead of a new CM
950- # search inside find_cached_script
951-
947+ # Checking if any of the found entry in cache_list has
948+ # matching_tags and is a valid cache_entry
952949 r = find_cached_script ({'self' : self ,
950+ 'cache_list' : cache_list ,
953951 'extra_recursion_spaces' : extra_recursion_spaces ,
954952 'add_deps_recursive' : add_deps_recursive ,
955953 'script_tags' : script_tags ,
@@ -1768,7 +1766,7 @@ def _run(self, i):
17681766 return {
17691767 'return' : 1 , 'error' : 'MLC artifact format is wrong "{}" - no comma found' .format (found_script_item )}
17701768
1771- cached_meta ['associated_script_item_uid' ] = found_script_item [x + 1 :]
1769+ cached_meta ['associated_script_item_uid' ] = found_script_item [x + 1 :]. strip ()
17721770
17731771 # Check if the cached entry is dependent on any path
17741772 if dependent_cached_path != '' :
@@ -4425,52 +4423,6 @@ def relaxed_subset(v, variation_tags):
44254423 return True
44264424
44274425
4428- ##############################################################################
4429-
4430- def find_cached_script (i ):
4431- """
4432- Internal automation function: find cached script
4433-
4434- Args:
4435- (MLC input dict):
4436-
4437- deps (dict): deps dict
4438- update_deps (dict): key matches "names" in deps
4439-
4440- Returns:
4441- (MLC return dict):
4442- * return (int): return code == 0 if no error and >0 if error
4443- * (error) (str): error string if return>0
4444- """
4445- # 1. Prepare cache tags
4446- # 2. If new_cache_entry, return empty
4447- # 3. Search cache
4448- # 4. Apply remembered cache selection
4449- # 5. Validate cached scripts
4450-
4451- i ['logger' ].debug (
4452- i ['recursion_spaces' ] +
4453- ' - Checking if script execution is already cached ...' )
4454-
4455- cached_tags , explicit_cached_tags = prepare_cache_tags (i )
4456-
4457- if i ['new_cache_entry' ]:
4458- i ['logger' ].debug (
4459- i ['recursion_spaces' ] +
4460- f' - New cache entry requested, skipping cache search.'
4461- )
4462- return {'return' : 0 , 'cached_tags' : cached_tags ,
4463- 'search_tags' : '' , 'found_cached_scripts' : []}
4464-
4465- search_tags , found_cached_scripts = search_cache (i , explicit_cached_tags )
4466- found_cached_scripts = apply_remembered_cache_selection (
4467- i , search_tags , found_cached_scripts )
4468- found_cached_scripts = validate_cached_scripts (i , found_cached_scripts )
4469-
4470- return {'return' : 0 , 'cached_tags' : cached_tags ,
4471- 'search_tags' : search_tags , 'found_cached_scripts' : found_cached_scripts }
4472-
4473-
44744426##############################################################################
44754427def enable_or_skip_script (meta , env ):
44764428 """
@@ -5457,9 +5409,9 @@ def update_state_from_meta(meta, env, state, const, const_state, run_state, i):
54575409 utils .merge_dicts ({'dict1' : const_state , 'dict2' : c_meta .get (
54585410 'const_state' , {}), 'append_lists' : True , 'append_unique' : True })
54595411 if c_meta .get ('docker' , {}):
5460- if not state .get ('docker' , {}):
5461- state ['docker' ] = {}
5462- utils .merge_dicts ({'dict1' : state ['docker' ],
5412+ if not run_state .get ('docker' , {}):
5413+ run_state ['docker' ] = {}
5414+ utils .merge_dicts ({'dict1' : run_state ['docker' ],
54635415 'dict2' : c_meta ['docker' ],
54645416 'append_lists' : True ,
54655417 'append_unique' : True })
0 commit comments