Skip to content

callback functions not called when a dag run is marked success or failure #18113

@lssatvik

Description

@lssatvik

Apache Airflow version

2.1.1

Operating System

Ubuntu 20.04.3 LTS

Versions of Apache Airflow Providers

apache-airflow-providers-amazon==2.0.0
apache-airflow-providers-celery==2.0.0
apache-airflow-providers-cncf-kubernetes==2.0.0
apache-airflow-providers-databricks==2.0.0
apache-airflow-providers-ftp==2.0.0
apache-airflow-providers-imap==2.0.0
apache-airflow-providers-mysql==2.0.0
apache-airflow-providers-postgres==2.0.0
apache-airflow-providers-redis==2.0.0
apache-airflow-providers-sqlite==2.0.0
apache-airflow-providers-ssh==2.0.0

Deployment

Virtualenv installation

Deployment details

No response

What happened

'on_success_callback' and 'on_failure_callback' functions were not called when manually marking success or failure on a completed dag run.

What you expected to happen

'on_success_callback' and 'on_failure_callback' functions should be called whenever marking success or failure on a dag run even after it completes.

How to reproduce

Provide callback function as 'on_success_callback' argument when initializing DAG operator. Let one dag run complete. Check if 'on_success_callback' function is called. Then mark the dag run as failed. Then mark the dag run as succeeded. The 'on_success_callback' function is not called.

Anything else

The callback functions are called when a dagrun is automatically marked success/failure by scheduler but aren't called when manually setting them after run completion. I have read earlier posts on stack overflow that this was not intended behaviour in Airflow 1 but could not find similar posts for Airflow 2 if this is a bug and how to fix it.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions