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

from cogment.api import common_pb2 as cogment_dot_api_dot_common__pb2
from cogment.api import orchestrator_pb2 as cogment_dot_api_dot_orchestrator__pb2


class TrialLifecycleSPStub(object):
    """This service is used to manage Trial lifecycle.
    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.StartTrial = channel.unary_unary(
                '/cogmentAPI.TrialLifecycleSP/StartTrial',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialStartRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialStartReply.FromString,
                )
        self.TerminateTrial = channel.unary_unary(
                '/cogmentAPI.TrialLifecycleSP/TerminateTrial',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TerminateTrialRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TerminateTrialReply.FromString,
                )
        self.GetTrialInfo = channel.unary_unary(
                '/cogmentAPI.TrialLifecycleSP/GetTrialInfo',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialInfoRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialInfoReply.FromString,
                )
        self.WatchTrials = channel.unary_stream(
                '/cogmentAPI.TrialLifecycleSP/WatchTrials',
                request_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialListRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialListEntry.FromString,
                )
        self.Version = channel.unary_unary(
                '/cogmentAPI.TrialLifecycleSP/Version',
                request_serializer=cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
                )


class TrialLifecycleSPServicer(object):
    """This service is used to manage Trial lifecycle.
    """

    def StartTrial(self, request, context):
        """Begin a new trial.
        Expected headers: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def TerminateTrial(self, request, context):
        """Terminate existing trial(s).
        Expected headers: 
        - trial-id <one or more>
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def GetTrialInfo(self, request, context):
        """Get extra information about a specific trial.
        Expected headers: 
        - trial-id <zero or more>
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def WatchTrials(self, request, context):
        """Get information about the trials currently running in the orchestrator.
        The stream will start with all trials that match the filter.
        After that, it will contain a new message whenever a trial enters a filtered state.
        Expected headers: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Version(self, request, context):
        """Expected headers: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_TrialLifecycleSPServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'StartTrial': grpc.unary_unary_rpc_method_handler(
                    servicer.StartTrial,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialStartRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialStartReply.SerializeToString,
            ),
            'TerminateTrial': grpc.unary_unary_rpc_method_handler(
                    servicer.TerminateTrial,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TerminateTrialRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TerminateTrialReply.SerializeToString,
            ),
            'GetTrialInfo': grpc.unary_unary_rpc_method_handler(
                    servicer.GetTrialInfo,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialInfoRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialInfoReply.SerializeToString,
            ),
            'WatchTrials': grpc.unary_stream_rpc_method_handler(
                    servicer.WatchTrials,
                    request_deserializer=cogment_dot_api_dot_orchestrator__pb2.TrialListRequest.FromString,
                    response_serializer=cogment_dot_api_dot_orchestrator__pb2.TrialListEntry.SerializeToString,
            ),
            'Version': grpc.unary_unary_rpc_method_handler(
                    servicer.Version,
                    request_deserializer=cogment_dot_api_dot_common__pb2.VersionRequest.FromString,
                    response_serializer=cogment_dot_api_dot_common__pb2.VersionInfo.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'cogmentAPI.TrialLifecycleSP', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class TrialLifecycleSP(object):
    """This service is used to manage Trial lifecycle.
    """

    @staticmethod
    def StartTrial(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, '/cogmentAPI.TrialLifecycleSP/StartTrial',
            cogment_dot_api_dot_orchestrator__pb2.TrialStartRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialStartReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def TerminateTrial(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, '/cogmentAPI.TrialLifecycleSP/TerminateTrial',
            cogment_dot_api_dot_orchestrator__pb2.TerminateTrialRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TerminateTrialReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def GetTrialInfo(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, '/cogmentAPI.TrialLifecycleSP/GetTrialInfo',
            cogment_dot_api_dot_orchestrator__pb2.TrialInfoRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialInfoReply.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def WatchTrials(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, '/cogmentAPI.TrialLifecycleSP/WatchTrials',
            cogment_dot_api_dot_orchestrator__pb2.TrialListRequest.SerializeToString,
            cogment_dot_api_dot_orchestrator__pb2.TrialListEntry.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Version(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, '/cogmentAPI.TrialLifecycleSP/Version',
            cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
            cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)


class ClientActorSPStub(object):
    """----------------------------------------------------------------------------------------------------------

    """

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

        Args:
            channel: A grpc.Channel.
        """
        self.RunTrial = channel.stream_stream(
                '/cogmentAPI.ClientActorSP/RunTrial',
                request_serializer=cogment_dot_api_dot_common__pb2.ActorRunTrialOutput.SerializeToString,
                response_deserializer=cogment_dot_api_dot_common__pb2.ActorRunTrialInput.FromString,
                )
        self.Version = channel.unary_unary(
                '/cogmentAPI.ClientActorSP/Version',
                request_serializer=cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
                response_deserializer=cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
                )


class ClientActorSPServicer(object):
    """----------------------------------------------------------------------------------------------------------

    """

    def RunTrial(self, request_iterator, context):
        """Expected metadata:
        - trial-id: The id of the trial
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')

    def Version(self, request, context):
        """Expected metadata: None
        """
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details('Method not implemented!')
        raise NotImplementedError('Method not implemented!')


def add_ClientActorSPServicer_to_server(servicer, server):
    rpc_method_handlers = {
            'RunTrial': grpc.stream_stream_rpc_method_handler(
                    servicer.RunTrial,
                    request_deserializer=cogment_dot_api_dot_common__pb2.ActorRunTrialOutput.FromString,
                    response_serializer=cogment_dot_api_dot_common__pb2.ActorRunTrialInput.SerializeToString,
            ),
            'Version': grpc.unary_unary_rpc_method_handler(
                    servicer.Version,
                    request_deserializer=cogment_dot_api_dot_common__pb2.VersionRequest.FromString,
                    response_serializer=cogment_dot_api_dot_common__pb2.VersionInfo.SerializeToString,
            ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
            'cogmentAPI.ClientActorSP', rpc_method_handlers)
    server.add_generic_rpc_handlers((generic_handler,))


 # This class is part of an EXPERIMENTAL API.
class ClientActorSP(object):
    """----------------------------------------------------------------------------------------------------------

    """

    @staticmethod
    def RunTrial(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, '/cogmentAPI.ClientActorSP/RunTrial',
            cogment_dot_api_dot_common__pb2.ActorRunTrialOutput.SerializeToString,
            cogment_dot_api_dot_common__pb2.ActorRunTrialInput.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

    @staticmethod
    def Version(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, '/cogmentAPI.ClientActorSP/Version',
            cogment_dot_api_dot_common__pb2.VersionRequest.SerializeToString,
            cogment_dot_api_dot_common__pb2.VersionInfo.FromString,
            options, channel_credentials,
            insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
