Run loop tick in bg thread

- prepare_next_tasks, apply_writes do some cpu-heavy work
This commit is contained in:
Nuno Campos
2024-09-04 12:18:42 -07:00
parent b68f9211c2
commit 67a164ca2d
+2 -1
View File
@@ -1419,7 +1419,8 @@ class Pregel(Runnable[Union[dict[str, Any], Any], Union[dict[str, Any], Any]]):
# channel updates from step N are only visible in step N+1
# channels are guaranteed to be immutable for the duration of the step,
# with channel updates applied only at the transition between steps
while loop.tick(
while await asyncio.to_thread(
loop.tick,
input_keys=self.input_channels,
interrupt_before=interrupt_before,
interrupt_after=interrupt_after,