Skip to content

Commit c5dfb17

Browse files
recursixgasse
authored andcommitted
Improve timeout handling in task polling logic
1 parent f35dea0 commit c5dfb17

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/agentlab/experiments/graph_execution_ray.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def get_task(exp_arg: bgym.ExpArgs):
3636
get_task(exp_arg)
3737

3838
max_timeout = max([_episode_timeout(exp_args, avg_step_timeout) for exp_args in exp_args_list])
39+
3940
return poll_for_timeout(task_map, max_timeout, poll_interval=max_timeout * 0.1)
4041

4142

@@ -57,7 +58,7 @@ def poll_for_timeout(tasks: dict[str, ray.ObjectRef], timeout: float, poll_inter
5758
# print(f"Task {task.task_id().hex()} elapsed time: {elapsed_time}")
5859
if elapsed_time is not None and elapsed_time > timeout:
5960
msg = f"Task {task.task_id().hex()} hase been running for {elapsed_time}s, more than the timeout: {timeout}s."
60-
if elapsed_time < timeout + 60:
61+
if elapsed_time < timeout + 60 + poll_interval:
6162
logger.warning(msg + " Cancelling task.")
6263
ray.cancel(task, force=False, recursive=False)
6364
else:

0 commit comments

Comments
 (0)