Skip to content

Commit d3d5c03

Browse files
committed
See measurements problems with CPU usage
1 parent 4da8361 commit d3d5c03

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/crawlee/_autoscaling/autoscaled_pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class AutoscaledPool:
6161
_TASK_TIMEOUT: timedelta | None = None
6262
"""Timeout within which the `run_task_function` must complete."""
6363

64-
_OVERLOADED_BACKOFF_TIME: timedelta = timedelta(seconds=0.5)
64+
_OVERLOADED_BACKOFF_TIME: timedelta = timedelta(seconds=1)
6565
"""When overloaded, Autoscaled pool waits this long before rechecking system status."""
6666

6767
def __init__(
@@ -240,7 +240,7 @@ async def _worker_task_orchestrator(self, run: _AutoscaledPoolRun) -> None:
240240

241241
current_status = self._system_status.get_current_system_info()
242242
if not current_status.is_system_idle:
243-
logger.info('Not scheduling new tasks - system is overloaded')
243+
logger.info(f'Not scheduling new tasks - system is overloaded: {current_status}')
244244
await asyncio.sleep(self._OVERLOADED_BACKOFF_TIME.total_seconds())
245245
logger.info('Release the overloaded backoff')
246246
elif self._is_paused:

src/crawlee/events/_local_event_manager.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ async def __aexit__(
9393

9494
async def _emit_system_info_event(self) -> None:
9595
"""Emit a system info event with the current CPU and memory usage."""
96-
cpu_info = await asyncio.to_thread(get_cpu_info)
97-
memory_info = await asyncio.to_thread(get_memory_info)
96+
cpu_info = get_cpu_info()
97+
memory_info = get_memory_info()
9898

9999
event_data = EventSystemInfoData(cpu_info=cpu_info, memory_info=memory_info)
100100
self.emit(event=Event.SYSTEM_INFO, event_data=event_data)

0 commit comments

Comments
 (0)