def __init__(self, addr, debug=False, out_dir=None, name=None):
        logger.info("Initializing TA2 Client with address: %s" % addr)
        self.addr = addr
        self.debug = debug
        if debug and out_dir is not None:
            self.out_dir = out_dir
        else:
            self.out_dir = ""
        self.name = name

        channel = grpc.insecure_channel(addr)
        self.serv = core_pb2_grpc.CoreStub(channel)
        logger.debug("Connected to server")
        # Send hello and parse response for ta2 defaults
        msg = core_pb2.HelloRequest()
        logger.debug("Formed hello request: %s" % str(msg))
        reply = self.serv.Hello(msg)
        logger.debug("Got Response to hello request: %s" % str(reply))
        self.user_agent = reply.user_agent
        self.version = reply.version
        self.supported_extensions = reply.supported_extensions
        self.allowed_values = reply.allowed_value_types
        logger.info("Connected to TA2 System, %s, using api version, %s" %
                    (self.user_agent, self.version))
        logger.debug("TA2 allowed values: %s" % str(self.allowed_values))
        logger.debug("TA2 supported extensions: %s" %
                     str(self.supported_extensions))

        self.search_solution_requests = {}
        self.fitted_solution_requests = {}
        self.produce_solution_requests = {}
Exemplo n.º 2
0
    def hello(self):
        request = core_pb2.HelloRequest()

        LOGGER.debug("%s: %s", request.__class__.__name__, request)

        response = self.stub.Hello(request)

        LOGGER.debug("%s: %s", response.__class__.__name__, response)

        return response
    def hello(self):
        """
        Ping the TA2 server and return the result

        """
        logger.info("Sending Hello to TA2 server, %s,  at: %s" %
                    (self.user_agent, self.addr))
        msg = core_pb2.HelloRequest()
        logger.debug("Formed hello request: %s" % str(msg))
        if self.debug:
            self.write_msg_to_file(msg, 'hello_request.json')
        reply = self.serv.Hello(msg)
        logger.debug("Got Response to hello request: %s" % str(reply))
        if self.debug:
            self.write_msg_to_file(reply, 'hello_response.json')
        return reply
Exemplo n.º 4
0
 def do_hello(self):
     self.core.Hello(pb_core.HelloRequest())
Exemplo n.º 5
0
def hello_request():
    request = core_pb2.HelloRequest()
    return request