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

from mlrunx.v1 import ingest_pb2 as mlrunx_dot_v1_dot_ingest__pb2


class IngestServiceStub(object):
    """=============================================================================
    Ingest Service
    =============================================================================

    IngestService handles data ingestion from ML training jobs.
    See: /docs/spec/ingest.md
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.InitRun = channel.unary_unary(
                '/mlrunx.v1.IngestService/InitRun',
                request_serializer=mlrunx_dot_v1_dot_ingest__pb2.InitRunRequest.SerializeToString,
                response_deserializer=mlrunx_dot_v1_dot_ingest__pb2.InitRunResponse.FromString,
                _registered_method=True)
        self.LogMetrics = channel.unary_unary(
                '/mlrunx.v1.IngestService/LogMetrics',
                request_serializer=mlrunx_dot_v1_dot_ingest__pb2.LogMetricsRequest.SerializeToString,
                response_deserializer=mlrunx_dot_v1_dot_ingest__pb2.LogMetricsResponse.FromString,
                _registered_method=True)
        self.LogMetricsStream = channel.stream_stream(
                '/mlrunx.v1.IngestService/LogMetricsStream',
                request_serializer=mlrunx_dot_v1_dot_ingest__pb2.LogMetricsStreamRequest.SerializeToString,
                response_deserializer=mlrunx_dot_v1_dot_ingest__pb2.LogMetricsStreamResponse.FromString,
                _registered_method=True)
        self.LogParams = channel.unary_unary(
                '/mlrunx.v1.IngestService/LogParams',
                request_serializer=mlrunx_dot_v1_dot_ingest__pb2.LogParamsRequest.SerializeToString,
                response_deserializer=mlrunx_dot_v1_dot_ingest__pb2.LogParamsResponse.FromString,
                _registered_method=True)
        self.LogTags = channel.unary_unary(
                '/mlrunx.v1.IngestService/LogTags',
                request_serializer=mlrunx_dot_v1_dot_ingest__pb2.LogTagsRequest.SerializeToString,
                response_deserializer=mlrunx_dot_v1_dot_ingest__pb2.LogTagsResponse.FromString,
                _registered_method=True)
        self.CreateArtifactUpload = channel.unary_unary(
                '/mlrunx.v1.IngestService/CreateArtifactUpload',
                request_serializer=mlrunx_dot_v1_dot_ingest__pb2.CreateArtifactUploadRequest.SerializeToString,
                response_deserializer=mlrunx_dot_v1_dot_ingest__pb2.CreateArtifactUploadResponse.FromString,
                _registered_method=True)
        self.FinalizeArtifactUpload = channel.unary_unary(
                '/mlrunx.v1.IngestService/FinalizeArtifactUpload',
                request_serializer=mlrunx_dot_v1_dot_ingest__pb2.FinalizeArtifactUploadRequest.SerializeToString,
                response_deserializer=mlrunx_dot_v1_dot_ingest__pb2.FinalizeArtifactUploadResponse.FromString,
                _registered_method=True)
        self.Heartbeat = channel.unary_unary(
                '/mlrunx.v1.IngestService/Heartbeat',
                request_serializer=mlrunx_dot_v1_dot_ingest__pb2.HeartbeatRequest.SerializeToString,
                response_deserializer=mlrunx_dot_v1_dot_ingest__pb2.HeartbeatResponse.FromString,
                _registered_method=True)
        self.FinishRun = channel.unary_unary(
                '/mlrunx.v1.IngestService/FinishRun',
                request_serializer=mlrunx_dot_v1_dot_ingest__pb2.FinishRunRequest.SerializeToString,
                response_deserializer=mlrunx_dot_v1_dot_ingest__pb2.FinishRunResponse.FromString,
                _registered_method=True)


class IngestServiceServicer(object):
    """=============================================================================
    Ingest Service
    =============================================================================

    IngestService handles data ingestion from ML training jobs.
    See: /docs/spec/ingest.md
    """

    def InitRun(self, request, context):
        """Initialize a new run. Must be called before logging data.
        Idempotent: repeated calls with same run_id return existing run.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def LogMetrics(self, request, context):
        """Log a batch of metrics. Supports streaming for high-throughput.
        See: /docs/spec/ingest.md#idempotency-keys
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def LogMetricsStream(self, request_iterator, context):
        """Log metrics as a bidirectional stream for maximum throughput.
        Client sends batches, server acknowledges with batch_ids.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def LogParams(self, request, context):
        """Log parameters (hyperparameters, config). Idempotent per name.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def LogTags(self, request, context):
        """Log or update tags. Tags can be modified throughout run lifecycle.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def CreateArtifactUpload(self, request, context):
        """Request a presigned URL for artifact upload.
        See: /docs/spec/ingest.md#artifact-presign-flow
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def FinalizeArtifactUpload(self, request, context):
        """Finalize an artifact upload after successful S3 upload.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Heartbeat(self, request, context):
        """Send heartbeat to indicate run is alive. Prevents crash detection.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def FinishRun(self, request, context):
        """Mark run as finished with final status.
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_IngestServiceServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'InitRun': grpc.unary_unary_rpc_method_handler(
                    servicer.InitRun,
                    request_deserializer=mlrunx_dot_v1_dot_ingest__pb2.InitRunRequest.FromString,
                    response_serializer=mlrunx_dot_v1_dot_ingest__pb2.InitRunResponse.SerializeToString,
            ),
            'LogMetrics': grpc.unary_unary_rpc_method_handler(
                    servicer.LogMetrics,
                    request_deserializer=mlrunx_dot_v1_dot_ingest__pb2.LogMetricsRequest.FromString,
                    response_serializer=mlrunx_dot_v1_dot_ingest__pb2.LogMetricsResponse.SerializeToString,
            ),
            'LogMetricsStream': grpc.stream_stream_rpc_method_handler(
                    servicer.LogMetricsStream,
                    request_deserializer=mlrunx_dot_v1_dot_ingest__pb2.LogMetricsStreamRequest.FromString,
                    response_serializer=mlrunx_dot_v1_dot_ingest__pb2.LogMetricsStreamResponse.SerializeToString,
            ),
            'LogParams': grpc.unary_unary_rpc_method_handler(
                    servicer.LogParams,
                    request_deserializer=mlrunx_dot_v1_dot_ingest__pb2.LogParamsRequest.FromString,
                    response_serializer=mlrunx_dot_v1_dot_ingest__pb2.LogParamsResponse.SerializeToString,
            ),
            'LogTags': grpc.unary_unary_rpc_method_handler(
                    servicer.LogTags,
                    request_deserializer=mlrunx_dot_v1_dot_ingest__pb2.LogTagsRequest.FromString,
                    response_serializer=mlrunx_dot_v1_dot_ingest__pb2.LogTagsResponse.SerializeToString,
            ),
            'CreateArtifactUpload': grpc.unary_unary_rpc_method_handler(
                    servicer.CreateArtifactUpload,
                    request_deserializer=mlrunx_dot_v1_dot_ingest__pb2.CreateArtifactUploadRequest.FromString,
                    response_serializer=mlrunx_dot_v1_dot_ingest__pb2.CreateArtifactUploadResponse.SerializeToString,
            ),
            'FinalizeArtifactUpload': grpc.unary_unary_rpc_method_handler(
                    servicer.FinalizeArtifactUpload,
                    request_deserializer=mlrunx_dot_v1_dot_ingest__pb2.FinalizeArtifactUploadRequest.FromString,
                    response_serializer=mlrunx_dot_v1_dot_ingest__pb2.FinalizeArtifactUploadResponse.SerializeToString,
            ),
            'Heartbeat': grpc.unary_unary_rpc_method_handler(
                    servicer.Heartbeat,
                    request_deserializer=mlrunx_dot_v1_dot_ingest__pb2.HeartbeatRequest.FromString,
                    response_serializer=mlrunx_dot_v1_dot_ingest__pb2.HeartbeatResponse.SerializeToString,
            ),
            'FinishRun': grpc.unary_unary_rpc_method_handler(
                    servicer.FinishRun,
                    request_deserializer=mlrunx_dot_v1_dot_ingest__pb2.FinishRunRequest.FromString,
                    response_serializer=mlrunx_dot_v1_dot_ingest__pb2.FinishRunResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'mlrunx.v1.IngestService', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('mlrunx.v1.IngestService', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class IngestService(object):
    """=============================================================================
    Ingest Service
    =============================================================================

    IngestService handles data ingestion from ML training jobs.
    See: /docs/spec/ingest.md
    """

    @staticmethod
    def InitRun(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,
            '/mlrunx.v1.IngestService/InitRun',
            mlrunx_dot_v1_dot_ingest__pb2.InitRunRequest.SerializeToString,
            mlrunx_dot_v1_dot_ingest__pb2.InitRunResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def LogMetrics(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,
            '/mlrunx.v1.IngestService/LogMetrics',
            mlrunx_dot_v1_dot_ingest__pb2.LogMetricsRequest.SerializeToString,
            mlrunx_dot_v1_dot_ingest__pb2.LogMetricsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def LogMetricsStream(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,
            '/mlrunx.v1.IngestService/LogMetricsStream',
            mlrunx_dot_v1_dot_ingest__pb2.LogMetricsStreamRequest.SerializeToString,
            mlrunx_dot_v1_dot_ingest__pb2.LogMetricsStreamResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def LogParams(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,
            '/mlrunx.v1.IngestService/LogParams',
            mlrunx_dot_v1_dot_ingest__pb2.LogParamsRequest.SerializeToString,
            mlrunx_dot_v1_dot_ingest__pb2.LogParamsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def LogTags(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,
            '/mlrunx.v1.IngestService/LogTags',
            mlrunx_dot_v1_dot_ingest__pb2.LogTagsRequest.SerializeToString,
            mlrunx_dot_v1_dot_ingest__pb2.LogTagsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def CreateArtifactUpload(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,
            '/mlrunx.v1.IngestService/CreateArtifactUpload',
            mlrunx_dot_v1_dot_ingest__pb2.CreateArtifactUploadRequest.SerializeToString,
            mlrunx_dot_v1_dot_ingest__pb2.CreateArtifactUploadResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def FinalizeArtifactUpload(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,
            '/mlrunx.v1.IngestService/FinalizeArtifactUpload',
            mlrunx_dot_v1_dot_ingest__pb2.FinalizeArtifactUploadRequest.SerializeToString,
            mlrunx_dot_v1_dot_ingest__pb2.FinalizeArtifactUploadResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Heartbeat(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,
            '/mlrunx.v1.IngestService/Heartbeat',
            mlrunx_dot_v1_dot_ingest__pb2.HeartbeatRequest.SerializeToString,
            mlrunx_dot_v1_dot_ingest__pb2.HeartbeatResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def FinishRun(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,
            '/mlrunx.v1.IngestService/FinishRun',
            mlrunx_dot_v1_dot_ingest__pb2.FinishRunRequest.SerializeToString,
            mlrunx_dot_v1_dot_ingest__pb2.FinishRunResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
