Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions workflow/rocoto/rocoto.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand Down Expand Up @@ -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 dependency is not None and len(dependency) > 0:
strings.append('\t<dependency>\n')
for d in dependency:
strings.append(f'\t\t{d}\n')
strings.append('\t</dependency>\n')
strings.append('\n')
elif taskname != "gfswaveinit":
print("WARNING: No dependencies for task " + taskname)

strings.append('</task>\n')

Expand Down Expand Up @@ -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
Expand All @@ -309,19 +311,19 @@ 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}')
else:
for e in _traverse(d):
strings.append(f'\t{e}')

if dep_condition is not None:
strings.append(f'</{dep_condition}>')
if dep_condition is not None:
strings.append(f'</{dep_condition}>')

return strings

Expand Down
5 changes: 5 additions & 0 deletions workflow/rocoto/workflow_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down