Robert Kolb
05/18/2023, 5:02 PMmake_slack_on_failure_sensor
which I’m using to log failures.
From RunFailureSensorContext
I want to be able to extract the specific exception that caused an error.
For example, in the screenshot you can see that it’s throwing a KeyError
. I want to be able to grab this plus the error message. Is there a clean way to do this without having to use regex to parse the full stack trace which is returned from RunFailureSensorContext.get_step_failure_events()[0].step_failure_data.error.cause
?
I’ve tried grabbing other attributes from step_failure data
but have only been able to snag the DagsterExecutionStepExecutionError
as opposed to the key error.
Any tips on how to accomplish this? I might be missing some obvious attribute here
screenshot is below in the reply to illustrate what im trying to get 👇Robert Kolb
05/18/2023, 5:02 PMjamie
05/18/2023, 5:08 PMRunFailureSensorContext.get_step_failure_events()[0].event_specific_data.user_failure_data
RunFailureSensorContext.get_step_failure_events()[0].event_specific_data.error_source
jamie
05/18/2023, 5:09 PMRunFailureSensorContext.get_step_failure_events()[0].event_specific_data.error_display_string
Robert Kolb
05/18/2023, 5:27 PMevent_specific_data.error_display_string
but that one gives the full stack trace as a string which isnt ideal
lmk if there's others you'd recommend trying. otherwise ill go the regex route for now
here's the output each one provides:
------------------------------------------
<http://step_failure_data.error.to|step_failure_data.error.to>_exception_message_only
: `dagster._core.errors.DagsterExecutionStepExecutionError: Error occurred while executing op "sanitized"
event_specific_data.user_failure_data
: None
event_specific_data.error_source
: ErrorSource.USER_CODE_ERROR
event_specific_data.error_display_string
: `dagster._core.errors.DagsterExecutionStepExecutionError: Error occurred while executing op "example_client__core__axiontology_parquet"::
KeyError: 'x'
Stack Trace:
full stack trace as a string is herejamie
05/18/2023, 5:41 PMjamie
05/19/2023, 9:00 PMcontext.failure_event.message
give you?