You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "rwhitt2049 (via GitHub)" <gi...@apache.org> on 2024/10/23 16:58:29 UTC

Re: [D] Conditional retry on callback [airflow]

GitHub user rwhitt2049 added a comment to the discussion: Conditional retry on callback

I made a slight tweak on the above that will ensure that any `on_failure_callback`s still get called. Just setting the instance state prevented retries, but any failure callbacks didn't get executed.

```python
def retry_callback(context):
    if True:  # some condition
        ti = context["ti"]
        ti.handle_failure(error=None, force_fail=True).  # this will set the state to failed and call the on_failure_callback
```

GitHub link: https://github.com/apache/airflow/discussions/28263#discussioncomment-11032021

----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org