Skip to content

Get the original stack trace of the exception in run_failure_sensor #8428

Answered by yuhan
dagsir[bot] bot asked this question in Q&A
Discussion options

You must be logged in to vote

The original stack trace could be in multiple places. The code snippet should capture both run level exception and step level exception:

@run_failure_sensor(job_selection=[my_job], minimum_interval_seconds=5)
def my_failure_sensor(context: RunFailureSensorContext):
    errors = []
    # Run level failure
    if context.failure_event.event_specific_data.error:
        errors.append(context.failure_event.event_specific_data.error)

    # Step level failure - capture it separately because details of which won't be surfaced to the
    # run level context.failure_event
    events = context.instance.all_logs(
        run_id=context.dagster_run.run_id, of_type=DagsterEventType.STEP_FAILURE
    )…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by yuhan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant