Skip to content

Provide mechanism for splits internal to a workflow to remain expanded #780

Open
@effigies

Description

@effigies

[...] if i remember somewhat i believe that nested splits (i.e. any level of splits set inside a workflow), need to be combined before one steps out of a workflow. i cannot remember now how a workflow (as a cacheable task object) deals with splits inside it (whether inner/outer), and especially if the workflow also has splits set on it's inputs. there were certain circumstances under which an output state could not be easily generated/tracked, and we forced that combines needed to happen. i think it was this nested condition.

Originally posted by @satra in #773 (comment)

If this is correct, this seems like a surprising regression over nipype 1. It's rare, but I have found uses for creating a workflow that initiates an iterable that is never joined. It allows, for example, creating iterables over templates, and then hooking up non-iterable workflows as if you are targeting a single template.

I can't immediately think of a use case where you want to expand state inside one subworkflow and then combine within an outer workflow (or a sibling subworkflow). At least the use case above would be served just fine with state variables that become inaccessible to combiners at the end of a workflow, although that does leave a potential footgun for users who do eventually want to combine over those variables.

If we want to permit this use case and make sure that any expanded state is potentially collapsible, then we probably need a way for a workflow node to "take over" the name of an variable expanded by an internal node. Given that our naming approach is <task>.<input_var>, I'm a bit surprised that <wf>.<task>.<input_var> wouldn't be sufficient, but you could imagine something like:

@workflow.define
def iterator_wf(...):
    ...

    wf.rename_split('template_splitter.template_id', 'template_id')
    # Or possibly typical enough to want a name:
    wf.claim_split('template_splitter.template_id')

Metadata

Metadata

Assignees

No one assigned

    Labels

    to considersuggesting changes that require more discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions