Skip to content

Commit

Permalink
Add missing calls to method param func, this checks and aligns any de…
Browse files Browse the repository at this point in the history
…precated param names
  • Loading branch information
sambles committed May 17, 2024
1 parent 626469d commit cfde705
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/model_execution_worker/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ def start_analysis(analysis_settings, input_location, complex_data_files=None, *
"""
# Check that the input archive exists and is valid
filestore = get_filestore(settings)
from oasislmf.manager import OasisManager

logger.info("args: {}".format(str(locals())))
logger.info(str(get_worker_versions()))
tmpdir_persist = settings.getboolean('worker', 'KEEP_RUN_DIR', fallback=False)
Expand Down Expand Up @@ -342,7 +344,10 @@ def start_analysis(analysis_settings, input_location, complex_data_files=None, *

# Create and log params
run_params = {**config, **task_params}
params = paths_to_absolute_paths(run_params, config_path)
gen_losses_params = OasisManager()._params_generate_losses(**run_params)
post_hook_params = OasisManager()._params_post_analysis(**run_params)
params = paths_to_absolute_paths({**gen_losses_params, **post_hook_params}, config_path)

if debug_worker:
log_params(params, kwargs)

Expand All @@ -353,7 +358,6 @@ def start_analysis(analysis_settings, input_location, complex_data_files=None, *

# Run generate losses
try:
from oasislmf.manager import OasisManager
OasisManager().generate_oasis_losses(**params)
returncode = 0
except Exception as e:
Expand Down Expand Up @@ -410,6 +414,8 @@ def generate_input(self,
# Start Oasis file generation
notify_api_status(analysis_pk, 'INPUTS_GENERATION_STARTED')
filestore = get_filestore(settings)
from oasislmf.manager import OasisManager

# filestore.media_root = settings.get('worker', 'MEDIA_ROOT')
tmpdir_persist = settings.getboolean('worker', 'KEEP_RUN_DIR', fallback=False)
tmpdir_base = settings.get('worker', 'BASE_RUN_DIR', fallback=None)
Expand Down Expand Up @@ -462,7 +468,11 @@ def generate_input(self,
config_path = get_oasislmf_config_path(settings)
config = get_json(config_path)
lookup_params = {**{k: v for k, v in config.items() if not k.startswith('oed_')}, **task_params}
params = paths_to_absolute_paths(lookup_params, config_path)

gen_files_params = OasisManager()._params_generate_files(**lookup_params)
pre_hook_params = OasisManager()._params_exposure_pre_analysis(**lookup_params)
params = paths_to_absolute_paths({**gen_files_params, **pre_hook_params}, config_path)

if debug_worker:
log_params(params, kwargs, exclude_keys=[
'profile_loc',
Expand All @@ -484,7 +494,6 @@ def generate_input(self,
json.dump(params, f, indent=4)

try:
from oasislmf.manager import OasisManager
OasisManager().generate_oasis_files(**params)
returncode = 0
except Exception as e:
Expand Down

0 comments on commit cfde705

Please sign in to comment.