Skip to content

Commit e0ed7a3

Browse files
authored
bugfix: remove infinite increasing ignore set (#16)
1 parent 3447cbf commit e0ed7a3

1 file changed

Lines changed: 3 additions & 12 deletions

File tree

app/core/monitor.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@ class JobMonitor:
1919
def __init__(self):
2020
self.stop_monitoring = False
2121
self.monitoring_task = None
22-
self._ignore_jobs = (
23-
set()
24-
) # Keep ignore list to avoid reprocessing completed jobs
2522

2623
async def _get_queue_info(self) -> dict[str, int]:
2724
"""Get queue information with fallback"""
@@ -137,13 +134,9 @@ async def monitor_jobs(self):
137134
for job in jobs:
138135
job_id = job.metadata.name
139136

140-
# Skip previously completed jobs
141-
if job_id in self._ignore_jobs:
142-
logger.debug(f"ignoring job: {job_id}")
143-
continue
144-
145137
if not job.status.conditions:
146138
logger.warning(f"Job conditions not ready for {job_id}")
139+
await asyncio.sleep(0.1)
147140
continue
148141

149142
conditions = job.status.conditions[-1]
@@ -157,7 +150,8 @@ async def monitor_jobs(self):
157150
if status in TrainingJobStatus.stopped_states:
158151
job_info = await db_manager.get_job(job_id)
159152
if job_info and job_info.status == status:
160-
self._ignore_jobs.add(job_id)
153+
# ignore jobs that are already in stopped states
154+
await asyncio.sleep(0.1)
161155
continue
162156

163157
# check if state changed
@@ -185,8 +179,6 @@ async def monitor_jobs(self):
185179

186180
# Additional handling for completed jobs
187181
if is_completed:
188-
self._ignore_jobs.add(job_id)
189-
190182
if status == KubeflowStatusEnum.succeeded:
191183
logger.info(
192184
f"Job {job_id} completed successfully, cleaning up"
@@ -229,7 +221,6 @@ async def stop(self):
229221
except asyncio.CancelledError:
230222
pass
231223
finally:
232-
self._ignore_jobs.clear()
233224
self.monitoring_task = None
234225

235226

0 commit comments

Comments
 (0)