Anurag-Shetty opened a new issue, #23520:
URL: https://github.com/apache/airflow/issues/23520

   ### Apache Airflow version
   
   2.3.0 (latest released)
   
   ### What happened
   
   Lets say we have series of tasks,  currently we executing task B , if the 
scheduler process gets killed, then worker thats running task B continues to 
run and  we start the scheduler again and task B was still running because of 
worker is not killed, then task B would be started for second time with attempt 
2, not considering the earlier process. 
   
   ### What you think should happen instead
   
   when scheduler is killed it should  kill worker process or scheduler is 
restarted it will should able to link back.
   
   ### How to reproduce
   
   step1. create task that run for long time. here is example with bashoperator.
       CUSTOM_JOB = BashOperator(
           task_id='CUSTOM_JOB',
           bash_command='  for (( i= 1; ; i++)); do    echo "Pres CTRL+C to 
stop... for $i";    sleep 1;   if [ $i -gt 200 ]; then exit 0; fi; done', 
       )
   
   step 2. make sure airflow scheduler is runing and trigger the dag.
   
   step 3. kill the airflow scheduler process in mid way of task execution
   
   step 4: start the airflow scheduler back again, now you will be see two 
instance of task running parallely.
   
   it will marked as complete once the task instance scheduled by previous 
scheduler compeletes. 
   
   [2022-05-05, 13:50:13 UTC] {subprocess.py:92} INFO - Pres CTRL+C to stop... 
for 164
   [2022-05-05, 13:50:14 UTC] {subprocess.py:92} INFO - Pres CTRL+C to stop... 
for 165
   [2022-05-05, 13:50:14 UTC] {local_task_job.py:220} WARNING - **State of this 
instance has been externally set to success. Terminating instance.**
   [2022-05-05, 13:50:14 UTC] {process_utils.py:125} INFO - Sending 
Signals.SIGTERM to group 9365. PIDs of all processes in the group: [9396, 
30772, 9365]
   
   
   
   ### Operating System
   
   redhat 7.9
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to