-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Summary of new features for named input/output. #1115
Comments
Random thoughts on names:
|
3a4c41f has the first test case that fails due to incompatibility. |
An example for 'persistent' variables is
which produces
because |
BoPeng
pushed a commit
that referenced
this issue
Dec 22, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Persistent grouping of
sos_targets
will be considered as equivalent to
which creates a
sos_targets
with two targets and two groups, with groups accessible with propertygroups
, which is a list ofsos_targets
with no subgroups.sos_targets
will keep its grouping information when it is passed around. That is to saystep_input
will have groups that are essentially_input
for substeps.step_output
will contain_output
from each substep as its groups.keyword arguments in input and output
Keyword arguments used to specify
sources
of targets.Named input and output can be accessed by
_input['name']
and_output['name']
.Implementation-wise,
creates
step_input
assos_targets(name=targets)
, which assignssources
oftargets
toname
.output_from(steps, **kwargs)
to get output from other stepsRefers to output from one or more steps, parameter can be a name or a number. The latter refers to a step in the same workflow (
output_from(10)
fromstep_20
is equivalent tooutput_from('step_10')
).with named input and output, the syntax can be expanded to
A special step name
-1
as inis reserved to output from previous step, which is only valid from a numerically indexed steps.
Options
group_by
,paired_with
,pattern
,group_with
, andfor_each
can be used to regroup or attach variables to the output. For example,group_by
can be used to regroup the retrievedsos_targets
,named_output('name', **kwargs)
for data flow without step namenamed_output('ref')
in the following example refers to any step withref
in named output,which has the same effect with
output_from('A')['ref']
but does not need the specification of step name.Similar to
output_from
, parametersgroup_by
,paired_with
,pattern
,group_with
,for_each
can be used to regroup or attached variables to retrieved targets.Merging of multiple
sos_targets
Multiple
sos_targets
can be specified in the input statement, either explicitly withsos_targets
, or implicitly withoutput_from
,named_output
. In this case, targets and groups from multiplesos_targets
will be merged.sos_targets
objects with different numbers of groups can be merged only if one of them has no group information or has a single group with all targets. In this case the group will be replicated for all groups before merging.For example,
will create a
sos_targets
with four targets'a.txt', 'b.txt', 'c.txt', 'd.txt'
, and two groupsThe same rule applies to
sos_targets
created byoutput_from()
oroutput_from(group_by)
. However, if a globalgroup_by
option is present, all individualgroups
will be overridden. That is to say,will regroup all targets by
1
, regardless of original grouping information fromoutput_from(10)
.set
andget
of attributes to sos targetsNew functions are added
BaseTarget.set()
,BaseTarget.get()
A dictionary are now associated with each
BaseTarget
and can be access with.set()
and.get()
function, or as an attribute of the target. The.set()
function is usually done automatically by parameterspaired_with
andgroup_with
, but can be used directly. Withit is usually easier to use
instead of
but
a.get('name', default=None)
will return a default value instead of raising anAttributeError
ifname
does not exist, which can be safer to use from time to time.Changes to parameters
paired_with
,group_with
andfor_each
In addition to variables set to the global namespace, the paired values are written to
_input
as target or group properties. That is to say, withyou can access
_sample
,_files
, andi
both directly, and asSo that
would produce:
The text was updated successfully, but these errors were encountered: