Skip to content

Conditional retry on callback #28263

Answered by Taragolis
cmpeburak asked this question in Q&A
Discussion options

You must be logged in to vote

You could try to set status of Task Instance to failed

from airflow.utils.state import TaskInstanceState


def retry_callback(context) -> None:
    if True:  # some condition
        ti = context["ti"]
        print(f"Set task instance {ti} state to {TaskInstanceState.FAILED}")
        ti.set_state(TaskInstanceState.FAILED)
        return

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@cmpeburak
Comment options

@edualvess
Comment options

Answer selected by cmpeburak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants