def as_future(self, object_id, check_ready=True):
        """Turn an object_id into a Future object.

        Args:
            object_id: A Ray's object_id.
            check_ready (bool): If true, check if the object_id is ready.

        Returns:
            PlasmaObjectFuture: A future object that waits the object_id.
        """
        if not isinstance(object_id, ray.ObjectID):
            raise TypeError("Input should be an ObjectID.")

        plain_object_id = plasma.ObjectID(object_id.binary())
        fut = PlasmaObjectFuture(loop=self._loop, object_id=plain_object_id)

        if check_ready:
            ready, _ = ray.wait([object_id], timeout=0)
            if ready:
                if self._loop.get_debug():
                    logger.debug("%s has been ready.", plain_object_id)
                self._complete_future(fut)
                return fut

        if plain_object_id not in self._waiting_dict:
            linked_list = PlasmaObjectLinkedList(self._loop, plain_object_id)
            linked_list.add_done_callback(self._unregister_callback)
            self._waiting_dict[plain_object_id] = linked_list
        self._waiting_dict[plain_object_id].append(fut)
        if self._loop.get_debug():
            logger.debug("%s added to the waiting list.", fut)

        return fut
def as_future ( self , object_id , check_ready = True ) : if not isinstance ( object_id , ray . ObjectID ) : raise TypeError ( "Input should be an ObjectID." ) plain_object_id = plasma . ObjectID ( object_id . binary ( ) ) fut = PlasmaObjectFuture ( loop = self . _loop , object_id = plain_object_id ) if check_ready : ready , _ = ray . wait ( [ object_id ] , timeout = 0 ) if ready : if self . _loop . get_debug ( ) : logger . debug ( "%s has been ready." , plain_object_id ) self . _complete_future ( fut ) return fut if plain_object_id not in self . _waiting_dict : linked_list = PlasmaObjectLinkedList ( self . _loop , plain_object_id ) linked_list . add_done_callback ( self . _unregister_callback ) self . _waiting_dict [ plain_object_id ] = linked_list self . _waiting_dict [ plain_object_id ] . append ( fut ) if self . _loop . get_debug ( ) : logger . debug ( "%s added to the waiting list." , fut ) return fut
Turn an object_id into a Future object.

        Args:
            object_id: A Ray's object_id.
            check_ready (bool): If true, check if the object_id is ready.

        Returns:
            PlasmaObjectFuture: A future object that waits the object_id.