diff --git a/dev/workflow/rocoto/rocoto.py b/dev/workflow/rocoto/rocoto.py index c3c62c8ae91..e098f5c4e6a 100644 --- a/dev/workflow/rocoto/rocoto.py +++ b/dev/workflow/rocoto/rocoto.py @@ -164,10 +164,14 @@ def _create_innermost_task(task_dict: Dict[str, Any]) -> List[str]: strings.append(f'\t{e}\n') strings.append('\n') + # Write dependency block: flatten any nested items and strip leading tabs if dependency is not None and len(dependency) > 0: strings.append('\t\n') for d in dependency: - strings.append(f'\t\t{d}\n') + # Flatten nested lists/tuples and write each element as an XML line + for e in _traverse(d): + s = str(e).lstrip('\t') # remove accidental leading tabs from pieces + strings.append(f'\t\t{s}\n') strings.append('\t\n') strings.append('\n') @@ -429,12 +433,11 @@ def create_dependency(dep_condition=None, dep=[]) -> List[str]: if dep_condition is not None: strings.append(f'<{dep_condition}>') + # Flatten any nested lists/tuples and return plain XML strings + # Note: tabbing is handled at task creation by create_innermost_task for d in dep: - if dep_condition is None: - strings.append(f'{d}') - else: - for e in _traverse(d): - strings.append(f'\t{e}') + for e in _traverse(d): + strings.append(str(e)) if dep_condition is not None: strings.append(f'')