SameerMesiah97 opened a new pull request, #67589: URL: https://github.com/apache/airflow/pull/67589
**Description** This change refactors task concurrency evaluation logic out of `SchedulerJobRunner._executable_task_instances_to_queued` into a dedicated helper method. Task concurrency checks for `max_active_tis_per_dag` and `max_active_tis_per_dagrun`, along with their associated serialized DAG loading, starvation bookkeeping, and missing DAG handling, were previously implemented inline inside the main scheduling loop. This logic has now been extracted into `_task_concurrency_allows_execution`. The new helper encapsulates serialized DAG retrieval and missing DAG handling, task-level and task-per-DAG-run concurrency checks, and concurrency starvation bookkeeping and logging. **Rationale** `_executable_task_instances_to_queued` currently performs a large number of responsibilities, including pool management, DAG-level concurrency enforcement, task-level concurrency evaluation, executor routing, starvation tracking, and queue state transitions. The task concurrency section in particular introduced deeply nested control flow and intermixed concurrency-specific behavior directly inside the main scheduling loop, making the scheduling path harder to visually scan and maintain. **Tests** No test adjustments were required because this change is a refactor only and does not introduce any behavioral changes. **Backwards Compatibility** This change is a refactor only and does not modify scheduler behavior, public APIs, task concurrency semantics, or executor interactions. ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: [GPT 5.5] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) -- 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]
