juarezr opened a new pull request, #62055: URL: https://github.com/apache/airflow/pull/62055
## Add `--only-idle` flag to `airflow scheduler` ### Summary Adds an optional flag so the scheduler can exit after a given number of **idle** runs (no tasks queued or finished), instead of counting every run. When `--only-idle` is set, the run counter is reset whenever the scheduler processes a task (queues or handles a finished event). The scheduler exits after `num_runs` **consecutive** idle runs. ### Motivation - Debugging: it will allow you to specify a low value for `--num-runs` instead of guessing when you don't know exactly the number of runs required to test your DAG. ### Changes - **CLI:** Added `-i` / `--only-idle` flag to command `airflow scheduler`. When this flag is set, the command also requires `--num-runs`; otherwise, it exits with an error. - **Config:** Added a new config entry `[scheduler] only_idle` (boolean, default `false`) so it would complement the existing `[scheduler] num_runs`. - **Tests:** Added test validating the CLI and also the schedule behavior. --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Cursor -- 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]
