what is the DagsterEventType for when a materializ...
# ask-community
what is the DagsterEventType for when a materialization fails? Usually a sensor would be listening for a materialization being successful using DagsterEventType .ASSET_MATERIALIZATION
also curious about the Stale status, how can I use the context.instance.get_event_records to looks for stale materializations?
hi @Jean Gonzalez! for your first question, currently, there is no explicit event for failed asset materializations. In the UI, an asset gets the "Failed" status when both: • the most recent run for that asset has failed • the most recent run for that asset did not materialize the asset In general, you can access this information off of the AssetRecord object for that key (using instance.get_asset_records). The asset_entry on the AssetRecord will have the last run id, as well as the last materialization record, so you can use instance.get_run_by_id to check the status of that run, and if it failed, then check to see if the latest materialization record for that asset was in that run (meaning it got materialized before the run failed)
for your second question, similarly, this information is not directly part of the event log -- it's derived using the event log as well as other sources. currently, there is no public API for resolving the status of the asset (it currently lives here), but this interface can and will change between minor versions so I would not recommend building off of this at the moment
however, if your goal is to kick off a run for all stale assets, then you can set
on the RunRequest returned from a sensor, which will resolve that for you
🙌 1
thanks @owen this is super helpful!!!