diff --git a/python_modules/dagster/dagster/_core/definitions/op_invocation.py b/python_modules/dagster/dagster/_core/definitions/op_invocation.py index e78c36cae9391..640cbe9439c5a 100644 --- a/python_modules/dagster/dagster/_core/definitions/op_invocation.py +++ b/python_modules/dagster/dagster/_core/definitions/op_invocation.py @@ -18,6 +18,7 @@ DagsterInvariantViolationError, DagsterTypeCheckDidNotPass, ) +from dagster._core.execution.context.invocation import UnboundAssetExecutionContext from .events import ( AssetMaterialization, @@ -147,7 +148,9 @@ def direct_invocation_result( " no context was provided when invoking." ) if len(args) > 0: - if args[0] is not None and not isinstance(args[0], UnboundOpExecutionContext): + if args[0] is not None and not isinstance( + args[0], (UnboundOpExecutionContext, UnboundAssetExecutionContext) + ): raise DagsterInvalidInvocationError( f"Decorated function '{compute_fn.name}' has context argument, " "but no context was provided when invoking." diff --git a/python_modules/dagster/dagster/_core/execution/context/invocation.py b/python_modules/dagster/dagster/_core/execution/context/invocation.py index c1d656a3d03d0..d9b0c88334db3 100644 --- a/python_modules/dagster/dagster/_core/execution/context/invocation.py +++ b/python_modules/dagster/dagster/_core/execution/context/invocation.py @@ -811,10 +811,6 @@ def __init__( _assets_def=assets_def, ) - self._step_execution_context = ( - self._op_execution_context._step_execution_context # noqa: SLF001 - ) - self._cm_scope_entered = False def __enter__(self):