easontm opened a new issue #20898: URL: https://github.com/apache/airflow/issues/20898
### Apache Airflow version 2.2.3 (latest released) ### What happened The metric `scheduler.tasks.running` is populated from the variable `num_tasks_in_executor` in scheduler_job.py. However, `num_tasks_in_executor` is initialized to `0` and then never updated again. Function `_executable_task_instances_to_queued`: https://github.com/apache/airflow/blob/c59001d79facf7e472e0581ac8a538c25eebfda7/airflow/jobs/scheduler_job.py#L328 https://github.com/apache/airflow/blob/c59001d79facf7e472e0581ac8a538c25eebfda7/airflow/jobs/scheduler_job.py#L457 I considered just opening a PR modifying that value with the rest of these "counter" modifications: https://github.com/apache/airflow/blob/c59001d79facf7e472e0581ac8a538c25eebfda7/airflow/jobs/scheduler_job.py#L449-L452 However, I'm not sure if this is the best course of action because we don't know if the tasks is successfully added until the the list of executable TIs is returned within `_critical_section_execute_task_instances`, and those TIs are attempted to be queued in `_enqueue_task_instances_with_queued_state`. https://github.com/apache/airflow/blob/c59001d79facf7e472e0581ac8a538c25eebfda7/airflow/jobs/scheduler_job.py#L534-L540 https://github.com/apache/airflow/blob/c59001d79facf7e472e0581ac8a538c25eebfda7/airflow/executors/base_executor.py#L73-L85 ### What you expected to happen _No response_ ### How to reproduce _No response_ ### Operating System Ubuntu 19.10 ### Versions of Apache Airflow Providers _No response_ ### Deployment Other Docker-based deployment ### 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]
