docs(autoscaler): correct queue_depth docstring on dependency cycles
Cycle tasks never reach topo sort: ready_tasks filters by 'deps all completed' first, so they neither raise ValueError nor zero out other ready tasks (5 ready + 1 cycle pair still counts 5; only a pure cycle counts 0, because its ready set is empty). Counting logic unchanged.
This commit is contained in:
1 parent
88e16ee8ac
commit
1e024f175f
1 file changed
+9
-3
+9
-3
@@ -66,9 +66,15 @@ from cloud.workers import DEFAULT_ALIVE_SECONDS as _WORKER_ALIVE_SECONDS
|
||||
def queue_depth(db_path, executor=None):
|
||||
"""当前就绪任务数:依赖已满足且状态为 queued 的任务。
|
||||
|
||||
依赖成环时 ready_tasks 抛 ValueError,视为 0(成环任务
|
||||
本就派不出去,不应为它扩容)。executor 给定时只数该
|
||||
执行器能认领的任务(未指定执行器、或指定为该执行器)。
|
||||
依赖成环的任务不贡献深度,但不是因为 ready_tasks 抛
|
||||
ValueError 后整体归 0:ready_tasks 先按“依赖全部已完成”
|
||||
过滤(见 cloud/queue.py),成环任务的依赖从未完成、根本
|
||||
进不了拓扑排序,所以既不抛错、也不拖累其它就绪任务——
|
||||
5 个独立就绪任务加 1 对成环任务时深度仍为 5,只有纯成环
|
||||
时深度才为 0(此时就绪集本身为空)。若 ready_tasks 因
|
||||
其它原因抛 ValueError,本函数仍按原有兜底返回 0。
|
||||
executor 给定时只数该执行器能认领的任务(未指定执行器、
|
||||
或指定为该执行器)。
|
||||
"""
|
||||
conn = _db_connect(db_path)
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user