GitHub user nidhishkrishnan closed a discussion: How to call an API when I 
manually marked a state as failed/ success in Airflow UI

I have created custom Airflow operator to trigger some of my api when the job 
submits. Everything works fine but one problem is in Airflow UI we have an 
option to mark state as failed or success, when a user manually click and 
marked state as failed or success I need to call an API in the custom opretor

<img width="456" height="177" alt="image" 
src="https://github.com/user-attachments/assets/ce072dfd-e19b-43e2-8dbd-3550ce6086e9";
 />

I used multiple ways one was calling on_failure_callback


    def my_failure_callback(context):
        task_id = context['task_instance'].task_id
        print(f"Task {task_id} failed manually.")


    tatus_update_job = CraftSparkOperator(
        on_failure_callback=my_failure_callback,
        task_id='application-arb-status-update-job',
        conn_id='datacraft_dev',
: 
: 

another way was calling on_kill method

    def on_kill(self):
        self.log.info("On Kill: Task: %s with invalid task_id was requested to 
be cancelled.", self.task_id)
        
even the execute function is also not getting invoked when a user manually 
click and marked state as failed or success in Airflow UI


I am using Airflow 2.10.0

Can someone help me on this


GitHub link: https://github.com/apache/airflow/discussions/60550

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to