Skip to content

Commit

Permalink
Check convenience methods (#16632)
Browse files Browse the repository at this point in the history
Convenience methods for asset check event data
## How I Tested These Changes
  • Loading branch information
dpeng817 authored Sep 22, 2023
1 parent 0af445d commit b824aa3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def __new__(cls, asset_key: AssetKey, check_name: str):
check_name=check.str_param(check_name, "check_name"),
)

@property
def asset_check_handle(self) -> AssetCheckHandle:
return AssetCheckHandle(self.asset_key, self.check_name)


@whitelist_for_serdes
class AssetCheckEvaluationTargetMaterializationData(
Expand Down
16 changes: 16 additions & 0 deletions python_modules/dagster/dagster/_core/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,15 @@ def asset_materialization_planned_data(self) -> "AssetMaterializationPlannedData
)
return cast(AssetMaterializationPlannedData, self.event_specific_data)

@property
def asset_check_planned_data(self) -> "AssetCheckEvaluationPlanned":
_assert_type(
"asset_check_planned",
DagsterEventType.ASSET_CHECK_EVALUATION_PLANNED,
self.event_type,
)
return cast(AssetCheckEvaluationPlanned, self.event_specific_data)

@property
def step_expectation_result_data(self) -> "StepExpectationResultData":
_assert_type(
Expand All @@ -757,6 +766,13 @@ def materialization(self) -> AssetMaterialization:
)
return cast(StepMaterializationData, self.event_specific_data).materialization

@property
def asset_check_evaluation_data(self) -> AssetCheckEvaluation:
_assert_type(
"asset_check_evaluation", DagsterEventType.ASSET_CHECK_EVALUATION, self.event_type
)
return cast(AssetCheckEvaluation, self.event_specific_data)

@property
def job_failure_data(self) -> "JobFailureData":
_assert_type("job_failure_data", DagsterEventType.RUN_FAILURE, self.event_type)
Expand Down

0 comments on commit b824aa3

Please sign in to comment.