1212from dataclasses import dataclass
1313from datetime import timedelta
1414from itertools import product
15+ from subprocess import run
1516from typing import TYPE_CHECKING , Any , Literal , cast
1617from unittest .mock import AsyncMock , Mock , call , patch
1718
19+ import psutil
1820import pytest
1921
2022from crawlee import ConcurrencySettings , Glob , service_locator
@@ -1290,6 +1292,13 @@ async def test_timeout_in_handler(sleep_type: str, _) -> None:
12901292 # Test is skipped in older Python versions.
12911293 from asyncio import timeout # type:ignore[attr-defined] # noqa: PLC0415
12921294
1295+ # Debug CPu usage before starting the test
1296+ run ("ps -ewfaxo comm,user,pid,%cpu,cmd" , shell = True )
1297+
1298+ run ("ps -awxo pid,%cpu,comm" , shell = True )
1299+
1300+
1301+
12931302 handler_timeout = timedelta (seconds = 1 )
12941303 max_request_retries = 3
12951304 double_handler_timeout_s = handler_timeout .total_seconds () * 2
@@ -1301,6 +1310,8 @@ async def test_timeout_in_handler(sleep_type: str, _) -> None:
13011310 max_request_retries = max_request_retries ,
13021311 )
13031312 crawler .log .setLevel (logging .DEBUG )
1313+
1314+ crawler .log .info (f'Calling get_cpu_info()...: { psutil .cpu_percent (percpu = True )} ' )
13041315 logging .getLogger ('crawlee.storage_clients._file_system._request_queue_client' ).setLevel (logging .DEBUG )
13051316 logging .getLogger ('crawlee._autoscaling.autoscaled_pool' ).setLevel (logging .INFO )
13061317
0 commit comments