Jonathan Neo
07/22/2023, 6:10 PMRunFailureSensorContext
? I'd like to use some of the metadata in a Slack alert.Jonathan Neo
07/22/2023, 6:10 PMdef fail_message_block_builder(context: RunFailureSensorContext):
... # my custom message slack block builder where I would like to get my 'owner' key/value from the asset metadata
make_slack_on_run_failure_sensor(
channel="#dagster-alerts",
slack_token=slack_resource.token,
blocks_fn=fail_message_block_builder
)
claire
07/24/2023, 4:36 PMJonathan Neo
07/24/2023, 5:14 PMJonathan Neo
07/25/2023, 3:53 AMJonathan Neo
07/25/2023, 2:14 PMmetadata
field to tag owners in the slack message, similar to how I’m tagging you now.Timothee Vandeput
07/25/2023, 2:26 PMJonathan Neo
07/25/2023, 2:29 PMJonathan Neo
07/25/2023, 2:39 PMinstance.get_asset_records(asset_keys=asset_keys)
, but the AssetEntry
returned doesn’t contain any metadata
fields:
AssetEntry(asset_key=AssetKey(['python_example', 'something']), last_materialization_record=None, last_run_id='1c2e2ec5-b059-446c-9815-f5126edd2ca8', asset_details=None, cached_status=None))]
Maybe asset_details
should’ve shown something and not None
?claire
07/26/2023, 8:43 PM@asset
i.e. @asset(metadata={"owner": ....})
but I was referring to the metadata attached to a given output.
You could fetch the asset definition directly from the Definitions
object, but for a run failure sensor the Definitions
object is unfortunately not available on the context. I believe the regular SensorEvaluationContext
used for regular @sensor
contains a context.definitions
field, so you could create a @sensor
object that basically does the same thing as a run failure sensor