def _make_actor_method_executor(self, method_name, method, actor_imported):
        """Make an executor that wraps a user-defined actor method.

        The wrapped method updates the worker's internal state and performs any
        necessary checkpointing operations.

        Args:
            method_name (str): The name of the actor method.
            method (instancemethod): The actor method to wrap. This should be a
                method defined on the actor class and should therefore take an
                instance of the actor as the first argument.
            actor_imported (bool): Whether the actor has been imported.
                Checkpointing operations will not be run if this is set to
                False.

        Returns:
            A function that executes the given actor method on the worker's
                stored instance of the actor. The function also updates the
                worker's internal state to record the executed method.
        """

        def actor_method_executor(dummy_return_id, actor, *args):
            # Update the actor's task counter to reflect the task we're about
            # to execute.
            self._worker.actor_task_counter += 1

            # Execute the assigned method and save a checkpoint if necessary.
            try:
                if is_class_method(method):
                    method_returns = method(*args)
                else:
                    method_returns = method(actor, *args)
            except Exception as e:
                # Save the checkpoint before allowing the method exception
                # to be thrown, but don't save the checkpoint for actor
                # creation task.
                if (isinstance(actor, ray.actor.Checkpointable)
                        and self._worker.actor_task_counter != 1):
                    self._save_and_log_checkpoint(actor)
                raise e
            else:
                # Handle any checkpointing operations before storing the
                # method's return values.
                # NOTE(swang): If method_returns is a pointer to the actor's
                # state and the checkpointing operations can modify the return
                # values if they mutate the actor's state. Is this okay?
                if isinstance(actor, ray.actor.Checkpointable):
                    # If this is the first task to execute on the actor, try to
                    # resume from a checkpoint.
                    if self._worker.actor_task_counter == 1:
                        if actor_imported:
                            self._restore_and_log_checkpoint(actor)
                    else:
                        # Save the checkpoint before returning the method's
                        # return values.
                        self._save_and_log_checkpoint(actor)
                return method_returns

        return actor_method_executor
Make an executor that wraps a user-defined actor method.

        The wrapped method updates the worker's internal state and performs any
        necessary checkpointing operations.

        Args:
            method_name (str): The name of the actor method.
            method (instancemethod): The actor method to wrap. This should be a
                method defined on the actor class and should therefore take an
                instance of the actor as the first argument.
            actor_imported (bool): Whether the actor has been imported.
                Checkpointing operations will not be run if this is set to
                False.

        Returns:
            A function that executes the given actor method on the worker's
                stored instance of the actor. The function also updates the
                worker's internal state to record the executed method.