Hi Dagster team! I was wondering if there's a way ...
# ask-community
Hi Dagster team! I was wondering if there's a way to use aliased Ops in a
Copy code
GraphDefinition(node_defs=[someop.alias("foo")], ...)
doesn't work, it results in the following exception
Copy code
AttributeError: 'PendingNodeInvocation' object has no attribute '__name__'
This seems to be the same as this issue from end of 2021 https://github.com/dagster-io/dagster/issues/5603 I also tried this
Copy code
GraphDefinition(node_defs=[NodeInvocation(name="wait", alias="testalias")], ...)
but this also doesn't work, it results in
Copy code
dagster._core.errors.DagsterInvalidDefinitionError: Invalid item in node list: NodeInvocation
Is there a way to make this work?
Hmm looks like you’ll need to use the decorator for now, but this bug has been there a long time so I am taking it on to fix for next week.
❤️ 1
@sean Thanks! I just did some more digging and it seems that
only contains Ops. In case of one Op that's aliased several times in one graph I only see that Op once in
when using
. So aliased Ops don't show up in there. Then I did some more prodding and it seems the aliasing is done as part of
where they are added as
as keys of the dict and then they can be referenced in other values in the dependencies dict, like so
Copy code
{NodeInvocation(name="op_name", alias="fooalias"): {}, "bar": {"after": DependencyDefinition("fooalias")}
I didn't expect that the aliasing would need to be done as part of the
config, that's a bit surprising to me. In any case, given how this currently works I'm not sure the bug is correct, although it might be useful to come up with a better/clearer way to do this. Alternatively if the current way is fine it would be good to mention this in the
Moved/copied the above comment here https://github.com/dagster-io/dagster/issues/5603#issuecomment-1490783354 so that's it's tracked/visible for others, figured that'd be better than keeping this in Slack.
🙏 1