def _wait_and_maybe_error(self): self._status_available_event.wait() if self._status is RemoteValueStatus.ABORTED: raise errors.CancelledError( None, None, "The corresponding function is aborted. Please reschedule the " "function.") if self._error is not None: raise self._error
def fetch(self): self._status_available_event.wait() if self._status is RemoteValueStatus.ABORTED: raise errors.CancelledError( None, None, "The corresponding function is aborted. Please reschedule the " "function.") if self._error is not None: raise self._error if self._fetched_numpys is None: self._fetched_numpys = nest.map_structure( lambda x: x.numpy() if hasattr(x, "numpy") else x, self._values) return self._fetched_numpys