Is there anything special I need to do to get a dy...
# ask-community
c
Is there anything special I need to do to get a dynamic op called inside of a multi-asset to have access to it's context? Right now I'm trying to call the dynamic op
observations
but get an error of
dagster._core.errors.DagsterInvalidInvocationError: Compute function of op 'observations' has context argument, but no context was provided when invoking.
(both versions of this error, if i don't provide the context from the multi-asset to the op it's line 169, if I do it's line 177 of
dagster\_core\definitions\solid_definition.py
) Other assets and ops I have turned into assets in a graph handle context injection on their own so I do know that it should be handled behind the scenes.
I found an open issues of https://github.com/dagster-io/dagster/issues/9316, after doing more searching through older messages, i'm going to assume that's what's happening here since it's still open and matches what i'm trying to do.
o
Hi again! Generally we don't support calling ops inside of assets -- instead, you can create an asset from an existing op using
AssetsDefinition.from_op(...)
. However, dynamic ops also won't really work with this, instead I'd recommend placing the dynamic op inside of a graph and then calling
AssetsDefinition.from_graph
. The return value of the graph also shouldn't be dynamic -- basically all the dynamic outputs need to be `collect`ed before they can be turned into an asset.
c
That's exactly what I ended up doing, moving away from
multi-asset
s and
asset
decorators and into a
graph
with
AssetsDefinition.from_graph
and it works perfectly fine, op calling context and all. So if anyone else runs into this issue here's the solution for now 😛
🌈 1
🙏 1