示例#1
0
    def __init__(self,
                 service_name,
                 host_name=None,
                 endpoint=None,
                 client=None,
                 transport=sync.SyncTransport):
        self.transport = transport(self)
        self.endpoint = DEFAULT_ENDPOINT if endpoint is None else endpoint

        if client is None:
            self.channel = grpc.insecure_channel(self.endpoint)
            self.client = trace_service_pb2_grpc.TraceServiceStub(
                channel=self.channel)
        else:
            self.client = client

        self.service_name = service_name
        self.node = ocagent_utils.get_node(self.service_name, host_name)
 def __init__(self, client, service_name, host_name=None):
     self._initialized = False
     self._initial_request = None
     self._rpc = bidi.BidiRpc(client.Export, lambda: self._initial_request)
     self._node = utils.get_node(service_name, host_name)
     self._resource = _get_resource()