@@ -359,6 +359,9 @@ def __init__(
359359
360360 self ._http_proxy = http_proxy
361361 self ._log_level = _validate_and_normalize_log_level (log_level )
362+ # Set by the CLI (--simulation) when the worker runs under an agent
363+ # simulation: load shedding is disabled so runs can saturate the agent.
364+ self ._simulation = False
362365 self ._agent_name = ""
363366 self ._server_type = ServerType .ROOM
364367 self ._id = "unregistered"
@@ -584,6 +587,9 @@ async def run(self, *, devmode: bool = False, unregistered: bool = False) -> Non
584587 )
585588 self ._load_threshold = _default_load_threshold
586589
590+ if self ._simulation :
591+ logger .info ("simulation mode enabled: worker load limit disabled" )
592+
587593 self ._loop = asyncio .get_event_loop ()
588594 self ._devmode = devmode
589595 self ._job_lifecycle_tasks = set [asyncio .Task [Any ]]()
@@ -1017,7 +1023,7 @@ async def aclose(self) -> None:
10171023 await self ._prometheus_server .aclose ()
10181024
10191025 if self ._api is not None :
1020- await self ._api .aclose () # type: ignore[no-untyped-call]
1026+ await self ._api .aclose () # type: ignore[no-untyped-call, unused-ignore ]
10211027
10221028 # await asyncio.sleep(0.25) # see https://github.com/aio-libs/aiohttp/issues/1925
10231029 self ._msg_chan .close ()
@@ -1296,6 +1302,9 @@ def _is_available(self) -> bool:
12961302 if self ._draining :
12971303 return False
12981304
1305+ if self ._simulation :
1306+ return True
1307+
12991308 load_threshold = ServerEnvOption .getvalue (self ._load_threshold , self ._devmode )
13001309 if math .isinf (load_threshold ):
13011310 return True
@@ -1455,7 +1464,7 @@ async def _update_worker_status(self) -> None:
14551464
14561465 load_threshold = ServerEnvOption .getvalue (self ._load_threshold , self ._devmode )
14571466 effective_load = self ._get_effective_load ()
1458- is_full = effective_load >= load_threshold
1467+ is_full = not self . _simulation and effective_load >= load_threshold
14591468 currently_available = not is_full and not self ._draining
14601469
14611470 status = (
0 commit comments