GitHub user nidhishkrishnan closed a discussion: How to call an API when I 
manually marked a state as 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 success, when a user manually click and marked state as 
success I need to call an API in the custom operator

<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_success_callback(context):
        task_id = context['task_instance'].task_id
        print(f"Task {task_id} failed manually.")


    tatus_update_job = CraftSparkOperator(
        on_failure_callback=my_success_callback,
        task_id='applitus-update-job',
        conn_id='craft_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 success in Airflow UI

It works for failed state change but not for success


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