-
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
Add require_typed_event_stream to compute contexts #16706
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,7 @@ | |
NodeHandle, | ||
Output, | ||
) | ||
from dagster._core.definitions.asset_check_spec import AssetCheckHandle | ||
from dagster._core.definitions.asset_layer import AssetLayer | ||
from dagster._core.definitions.op_definition import OpComputeFunction | ||
from dagster._core.definitions.result import MaterializeResult | ||
|
@@ -204,13 +205,50 @@ def execute_core_compute( | |
yield step_output | ||
if isinstance(step_output, (DynamicOutput, Output)): | ||
emitted_result_names.add(step_output.output_name) | ||
elif isinstance(step_output, MaterializeResult): | ||
asset_key = ( | ||
step_output.asset_key | ||
or step_context.job_def.asset_layer.asset_key_for_node(step_context.node_handle) | ||
) | ||
emitted_result_names.add( | ||
step_context.job_def.asset_layer.node_output_handle_for_asset(asset_key).output_name | ||
) | ||
# Check results embedded in MaterializeResult are counted | ||
for check_result in step_output.check_results or []: | ||
handle = check_result.to_asset_check_evaluation(step_context).asset_check_handle | ||
output_name = step_context.job_def.asset_layer.get_output_name_for_asset_check( | ||
handle | ||
) | ||
emitted_result_names.add(output_name) | ||
elif isinstance(step_output, AssetCheckEvaluation): | ||
output_name = step_context.job_def.asset_layer.get_output_name_for_asset_check( | ||
step_output.asset_check_handle | ||
) | ||
emitted_result_names.add(output_name) | ||
elif isinstance(step_output, AssetCheckResult): | ||
if step_output.asset_key and step_output.check_name: | ||
handle = AssetCheckHandle(step_output.asset_key, step_output.check_name) | ||
else: | ||
handle = step_output.to_asset_check_evaluation(step_context).asset_check_handle | ||
output_name = step_context.job_def.asset_layer.get_output_name_for_asset_check(handle) | ||
emitted_result_names.add(output_name) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be very nice to have a universal function you can call to get output name from result object somewhere, not sure how to cover all cases or where to put it at this time. |
||
|
||
expected_op_output_names = { | ||
output.name for output in step.step_outputs if not output.properties.asset_check_handle | ||
output.name | ||
for output in step.step_outputs | ||
# checks are required if we're in requires_typed_event_stream mode | ||
if step_context.requires_typed_event_stream or output.properties.asset_check_handle | ||
} | ||
omitted_outputs = expected_op_output_names.difference(emitted_result_names) | ||
if omitted_outputs: | ||
step_context.log.info( | ||
f"{step_context.op_def.node_type_str} '{step.node_handle}' did not fire " | ||
f"outputs {omitted_outputs!r}" | ||
message = ( | ||
f"{step_context.op_def.node_type_str} '{step.node_handle}' did not yield or return " | ||
f"expected outputs {omitted_outputs!r}." | ||
) | ||
|
||
if step_context.requires_typed_event_stream: | ||
if step_context.typed_event_stream_error_message: | ||
message += " " + step_context.typed_event_stream_error_message | ||
raise DagsterInvariantViolationError(message) | ||
else: | ||
step_context.log.info(message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
theres custom logic to bypass check handle outputs on 232 to avoid printing the warning message. I think that means currently asset checks would bypass would not trigger this
has_require_typed_event_stream
check? Needs testThere 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.
good catch, they were indeed not being caught, fixed and tests added