Skip to content

Commit c9c5d7d

Browse files
committed
tosquash: log only on task count changes
1 parent 676d19d commit c9c5d7d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

runpod/serverless/modules/rp_scale.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ async def run_jobs(self, session: ClientSession):
221221
"""
222222
tasks: Set[asyncio.Task] = set()
223223

224+
last_task_count = 0
224225
while self.is_alive() or not self.jobs_queue.empty():
225226
# Fetch as many jobs as the concurrency allows
226227
while len(tasks) < self.current_concurrency and not self.jobs_queue.empty():
@@ -231,7 +232,10 @@ async def run_jobs(self, session: ClientSession):
231232

232233
# Wait for any job to finish
233234
if tasks:
234-
log.info(f"Jobs in progress: {len(tasks)}")
235+
current_task_count = len(tasks)
236+
if current_task_count != last_task_count:
237+
log.info(f"Jobs in progress: {current_task_count}")
238+
last_task_count = current_task_count
235239

236240
done, pending = await asyncio.wait(
237241
tasks, return_when=asyncio.FIRST_COMPLETED, timeout=0.1

0 commit comments

Comments
 (0)