DagsterInvalidDefinitionError: "context" is not a valid name in Dagster. It conflicts with a Dagster or python reserved keyword #22576
-
In dagster (my current version is 1.7.10) I am getting this error when I define an asset that has both an input from another asset and wants to use the asset execution context:
This is the code: from dagster import asset, AssetIn, AssetExecutionContext, Definitions
@asset
def parent_asset(context: AssetExecutionContext) -> None:
return 'hi there!'
@asset(ins={'parent_asset': AssetIn('parent_asset')})
def my_asset(
parent_asset: str,
context: AssetExecutionContext,
) -> None:
print(parent_asset + ' whatever')
Definitions(assets=[parent_asset, my_asset]) Note that: if I remove the The full stack trace:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @valerio-bud - this appears to be due to the order of the arguments. I confirmed that moving the
|
Beta Was this translation helpful? Give feedback.
Hi @valerio-bud - this appears to be due to the order of the arguments. I confirmed that moving the
context
argument before theparent_asset
argument inmy_asset
resolves the issue.