# 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 . import dispatcher_pb2 as dispatcher__pb2

GRPC_GENERATED_VERSION = '1.64.1'
GRPC_VERSION = grpc.__version__
EXPECTED_ERROR_RELEASE = '1.65.0'
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
_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:
    warnings.warn(
        f'The grpc package installed is at version {GRPC_VERSION},'
        + f' but the generated code in dispatcher_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}.'
        + f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
        + f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
        RuntimeWarning
    )


class DispatcherStub(object):
    """Missing associated documentation comment in .proto file."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.Register = channel.unary_unary(
                '/Dispatcher/Register',
                request_serializer=dispatcher__pb2.WorkerRegisterRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.WorkerRegisterResponse.FromString,
                _registered_method=True)
        self.Listen = channel.unary_stream(
                '/Dispatcher/Listen',
                request_serializer=dispatcher__pb2.WorkerListenRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.AssignedAction.FromString,
                _registered_method=True)
        self.ListenV2 = channel.unary_stream(
                '/Dispatcher/ListenV2',
                request_serializer=dispatcher__pb2.WorkerListenRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.AssignedAction.FromString,
                _registered_method=True)
        self.Heartbeat = channel.unary_unary(
                '/Dispatcher/Heartbeat',
                request_serializer=dispatcher__pb2.HeartbeatRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.HeartbeatResponse.FromString,
                _registered_method=True)
        self.SubscribeToWorkflowEvents = channel.unary_stream(
                '/Dispatcher/SubscribeToWorkflowEvents',
                request_serializer=dispatcher__pb2.SubscribeToWorkflowEventsRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.WorkflowEvent.FromString,
                _registered_method=True)
        self.SubscribeToWorkflowRuns = channel.stream_stream(
                '/Dispatcher/SubscribeToWorkflowRuns',
                request_serializer=dispatcher__pb2.SubscribeToWorkflowRunsRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.WorkflowRunEvent.FromString,
                _registered_method=True)
        self.SendStepActionEvent = channel.unary_unary(
                '/Dispatcher/SendStepActionEvent',
                request_serializer=dispatcher__pb2.StepActionEvent.SerializeToString,
                response_deserializer=dispatcher__pb2.ActionEventResponse.FromString,
                _registered_method=True)
        self.SendGroupKeyActionEvent = channel.unary_unary(
                '/Dispatcher/SendGroupKeyActionEvent',
                request_serializer=dispatcher__pb2.GroupKeyActionEvent.SerializeToString,
                response_deserializer=dispatcher__pb2.ActionEventResponse.FromString,
                _registered_method=True)
        self.PutOverridesData = channel.unary_unary(
                '/Dispatcher/PutOverridesData',
                request_serializer=dispatcher__pb2.OverridesData.SerializeToString,
                response_deserializer=dispatcher__pb2.OverridesDataResponse.FromString,
                _registered_method=True)
        self.Unsubscribe = channel.unary_unary(
                '/Dispatcher/Unsubscribe',
                request_serializer=dispatcher__pb2.WorkerUnsubscribeRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.WorkerUnsubscribeResponse.FromString,
                _registered_method=True)
        self.RefreshTimeout = channel.unary_unary(
                '/Dispatcher/RefreshTimeout',
                request_serializer=dispatcher__pb2.RefreshTimeoutRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.RefreshTimeoutResponse.FromString,
                _registered_method=True)
        self.ReleaseSlot = channel.unary_unary(
                '/Dispatcher/ReleaseSlot',
                request_serializer=dispatcher__pb2.ReleaseSlotRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.ReleaseSlotResponse.FromString,
                _registered_method=True)
        self.UpsertWorkerLabels = channel.unary_unary(
                '/Dispatcher/UpsertWorkerLabels',
                request_serializer=dispatcher__pb2.UpsertWorkerLabelsRequest.SerializeToString,
                response_deserializer=dispatcher__pb2.UpsertWorkerLabelsResponse.FromString,
                _registered_method=True)


class DispatcherServicer(object):
    """Missing associated documentation comment in .proto file."""

    def Register(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 Listen(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 ListenV2(self, request, context):
        """ListenV2 is like listen, but implementation does not include heartbeats. This should only used by SDKs
        against engine version v0.18.1+
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Heartbeat(self, request, context):
        """Heartbeat is a method for workers to send heartbeats to the dispatcher
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def SubscribeToWorkflowEvents(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 SubscribeToWorkflowRuns(self, request_iterator, 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 SendStepActionEvent(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 SendGroupKeyActionEvent(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 PutOverridesData(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 Unsubscribe(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 RefreshTimeout(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 ReleaseSlot(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 UpsertWorkerLabels(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 add_DispatcherServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'Register': grpc.unary_unary_rpc_method_handler(
                    servicer.Register,
                    request_deserializer=dispatcher__pb2.WorkerRegisterRequest.FromString,
                    response_serializer=dispatcher__pb2.WorkerRegisterResponse.SerializeToString,
            ),
            'Listen': grpc.unary_stream_rpc_method_handler(
                    servicer.Listen,
                    request_deserializer=dispatcher__pb2.WorkerListenRequest.FromString,
                    response_serializer=dispatcher__pb2.AssignedAction.SerializeToString,
            ),
            'ListenV2': grpc.unary_stream_rpc_method_handler(
                    servicer.ListenV2,
                    request_deserializer=dispatcher__pb2.WorkerListenRequest.FromString,
                    response_serializer=dispatcher__pb2.AssignedAction.SerializeToString,
            ),
            'Heartbeat': grpc.unary_unary_rpc_method_handler(
                    servicer.Heartbeat,
                    request_deserializer=dispatcher__pb2.HeartbeatRequest.FromString,
                    response_serializer=dispatcher__pb2.HeartbeatResponse.SerializeToString,
            ),
            'SubscribeToWorkflowEvents': grpc.unary_stream_rpc_method_handler(
                    servicer.SubscribeToWorkflowEvents,
                    request_deserializer=dispatcher__pb2.SubscribeToWorkflowEventsRequest.FromString,
                    response_serializer=dispatcher__pb2.WorkflowEvent.SerializeToString,
            ),
            'SubscribeToWorkflowRuns': grpc.stream_stream_rpc_method_handler(
                    servicer.SubscribeToWorkflowRuns,
                    request_deserializer=dispatcher__pb2.SubscribeToWorkflowRunsRequest.FromString,
                    response_serializer=dispatcher__pb2.WorkflowRunEvent.SerializeToString,
            ),
            'SendStepActionEvent': grpc.unary_unary_rpc_method_handler(
                    servicer.SendStepActionEvent,
                    request_deserializer=dispatcher__pb2.StepActionEvent.FromString,
                    response_serializer=dispatcher__pb2.ActionEventResponse.SerializeToString,
            ),
            'SendGroupKeyActionEvent': grpc.unary_unary_rpc_method_handler(
                    servicer.SendGroupKeyActionEvent,
                    request_deserializer=dispatcher__pb2.GroupKeyActionEvent.FromString,
                    response_serializer=dispatcher__pb2.ActionEventResponse.SerializeToString,
            ),
            'PutOverridesData': grpc.unary_unary_rpc_method_handler(
                    servicer.PutOverridesData,
                    request_deserializer=dispatcher__pb2.OverridesData.FromString,
                    response_serializer=dispatcher__pb2.OverridesDataResponse.SerializeToString,
            ),
            'Unsubscribe': grpc.unary_unary_rpc_method_handler(
                    servicer.Unsubscribe,
                    request_deserializer=dispatcher__pb2.WorkerUnsubscribeRequest.FromString,
                    response_serializer=dispatcher__pb2.WorkerUnsubscribeResponse.SerializeToString,
            ),
            'RefreshTimeout': grpc.unary_unary_rpc_method_handler(
                    servicer.RefreshTimeout,
                    request_deserializer=dispatcher__pb2.RefreshTimeoutRequest.FromString,
                    response_serializer=dispatcher__pb2.RefreshTimeoutResponse.SerializeToString,
            ),
            'ReleaseSlot': grpc.unary_unary_rpc_method_handler(
                    servicer.ReleaseSlot,
                    request_deserializer=dispatcher__pb2.ReleaseSlotRequest.FromString,
                    response_serializer=dispatcher__pb2.ReleaseSlotResponse.SerializeToString,
            ),
            'UpsertWorkerLabels': grpc.unary_unary_rpc_method_handler(
                    servicer.UpsertWorkerLabels,
                    request_deserializer=dispatcher__pb2.UpsertWorkerLabelsRequest.FromString,
                    response_serializer=dispatcher__pb2.UpsertWorkerLabelsResponse.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'Dispatcher', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))
    server.add_registered_method_handlers('Dispatcher', rpc_method_handlers)


 # This class is part of an EXPERIMENTAL API.
class Dispatcher(object):
    """Missing associated documentation comment in .proto file."""

    @staticmethod
    def Register(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,
            '/Dispatcher/Register',
            dispatcher__pb2.WorkerRegisterRequest.SerializeToString,
            dispatcher__pb2.WorkerRegisterResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Listen(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,
            '/Dispatcher/Listen',
            dispatcher__pb2.WorkerListenRequest.SerializeToString,
            dispatcher__pb2.AssignedAction.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ListenV2(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,
            '/Dispatcher/ListenV2',
            dispatcher__pb2.WorkerListenRequest.SerializeToString,
            dispatcher__pb2.AssignedAction.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,
            '/Dispatcher/Heartbeat',
            dispatcher__pb2.HeartbeatRequest.SerializeToString,
            dispatcher__pb2.HeartbeatResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SubscribeToWorkflowEvents(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,
            '/Dispatcher/SubscribeToWorkflowEvents',
            dispatcher__pb2.SubscribeToWorkflowEventsRequest.SerializeToString,
            dispatcher__pb2.WorkflowEvent.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SubscribeToWorkflowRuns(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,
            '/Dispatcher/SubscribeToWorkflowRuns',
            dispatcher__pb2.SubscribeToWorkflowRunsRequest.SerializeToString,
            dispatcher__pb2.WorkflowRunEvent.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SendStepActionEvent(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,
            '/Dispatcher/SendStepActionEvent',
            dispatcher__pb2.StepActionEvent.SerializeToString,
            dispatcher__pb2.ActionEventResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def SendGroupKeyActionEvent(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,
            '/Dispatcher/SendGroupKeyActionEvent',
            dispatcher__pb2.GroupKeyActionEvent.SerializeToString,
            dispatcher__pb2.ActionEventResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def PutOverridesData(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,
            '/Dispatcher/PutOverridesData',
            dispatcher__pb2.OverridesData.SerializeToString,
            dispatcher__pb2.OverridesDataResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def Unsubscribe(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,
            '/Dispatcher/Unsubscribe',
            dispatcher__pb2.WorkerUnsubscribeRequest.SerializeToString,
            dispatcher__pb2.WorkerUnsubscribeResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def RefreshTimeout(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,
            '/Dispatcher/RefreshTimeout',
            dispatcher__pb2.RefreshTimeoutRequest.SerializeToString,
            dispatcher__pb2.RefreshTimeoutResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def ReleaseSlot(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,
            '/Dispatcher/ReleaseSlot',
            dispatcher__pb2.ReleaseSlotRequest.SerializeToString,
            dispatcher__pb2.ReleaseSlotResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)

    @staticmethod
    def UpsertWorkerLabels(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,
            '/Dispatcher/UpsertWorkerLabels',
            dispatcher__pb2.UpsertWorkerLabelsRequest.SerializeToString,
            dispatcher__pb2.UpsertWorkerLabelsResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
            _registered_method=True)
