-
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
[prototype] return AssetMaterialization #14931
[prototype] return AssetMaterialization #14931
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
9f29736
to
556c934
Compare
# supporting AssetMaterialization without asset_key requires handling it being in a partial state. | ||
# could do AssetMaterialization.partial(...) with special partial state obj | ||
asset_key=context.asset_key_for_output(), |
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.
idea: allow omitting in constructor args but avoid nullability on the object itself by grabbing the current asset_key
indirectly (and erroring when can not)
edit :this has since been implemented and in the PR
556c934
to
51870da
Compare
Have you considered a new |
Ya thats the other option, in previous discussions no one was hot on the idea of adding a new noun. Whats your take? |
My initial lean would be towards It's also a breaking change, right? For anyone depending on the asset key attribute to be non-None. And it means that anyone using type-checking needs to guard against None whenever they access |
Agree, and that is not the case in the current updated state of this prototype PR. We allow omitting from the constructor in cases we can infer it and error otherwise [2]. |
elif asset_key is None: | ||
current_ctx = get_execution_context() | ||
if current_ctx is None: | ||
raise DagsterInvariantViolationError( | ||
"Could not infer asset_key, not currently in the context of an execution." | ||
) | ||
keys = current_ctx.selected_asset_keys | ||
if len(keys) != 1: | ||
raise DagsterInvariantViolationError( | ||
f"Could not infer asset_key, there are {len(keys)} in the current execution" | ||
" context. Specify the appropriate asset_key." | ||
) | ||
asset_key = next(iter(keys)) |
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.
[2]
How do you feel about [2] and with that does that change your stance on |
Ah, I missed this. I'm having trouble putting my finger on any concrete negatives, but this kind of pattern gives me some generalized discomfort – I think it's difficult for users to look at the code and guess how it's working. |
Makes sense, this is definitely a "may be lesser of two evils" type of proposal. Probably need to flesh this prototype out to include |
37be28c
to
8b69394
Compare
51870da
to
da70d2a
Compare
@@ -165,6 +171,15 @@ def _step_output_error_checked_user_event_sequence( | |||
f'Emitting implicit Nothing for output "{step_output_def.name}" on {op_label}' | |||
) | |||
yield Output(output_name=step_output_def.name, value=None) | |||
|
|||
if step_context.is_sda_step and step_context.get_observed_user_asset_mat( |
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.
Not sure if this has any consequence with the way that execution currently works, but imagine a world where we could kick off downstream steps as soon as an upstream output is produced, even if the upstream step hasn't finished yet.
In that world, we would ideally yield the Output
as soon the materialization is reported/yielded/returned, right?
8b69394
to
d0752c8
Compare
da70d2a
to
928618e
Compare
explorations for returning AssetMaterializtion directly