-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provide AssetExecutionContext class to context #16493
provide AssetExecutionContext class to context #16493
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
45752b9
to
1be35f3
Compare
python_modules/dagster/dagster_tests/core_tests/execution_tests/test_context.py
Outdated
Show resolved
Hide resolved
python_modules/dagster/dagster/_core/execution/context/compute.py
Outdated
Show resolved
Hide resolved
@@ -864,6 +864,10 @@ def op_config(self) -> Any: | |||
op_config = self.resolved_run_config.ops.get(str(self.node_handle)) | |||
return op_config.config if op_config else None | |||
|
|||
@property | |||
def is_graph_asset_op(self) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in combination with is_sda_step
this will tell us if an op is in a graph backed asset.
a6e9235
to
4694660
Compare
e8fa9da
to
28e28f8
Compare
28e28f8
to
12894b6
Compare
12894b6
to
ec70892
Compare
ec70892
to
a09fa99
Compare
a09fa99
to
bcf4e6e
Compare
Edge case to consider: @op(config_schema={"foo": int})
def one(context):
assert context.op_config["foo"] == 1
asset_one = AssetsDefinition.from_op(one) the op gets an |
5e7ed31
to
dfd922e
Compare
ad9cab2
to
7231b2f
Compare
07101b5
to
d14f690
Compare
7231b2f
to
e688144
Compare
d14f690
to
ecb5178
Compare
e688144
to
27152b9
Compare
ecb5178
to
9937b2f
Compare
27152b9
to
d01d5d2
Compare
a9785f3
to
583cb1e
Compare
context_param = compute_fn.get_context_arg() | ||
context_annotation = context_param.annotation | ||
|
||
# TODO - i dont know how to move this check to Definition time since we don't know if the op is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO - i'd like to move this check to one we can catch at definition time, but i'm not sure if we can since with just this
@op
def my_op(context: AssetExecutionContext)
we don't know if the op will be used in a graph backed asset (meaning this annotation is fine) or in an op job (meaning this annotation is not fine)
583cb1e
to
0885642
Compare
2e71fd1
to
49b0a60
Compare
84d7ea6
to
a76c119
Compare
1448509
to
5ba005b
Compare
a76c119
to
d2c1d93
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the change discussed in the summary got landed in another PR right?
closed in favor of #16759 |
Summary & Motivation
Introduces the logic to determine which kind of context to provide to which kind of step.
Follows these rules:
The ops that make up graph backed assets is where is gets funky. This is what would happen in the current implementation:
The reasoning behind
@graph_asset @op + no type annotation -> OpExecutionContext
is best explained with an example:Imagine you have an op that is used in both a job and a graph-backed asset
When executing
my_fun_job
,my_fun_op
will receive anOpExecutionContext
and run as expected. When materializingmy_fun_asset
,my_fun_op
will receive anAssetExecutionContext
. It will fire a deprecation warning, but still calldescribe_op
on the internally heldop_execution_context
. When we deprecate the__get_attr__
behavior here,my_fun_op
will instead error.How I Tested These Changes