Skip to content

Paring of shared and sos_variable #1175

@BoPeng

Description

@BoPeng

The following workflow works

[1: shared = 'data']
data = [1, 2]

[2]
input: for_each = dict(par=data)
print(par)

because shared expose variables to the context of the steps that depends on step 1 in a forward workflow. In contrast, the following workflow

[data: shared = 'data']
data = [1, 2]

[default]
input: for_each = dict(par=data)
print(par)

will not work because default does not depend on data.

Now the tricky part is that

[1: shared = 'data']
data = [1, 2]

[2]
input: '1.txt', for_each = dict(par=data)
print(par)

will also not work because 2 does not depend on 1 on the surface so data is not available when 2 is executed.

To make things clear, I propose that we require, at least document explicit use of sos_variable() for any share. That is to say, we not only use sos_variable to fix the above example,

[1: shared = 'data']
data = [1, 2]

[2]
depends: sos_variable('data')
input: '1.txt', for_each = dict(par=data)
print(par)

but also document the use of sos_variable in the working example:

[1: shared = 'data']
data = [1, 2]

[2]
depends: sos_variable('data')
input: for_each = dict(par=data)
print(par)

In this way at least we do not have to explain why data sometimes exists and sometimes does not exist in examples of this ticket.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions