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

# Local
from . import process_pb2 as process__pb2


class ProcessStub(object):
    """A Process running in Model-Train's Dynamic Workflow (DWF) must implement these APIs."""

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

        Args:
            channel: A grpc.Channel.
        """
        self.Run = channel.unary_unary(
            "/processproto.Process/Run",
            request_serializer=process__pb2.ProcessRequest.SerializeToString,
            response_deserializer=process__pb2.ProcessResponse.FromString,
        )


class ProcessServicer(object):
    """A Process running in Model-Train's Dynamic Workflow (DWF) must implement these APIs."""

    def Run(self, request, context):
        """Upon receiving a training job, Run() will be called once it is the current process' turn to execute"""
        context.set_code(grpc.StatusCode.UNIMPLEMENTED)
        context.set_details("Method not implemented!")
        raise NotImplementedError("Method not implemented!")


def add_ProcessServicer_to_server(servicer, server):
    rpc_method_handlers = {
        "Run": grpc.unary_unary_rpc_method_handler(
            servicer.Run,
            request_deserializer=process__pb2.ProcessRequest.FromString,
            response_serializer=process__pb2.ProcessResponse.SerializeToString,
        ),
    }
    generic_handler = grpc.method_handlers_generic_handler(
        "processproto.Process", rpc_method_handlers
    )
    server.add_generic_rpc_handlers((generic_handler,))


# This class is part of an EXPERIMENTAL API.
class Process(object):
    """A Process running in Model-Train's Dynamic Workflow (DWF) must implement these APIs."""

    @staticmethod
    def Run(
        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,
            "/processproto.Process/Run",
            process__pb2.ProcessRequest.SerializeToString,
            process__pb2.ProcessResponse.FromString,
            options,
            channel_credentials,
            insecure,
            call_credentials,
            compression,
            wait_for_ready,
            timeout,
            metadata,
        )
