SangwanP opened a new issue #22006:
URL: https://github.com/apache/airflow/issues/22006


   ### Description
   
   I'd like the ability to "drain" a DAG from the UI. This would mean: 
   
   - If a DAG is in a running state - disable the DAG after the run reaches a 
finished state (success/failed)
   - If a DAG is in an idle state - disable immediately (same as what disable 
does right now)
   
   
   ### Use case/motivation
   
   Currently, if you disable a DAG, it stops the DAG midway - the running tasks 
are completed, and queued tasks remain on the queue. I would like a way to 
disable the DAG, but if there is an active Dag Run it should continue running 
until it reaches a finished state.
   
   For us, this would be especially helpful when upgrading our Airflow 
images/environments. To my understanding, Airflow doesn't have a failure-free 
zero-downtime upgrade (please point me to documentation if its possible). When 
upgrading, we don't want to fail/kill running DAGs, so we let them reach a 
finished state. Once none of the DAGs are in a running state, we perform the 
upgrades. Precisely timing the DAG disable operation such that a subsequent run 
doesn't start, is not a practical/viable solution.
   For upgrades in the past, we have changed all the DAG schedules to None, 
which allows a running DAG to complete but doesn't start a subsequent run. Once 
upgrades are done, we update the DAG schedules back to their original value.
   We would like to move away from this solution, and have some built-in 
functionality to deal with such a case.
   
   ### Related issues
   
   _No response_
   
   ### Are you willing to submit a 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