-
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
RFC: @observable_source_asset adapter to generate AssetsDefinition and SensorDefinition #16623
Conversation
python_modules/dagster/dagster/_core/definitions/sensor_definition.py
Outdated
Show resolved
Hide resolved
for dagster_event in sensor_runtime_data.dagster_events or []: | ||
instance.report_dagster_event(dagster_event, run_id="") | ||
|
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.
Similarly shouldn't hardcode "" run_id here
7d08a7d
to
7350f94
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.
I think I would add asset_event: Union["AssetMaterialization", "AssetObservation", "AssetCheckEvaluation"],
to SensorResult
and have it call instance.report_runless_asset_event()
when it made it to back to the host process instead of this general dagster_event
approach but I think the overall idea is sound.
Got it. It would be a List because we want to allow multiple events per tick |
c57f687
to
78ff1b8
Compare
7350f94
to
895b2ca
Compare
Incorporated your excellent suggestions @alangenfeld (so much cleaner) and this is ready to land. |
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.
should we mark this as experimental in some capacity?
@@ -679,6 +679,9 @@ def _evaluate_sensor( | |||
|
|||
assert isinstance(sensor_runtime_data, SensorExecutionData) | |||
|
|||
for asset_event in sensor_runtime_data.asset_events or []: |
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.
nit: do you need the or []
here given the coercion to empty list in new?
Note @alangenfeld this is stacked on #16617 #16620 #16621 |
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.
I'm going to spin up a new PR with sensor changes only
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.
02b6c10
to
9bb377c
Compare
feedabck Extract out observe_fn_to_op_compute_fn to it can be reused in other contexts cp feedback experimental cp
91cd31f
to
dccfc42
Compare
Decided to respin in new PR for clean discussion #16712 |
Summary & Motivation
This PR demonstrates how we could write an adapter to achieve backwards compatibility with existing
observable_source_asset
declarations.In a test case we have the following code:
If we so chose, we could push down calling those functions against the source asset to within the Definitions
__init__
method machinery to make this completely automatic. Whether or not that is a good idea is a different discussion.How I Tested These Changes
BK