@@ -53,7 +53,7 @@ def __init__(self):
5353 self ._job_repo = None
5454 self ._reconciled = False
5555
56- async def reconcile_on_startup (self , max_entries : int = 20 ) -> Dict [str , int ]:
56+ async def reconcile_on_startup (self , max_entries : Optional [ int ] = None ) -> Dict [str , int ]:
5757 """Reconcile LOCAL jobs with actual process status.
5858
5959 Called on startup to check running LOCAL jobs and handle orphaned ones:
@@ -62,7 +62,8 @@ async def reconcile_on_startup(self, max_entries: int = 20) -> Dict[str, int]:
6262 - Jobs without PIDs (legacy) are marked as failed
6363
6464 Args:
65- max_entries: Maximum number of running entries to check (default 20).
65+ max_entries: Optional maximum number of running entries to check.
66+ When omitted, all running local jobs are reconciled.
6667
6768 Returns:
6869 Dictionary with stats: {"orphaned": N, "adopted": N, "no_pid": N}
@@ -73,17 +74,14 @@ async def reconcile_on_startup(self, max_entries: int = 20) -> Dict[str, int]:
7374 return stats
7475
7576 job_repo = self ._get_job_repo ()
76- # Only get LOCAL running jobs - this is bounded by the number of
77- # GPUs on this machine, so should be small (typically 0-8)
7877 running_jobs = await job_repo .get_running_local_jobs ()
7978
8079 if not running_jobs :
8180 self ._reconciled = True
8281 return stats
8382
84- # Limit entries to check
85- jobs_to_check = running_jobs [:max_entries ]
86- if len (running_jobs ) > max_entries :
83+ jobs_to_check = running_jobs if max_entries is None else running_jobs [:max_entries ]
84+ if max_entries is not None and len (running_jobs ) > max_entries :
8785 logger .warning (
8886 "Found %d running local jobs, only checking first %d" ,
8987 len (running_jobs ),
0 commit comments