From 7fd3607aee75cb4cbb536f7c6e7468e54c0889ce Mon Sep 17 00:00:00 2001 From: JamieDeMaria Date: Fri, 22 Sep 2023 13:26:26 -0400 Subject: [PATCH] casting --- .../dagster/_core/definitions/op_invocation.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python_modules/dagster/dagster/_core/definitions/op_invocation.py b/python_modules/dagster/dagster/_core/definitions/op_invocation.py index 833152f0dc32e..eff8abe5c0e86 100644 --- a/python_modules/dagster/dagster/_core/definitions/op_invocation.py +++ b/python_modules/dagster/dagster/_core/definitions/op_invocation.py @@ -156,8 +156,8 @@ def direct_invocation_result( f"Decorated function '{compute_fn.name}' has context argument, " "but no context was provided when invoking." ) - context = args[0] - # context = cast(UnboundExecutionContext, args[0]) + # context = args[0] + context = cast(UnboundExecutionContext, args[0]) # update args to omit context args = args[1:] else: # context argument is provided under kwargs @@ -168,16 +168,16 @@ def direct_invocation_result( f"'{context_param_name}', but no value for '{context_param_name}' was " f"found when invoking. Provided kwargs: {kwargs}" ) - context = kwargs[context_param_name] - # context = cast(UnboundExecutionContext, kwargs[context_param_name]) + # context: UnboundExecutionContext = kwargs[context_param_name] + context = cast(UnboundExecutionContext, kwargs[context_param_name]) # update kwargs to remove context kwargs = { kwarg: val for kwarg, val in kwargs.items() if not kwarg == context_param_name } # allow passing context, even if the function doesn't have an arg for it elif len(args) > 0 and isinstance(args[0], UnboundExecutionContext): - context = args[0] - # context = cast(UnboundExecutionContext, args[0]) + # context = args[0] + context = cast(UnboundExecutionContext, args[0]) args = args[1:] resource_arg_mapping = {arg.name: arg.name for arg in compute_fn.get_resource_args()}