Leo Qin
08/23/2023, 10:11 PMcontext.latest_materialization_records_by_key
even though i call advance_all_cursors
and no materialization events for the monitored assets have occured.
I would have expected that latest_materialization_record_by_key
would return nothing if no materialization events have happened... or at least that is what the documentation says should be happening....
def sensor(context: MultiAssetSensorEvaluationContext):
asset_events = context.latest_materialization_records_by_key()
if all(asset_events.values()):
context.advance_all_cursors()
if sensor_fn:
sensor_fn(context)
if request_assets or jobs:
return RunRequest()
elif any(asset_events.values()):
materialized_asset_key_strs = [
key.to_user_string() for key, value in asset_events.items() if value
]
not_materialized_asset_key_strs = [
key.to_user_string() for key, value in asset_events.items() if not value
]
return SkipReason(
f"Observed materializations for {materialized_asset_key_strs}, "
f"but not for {not_materialized_asset_key_strs}"
)