From b9487d3d15a7832a5a1c95f613d5f949956e77b4 Mon Sep 17 00:00:00 2001 From: David Huber Date: Wed, 12 Apr 2023 12:36:09 +0000 Subject: [PATCH 1/3] Reworked arch dependencies. #1451 --- workflow/rocoto/rocoto.py | 16 +++++++++------- workflow/rocoto/workflow_tasks.py | 5 +++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/workflow/rocoto/rocoto.py b/workflow/rocoto/rocoto.py index f17caccae2c..ba7347a7ee9 100644 --- a/workflow/rocoto/rocoto.py +++ b/workflow/rocoto/rocoto.py @@ -109,12 +109,14 @@ def create_task(task_dict: Dict[str, Any]) -> List[str]: strings.append(f'\t{e}\n') strings.append('\n') - if dependency is not None: + if len(dependency) > 0: strings.append('\t\n') for d in dependency: strings.append(f'\t\t{d}\n') strings.append('\t\n') strings.append('\n') + else: + print("WARNING: No dependencies for task " + taskname) strings.append('\n') @@ -293,7 +295,7 @@ def _traverse(o, tree_types=(list, tuple)): yield o -def create_dependency(dep_condition=None, dep=None) -> List[str]: +def create_dependency(dep_condition=None, dep=[]) -> List[str]: """ create a compound dependency given a list of dependencies, and compounding condition the list of dependencies are created using add_dependency @@ -309,10 +311,10 @@ def create_dependency(dep_condition=None, dep=None) -> List[str]: strings = [] - if dep_condition is not None: - strings.append(f'<{dep_condition}>') + if len(dep) > 0: + if dep_condition is not None: + strings.append(f'<{dep_condition}>') - if dep[0] is not None: for d in dep: if dep_condition is None: strings.append(f'{d}') @@ -320,8 +322,8 @@ def create_dependency(dep_condition=None, dep=None) -> List[str]: for e in _traverse(d): strings.append(f'\t{e}') - if dep_condition is not None: - strings.append(f'') + if dep_condition is not None: + strings.append(f'') return strings diff --git a/workflow/rocoto/workflow_tasks.py b/workflow/rocoto/workflow_tasks.py index 9572140b0ca..dfef279e2ab 100644 --- a/workflow/rocoto/workflow_tasks.py +++ b/workflow/rocoto/workflow_tasks.py @@ -1035,6 +1035,11 @@ def arch(self): if self.app_config.mode in ['forecast-only']: # TODO: fix ocnpost to run in cycled mode dep_dict = {'type': 'metatask', 'name': f'{self.cdump}ocnpost'} deps.append(rocoto.add_dependency(dep_dict)) + # If all verification and ocean/wave coupling is off, add the gdas/gfs post metatask as a dependency + if len(deps) == 0: + dep_dict = {'type': 'metatask', 'name': f'{self.cdump}post'} + deps.append(rocoto.add_dependency(dep_dict)) + dependencies = rocoto.create_dependency(dep_condition='and', dep=deps) cycledef = 'gdas_half,gdas' if self.cdump in ['gdas'] else self.cdump From b6d3851a2c1b7caf07143f94fe0a4b4b539ae44f Mon Sep 17 00:00:00 2001 From: David Huber Date: Wed, 12 Apr 2023 18:35:31 +0000 Subject: [PATCH 2/3] Add check for None dependency. #1451 --- workflow/rocoto/rocoto.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflow/rocoto/rocoto.py b/workflow/rocoto/rocoto.py index ba7347a7ee9..01847cca3cb 100644 --- a/workflow/rocoto/rocoto.py +++ b/workflow/rocoto/rocoto.py @@ -78,7 +78,7 @@ def create_task(task_dict: Dict[str, Any]) -> List[str]: threads = resources_dict.get('threads', 1) log = task_dict.get('log', 'demo.log') envar = task_dict.get('envars', None) - dependency = task_dict.get('dependency', None) + dependency = task_dict.get('dependency', []) str_maxtries = str(maxtries) str_final = ' final="true"' if final else '' @@ -109,13 +109,13 @@ def create_task(task_dict: Dict[str, Any]) -> List[str]: strings.append(f'\t{e}\n') strings.append('\n') - if len(dependency) > 0: + if dependency is not None and len(dependency) > 0: strings.append('\t\n') for d in dependency: strings.append(f'\t\t{d}\n') strings.append('\t\n') strings.append('\n') - else: + elif(taskname != "gfswaveinit"): print("WARNING: No dependencies for task " + taskname) strings.append('\n') From 9abeee7e523ba99ed9c3729ec8f987a99f96ad86 Mon Sep 17 00:00:00 2001 From: David Huber Date: Wed, 12 Apr 2023 18:39:48 +0000 Subject: [PATCH 3/3] Added whitespace. #1451 --- workflow/rocoto/rocoto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/rocoto/rocoto.py b/workflow/rocoto/rocoto.py index 01847cca3cb..11699016639 100644 --- a/workflow/rocoto/rocoto.py +++ b/workflow/rocoto/rocoto.py @@ -115,7 +115,7 @@ def create_task(task_dict: Dict[str, Any]) -> List[str]: strings.append(f'\t\t{d}\n') strings.append('\t\n') strings.append('\n') - elif(taskname != "gfswaveinit"): + elif taskname != "gfswaveinit": print("WARNING: No dependencies for task " + taskname) strings.append('\n')