MCPcopy Create free account
hub / github.com/THUDM/AgentBench / get_concurrency

Method get_concurrency

src/client/task.py:34–52  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

32 return result.json()
33
34 def get_concurrency(self) -> int:
35 try:
36 result = requests.get(
37 self.controller_address + "/list_workers"
38 )
39 except Exception as e:
40 print(ColorMessage.yellow(f"Warning task {self.name} cannot connect to controller {e}"))
41 return 0
42 if result.status_code != 200:
43 raise AgentBenchException(result.text, result.status_code, self.name)
44 result = result.json()
45 if self.name not in result:
46 print(ColorMessage.yellow(f"task {self.name} not found in worker list"))
47 return 0
48 concurrency = 0
49 for worker in result[self.name]["workers"].values():
50 if worker["status"] == WorkerStatus.ALIVE:
51 concurrency += worker["capacity"] - worker["current"]
52 return concurrency
53
54 def run_sample(self, index: SampleIndex, agent: AgentClient) -> TaskClientOutput:
55 try:

Callers 1

worker_generatorMethod · 0.80

Calls 2

AgentBenchExceptionClass · 0.85
yellowMethod · 0.80

Tested by

no test coverage detected