From 48f6cd3e5d3432afe7fd1e587234c3e0119ff9a9 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Sat, 2 Mar 2019 11:43:28 +0800 Subject: [PATCH] Release GIL in prepare_actor_checkpoint (#4208) --- python/ray/_raylet.pyx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python/ray/_raylet.pyx b/python/ray/_raylet.pyx index b33165174..8b12a04fd 100644 --- a/python/ray/_raylet.pyx +++ b/python/ray/_raylet.pyx @@ -354,8 +354,12 @@ cdef class RayletClient: def prepare_actor_checkpoint(self, ActorID actor_id): cdef CActorCheckpointID checkpoint_id - check_status(self.client.get().PrepareActorCheckpoint( - actor_id.data, checkpoint_id)) + cdef CActorID c_actor_id = actor_id.data + # PrepareActorCheckpoint will wait for raylet's reply, release + # the GIL so other Python threads can run. + with nogil: + check_status(self.client.get().PrepareActorCheckpoint( + c_actor_id, checkpoint_id)) return ActorCheckpointID(checkpoint_id.binary()) def notify_actor_resumed_from_checkpoint(self, ActorID actor_id,