Skip to content
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

Bug - The conf.ini value MODEL_SETTINGS_FILE, can override oasislmf.json. even if set to None. #1135

Closed
sambles opened this issue Nov 12, 2024 · 0 comments · Fixed by #1136
Closed

Comments

@sambles
Copy link
Contributor

sambles commented Nov 12, 2024

Issue Description

If MODEL_SETTINGS_FILE is set to a path that doesn't exist, then the following line is set to model_settings_file = None

# model settings
model_settings_fp = settings.get('worker', 'MODEL_SETTINGS_FILE', fallback='')
model_settings_file = model_settings_fp if model_settings_fp and os.path.isfile(model_settings_fp) else None

task_params = {
'oasis_files_dir': oasis_files_dir,
'model_run_dir': run_dir,
'analysis_settings_json': analysis_settings_file,
'model_settings_json': model_settings_file,

That value is then stored in a dict, which is later combined with the oasislmf.json contents.

# Create and log params
run_params = {**config, **task_params}
gen_losses_params = OasisManager()._params_generate_oasis_losses(**run_params)

Which can override a valid model_settings_json path with None:

In [1]: oasislmf_config = {'model_settings_json': "some-valid-path"}
In [2]: task_params = {'model_settings_json': None}
In [3]: run_params = {**oasislmf_config, **task_params}
In [4]: run_params
Out[4]: {'model_settings_json': None}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant