Skip to content

Commit

Permalink
[develop] Bugfix task finding. (#745)
Browse files Browse the repository at this point in the history
There seems to be a bug in dict_find. I am not sure how it worked so far.
* When a task is found but is deeper in the dictionary it returns False
* In some cases it returns None instead of False
* Logic for task_make_lbcs is wrong
  • Loading branch information
danielabdi-noaa authored May 1, 2023
1 parent 2035c46 commit 55337a7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ush/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,17 +1276,19 @@ def get_location(xcs, fmt, expt_cfg):
def dict_find(user_dict, substring):

if not isinstance(user_dict, dict):
return
return False

for key, value in user_dict.items():
if substring in key:
return True
if isinstance(value, dict):
dict_find(value, substring)
if dict_find(value, substring):
return True

return False

run_make_ics = dict_find(rocoto_tasks, "task_make_ics")
run_make_lbcs = dict_find(rocoto_tasks, "task_make_ics")
run_make_lbcs = dict_find(rocoto_tasks, "task_make_lbcs")
run_run_fcst = dict_find(rocoto_tasks, "task_run_fcst")
run_any_coldstart_task = run_make_ics or \
run_make_lbcs or \
Expand Down

0 comments on commit 55337a7

Please sign in to comment.