def _get_or_create_blob_sequence(self): request = write_service_pb2.GetOrCreateBlobSequenceRequest( experiment_id=self._experiment_id, run=self._run_name, tag=self._value.tag, step=self._event.step, final_sequence_length=len(self._blobs), metadata=self._metadata, ) util.set_timestamp(request.wall_time, self._event.wall_time) with _request_logger(request): try: # TODO(@nfelt): execute this RPC asynchronously. response = grpc_util.call_with_retries( self._api.GetOrCreateBlobSequence, request ) blob_sequence_id = response.blob_sequence_id except grpc.RpcError as e: if e.code() == grpc.StatusCode.NOT_FOUND: raise ExperimentNotFoundError() logger.error("Upload call failed with error %s", e) # TODO(soergel): clean up raise return blob_sequence_id
def testGetOrCreateBlobSequence(self): self._stub.GetOrCreateBlobSequence( write_service_pb2.GetOrCreateBlobSequenceRequest())