當前位置: 首頁>>代碼示例>>Python>>正文


Python grpc.html方法代碼示例

本文整理匯總了Python中grpc.html方法的典型用法代碼示例。如果您正苦於以下問題:Python grpc.html方法的具體用法?Python grpc.html怎麽用?Python grpc.html使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在grpc的用法示例。


在下文中一共展示了grpc.html方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _trace_result

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import html [as 別名]
def _trace_result(self, guarded_span, rpc_info, result):
        # If the RPC is called asynchronously, release the guard and add a callback
        # so that the span can be finished once the future is done.
        if isinstance(result, grpc.Future):
            result.add_done_callback(
                _make_future_done_callback(guarded_span.release(
                ), rpc_info, self._log_payloads, self._span_decorator))
            return result
        response = result
        # Handle the case when the RPC is initiated via the with_call
        # method and the result is a tuple with the first element as the
        # response.
        # http://www.grpc.io/grpc/python/grpc.html#grpc.UnaryUnaryMultiCallable.with_call
        if isinstance(result, tuple):
            response = result[0]
        rpc_info.response = response
        if self._log_payloads:
            guarded_span.span.log_kv({'response': response})
        if self._span_decorator is not None:
            self._span_decorator(guarded_span.span, rpc_info)
        return result 
開發者ID:opentracing-contrib,項目名稱:python-grpc,代碼行數:23,代碼來源:_client.py

示例2: _trace_result

# 需要導入模塊: import grpc [as 別名]
# 或者: from grpc import html [as 別名]
def _trace_result(self, guarded_span, rpc_info, result):
        # If the RPC is called asynchronously, release the guard and add a
        # callback so that the span can be finished once the future is done.
        if isinstance(result, grpc.Future):
            result.add_done_callback(
                _make_future_done_callback(guarded_span.release(), rpc_info)
            )
            return result
        response = result
        # Handle the case when the RPC is initiated via the with_call
        # method and the result is a tuple with the first element as the
        # response.
        # http://www.grpc.io/grpc/python/grpc.html#grpc.UnaryUnaryMultiCallable.with_call
        if isinstance(result, tuple):
            response = result[0]
        rpc_info.response = response
        return result 
開發者ID:open-telemetry,項目名稱:opentelemetry-python,代碼行數:19,代碼來源:_client.py


注:本文中的grpc.html方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。