Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up batching of events in evaluator #9736

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/ert/ensemble_evaluator/evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ def set_event_handler(event_types: set[type[Event]], func: Any) -> None:
):
self._complete_batch.clear()
try:
event = await asyncio.wait_for(self._events.get(), timeout=0.1)
event = self._events.get_nowait()
function = event_handler[type(event)]
batch.append((function, event))
self._events.task_done()
except TimeoutError:
except asyncio.QueueEmpty:
await asyncio.sleep(0.1)
continue
self._complete_batch.set()
await self._batch_processing_queue.put(batch)
Expand Down Expand Up @@ -381,7 +382,7 @@ async def _monitor_and_handle_tasks(self) -> None:
raise task_exception
elif task.get_name() == "server_task":
return
elif task.get_name() == "ensemble_task" or task.get_name() in {
elif task.get_name() in {
"ensemble_task",
"listener_task",
}:
Expand Down
Loading