SakshamSinghal20 commented on code in PR #61769:
URL: https://github.com/apache/airflow/pull/61769#discussion_r2837222900


##########
airflow-core/src/airflow/models/taskinstance.py:
##########
@@ -1738,15 +1738,23 @@ def xcom_pull(
 
     @provide_session
     def get_num_running_task_instances(self, session: Session, same_dagrun: 
bool = False) -> int:
-        """Return Number of running TIs from the DB."""
+        """
+        Return number of active TIs for this task from the DB.
+
+        Counts task instances in running, queued, or deferred state.
+        Deferred TIs are included because they are still logically in-flight
+        and must count against max_active_tis_per_dag / 
max_active_tis_per_dagrun.
+        """

Review Comment:
   A deferred task is "running" against the external system, but not against 
Airflow's worker pool. We could potentially add a config like 
`max_active_tasks_include_deferred` in the future for consistency, but treating 
this task-level limit differently is necessary to prevent external resource 
exhaustion.
   
   let me know if i am wrong as i am still learning..



-- 
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