Skip to content

Commit

Permalink
Fix the how the pre-analysis hook loads OED files (#1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
sambles authored Apr 8, 2024
1 parent 0c8ff94 commit 338b85a
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/model_execution_worker/distributed_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,16 +511,25 @@ def pre_analysis_hook(self,
pre_hook_output = OasisManager().exposure_pre_analysis(**params)
files_modified = pre_hook_output.get('modified', {})

pre_loc_fp = os.path.join(hook_target_dir, files_modified.get('location'))
pre_acc_fp = os.path.join(hook_target_dir, files_modified.get('account'))
pre_info_fp = os.path.join(hook_target_dir, files_modified.get('ri_info'))
pre_scope_fp = os.path.join(hook_target_dir, files_modified.get('ri_scope'))

# store updated files
pre_loc_fp = os.path.join(hook_target_dir, files_modified.get('location'))
params['pre_loc_file'] = filestore.put(pre_loc_fp, subdir=params['storage_subdir'])
params['pre_acc_file'] = filestore.put(pre_acc_fp, subdir=params['storage_subdir'])
params['pre_info_file'] = filestore.put(pre_info_fp, subdir=params['storage_subdir'])
params['pre_scope_file'] = filestore.put(pre_scope_fp, subdir=params['storage_subdir'])

if files_modified.get('account'):
pre_acc_fp = os.path.join(hook_target_dir, files_modified.get('account'))
params['pre_acc_file'] = filestore.put(pre_acc_fp, subdir=params['storage_subdir'])

if files_modified.get('ri_info'):
pre_info_fp = os.path.join(hook_target_dir, files_modified.get('ri_info'))
params['pre_info_file'] = filestore.put(pre_info_fp, subdir=params['storage_subdir'])

if files_modified.get('ri_scope'):
pre_scope_fp = os.path.join(hook_target_dir, files_modified.get('ri_scope'))
params['pre_scope_file'] = filestore.put(pre_scope_fp, subdir=params['storage_subdir'])

# OED has been loaded and check in this step, disable check in file gen
# This is in case pre-exposure func has added non-standard cols to the file.
params['check_oed'] = False

# remove any pre-loaded files (only affects this worker)
oed_files = {v for k, v in params.items() if k.startswith('oed_') and isinstance(v, str)}
Expand Down

0 comments on commit 338b85a

Please sign in to comment.