-
Notifications
You must be signed in to change notification settings - Fork 191
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
Raise when returning an unstored Data
from a WorkflowNode
#2747
Raise when returning an unstored Data
from a WorkflowNode
#2747
Conversation
super(WorkflowNode, self).validate_outgoing(target, link_type, link_label) | ||
if link_type is LinkType.RETURN and not target.is_stored: | ||
raise ValueError( | ||
'trying to return an unstored Data node from a workflow is not allowed because it will cause the ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is already good. What about something like:
"Workflow '{}' tried returning an unstored Data node. This likely means new Data is being created inside the workflow. In order to preserve data provenance, use a calcfunction
to create this data, and return its output from the workflow.".format(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question (just curious):
Why is the Node
the right place to check this? Shouldn't it be the process making sure it's returning the right things?
And one minor detail: in the PR description replace "Data node" with "unstored Data node"
My thirst through was to override the |
3e58c4d
to
599d55b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @sphuber !
super(WorkflowNode, self).validate_outgoing(target, link_type, link_label) | ||
if link_type is LinkType.RETURN and not target.is_stored: | ||
raise ValueError( | ||
'Workflow<{}> tried returning an unstored `Data` node. This likely means new `Data` is being created ' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking more of the name of the workflow (which should tell people where in the code they need to change things).
Happy to re-approve if you still want to change this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I adapted it to print the process label and also added two more tests on workchain and workfunction level, to make sure it also works through there
This will happen if one tries to return a `Data` node from within the body of a `WorkChain` or `workfunction`, which means that they probably created a new node based on its inputs or data returned by one of the processes it calls. However, this is strictly forbidden as the provenance of the new node will be lost. Given that beginning users are likely to make this mistake, instead of issuing a warning we explicitly forbid this behavior and raise in the link validation.
599d55b
to
fcddd15
Compare
Fixes #2675
This will happen if one tries to return a
Data
node from within thebody of a
WorkChain
orworkfunction
, which means that they probablycreated a new node based on its inputs or data returned by one of the
processes it calls. However, this is strictly forbidden as the
provenance of the new node will be lost. Given that beginning users are
likely to make this mistake, instead of issuing a warning we explicitly
forbid this behavior and raise in the link validation.