# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
import warnings

from skytorch.torch.server import service_pb2 as skytorch_dot_torch_dot_server_dot_service__pb2

GRPC_GENERATED_VERSION = '1.78.0'
GRPC_VERSION = grpc.__version__
_version_not_supported = False

try:
    from grpc._utilities import first_version_is_lower
    _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
except ImportError:
    _version_not_supported = True

if _version_not_supported:
    raise RuntimeError(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + ' but the generated code in skytorch/torch/server/service_pb2_grpc.py depends on'
        + f' grpcio>={GRPC_GENERATED_VERSION}.'
        + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
        + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
    )


class ServiceStub(object):
    """Tensor management service for SkyTorch PyTorch backend
    """

    def __init__(self, channel):
        """Constructor.

        Args:
            channel: A grpc.Channel.
        """
        self.UpdateTensor = channel.stream_unary(
                '/skytorch.torch.Service/UpdateTensor',
                request_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorChunk.SerializeToString,
                response_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorResponse.FromString,
                _registered_method=True)
        self.GetTensor = channel.unary_stream(
                '/skytorch.torch.Service/GetTensor',
                request_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.GetTensorRequest.SerializeToString,
                response_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorChunk.FromString,
                _registered_method=True)
        self.CopyTensor = channel.unary_unary(
                '/skytorch.torch.Service/CopyTensor',
                request_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.CopyTensorRequest.SerializeToString,
                response_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorResponse.FromString,
                _registered_method=True)
        self.DeleteTensors = channel.unary_unary(
                '/skytorch.torch.Service/DeleteTensors',
                request_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.DeleteTensorsRequest.SerializeToString,
                response_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorResponse.FromString,
                _registered_method=True)
        self.ExecuteAtenOperation = channel.unary_unary(
                '/skytorch.torch.Service/ExecuteAtenOperation',
                request_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteAtenRequest.SerializeToString,
                response_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteAtenResponse.FromString,
                _registered_method=True)
        self.StreamOperations = channel.stream_stream(
                '/skytorch.torch.Service/StreamOperations',
                request_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.StreamRequest.SerializeToString,
                response_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.StreamResponse.FromString,
                _registered_method=True)
        self.ExecuteFunction = channel.unary_stream(
                '/skytorch.torch.Service/ExecuteFunction',
                request_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteFunctionRequest.SerializeToString,
                response_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteFunctionEvent.FromString,
                _registered_method=True)


class ServiceServicer(object):
    """Tensor management service for SkyTorch PyTorch backend
    """

    def UpdateTensor(self, request_iterator, context):
        """Tensor lifecycle management
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetTensor(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def CopyTensor(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def DeleteTensors(self, request, context):
        """Missing associated documentation comment in .proto file."""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ExecuteAtenOperation(self, request, context):
        """ATen operation execution
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def StreamOperations(self, request_iterator, context):
        """Bidirectional streaming for low-latency operations
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def ExecuteFunction(self, request, context):
        """Execute a function on the server
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'UpdateTensor': grpc.stream_unary_rpc_method_handler(
                    servicer.UpdateTensor,
                    request_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorChunk.FromString,
                    response_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorResponse.SerializeToString,
            ),
            'GetTensor': grpc.unary_stream_rpc_method_handler(
                    servicer.GetTensor,
                    request_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.GetTensorRequest.FromString,
                    response_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorChunk.SerializeToString,
            ),
            'CopyTensor': grpc.unary_unary_rpc_method_handler(
                    servicer.CopyTensor,
                    request_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.CopyTensorRequest.FromString,
                    response_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorResponse.SerializeToString,
            ),
            'DeleteTensors': grpc.unary_unary_rpc_method_handler(
                    servicer.DeleteTensors,
                    request_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.DeleteTensorsRequest.FromString,
                    response_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.TensorResponse.SerializeToString,
            ),
            'ExecuteAtenOperation': grpc.unary_unary_rpc_method_handler(
                    servicer.ExecuteAtenOperation,
                    request_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteAtenRequest.FromString,
                    response_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteAtenResponse.SerializeToString,
            ),
            'StreamOperations': grpc.stream_stream_rpc_method_handler(
                    servicer.StreamOperations,
                    request_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.StreamRequest.FromString,
                    response_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.StreamResponse.SerializeToString,
            ),
            'ExecuteFunction': grpc.unary_stream_rpc_method_handler(
                    servicer.ExecuteFunction,
                    request_deserializer=skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteFunctionRequest.FromString,
                    response_serializer=skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteFunctionEvent.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'skytorch.torch.Service', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('skytorch.torch.Service', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class Service(object):
    """Tensor management service for SkyTorch PyTorch backend
    """

    @staticmethod
    def UpdateTensor(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_unary(
            request_iterator,
            target,
            '/skytorch.torch.Service/UpdateTensor',
            skytorch_dot_torch_dot_server_dot_service__pb2.TensorChunk.SerializeToString,
            skytorch_dot_torch_dot_server_dot_service__pb2.TensorResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def GetTensor(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/skytorch.torch.Service/GetTensor',
            skytorch_dot_torch_dot_server_dot_service__pb2.GetTensorRequest.SerializeToString,
            skytorch_dot_torch_dot_server_dot_service__pb2.TensorChunk.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def CopyTensor(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/skytorch.torch.Service/CopyTensor',
            skytorch_dot_torch_dot_server_dot_service__pb2.CopyTensorRequest.SerializeToString,
            skytorch_dot_torch_dot_server_dot_service__pb2.TensorResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def DeleteTensors(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/skytorch.torch.Service/DeleteTensors',
            skytorch_dot_torch_dot_server_dot_service__pb2.DeleteTensorsRequest.SerializeToString,
            skytorch_dot_torch_dot_server_dot_service__pb2.TensorResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ExecuteAtenOperation(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_unary(
            request,
            target,
            '/skytorch.torch.Service/ExecuteAtenOperation',
            skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteAtenRequest.SerializeToString,
            skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteAtenResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def StreamOperations(request_iterator,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.stream_stream(
            request_iterator,
            target,
            '/skytorch.torch.Service/StreamOperations',
            skytorch_dot_torch_dot_server_dot_service__pb2.StreamRequest.SerializeToString,
            skytorch_dot_torch_dot_server_dot_service__pb2.StreamResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ExecuteFunction(request,
            target,
            options=(),
            channel_credentials=None,
            call_credentials=None,
            insecure=False,
            compression=None,
            wait_for_ready=None,
            timeout=None,
            metadata=None):
        return grpc.experimental.unary_stream(
            request,
            target,
            '/skytorch.torch.Service/ExecuteFunction',
            skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteFunctionRequest.SerializeToString,
            skytorch_dot_torch_dot_server_dot_service__pb2.ExecuteFunctionEvent.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
