1# Copyright 2019 The TensorFlow Authors. All Rights Reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14# ============================================================================== 15# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! 16# 17# Do not use pylint on generated code. 18# pylint: disable=missing-docstring,g-short-docstring-punctuation,g-no-space-after-docstring-summary,invalid-name,line-too-long,unused-argument,g-doc-args 19import grpc 20 21from tensorflow.core.profiler import profiler_analysis_pb2 as third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 22 23 24class ProfileAnalysisStub(object): 25 """////////////////////////////////////////////////////////////////////////////// 26 27 ProfileAnalysis service provide entry point for profiling TPU and for 28 serving profiled data to Tensorboard through GRPC 29 ////////////////////////////////////////////////////////////////////////////// 30 """ 31 32 def __init__(self, channel): 33 """Constructor. 34 35 Args: 36 channel: A grpc.Channel. 37 """ 38 self.NewSession = channel.unary_unary( 39 '/tensorflow.ProfileAnalysis/NewSession', 40 request_serializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 41 .NewProfileSessionRequest.SerializeToString, 42 response_deserializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 43 .NewProfileSessionResponse.FromString, 44 ) 45 self.EnumSessions = channel.unary_unary( 46 '/tensorflow.ProfileAnalysis/EnumSessions', 47 request_serializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 48 .EnumProfileSessionsAndToolsRequest.SerializeToString, 49 response_deserializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 50 .EnumProfileSessionsAndToolsResponse.FromString, 51 ) 52 self.GetSessionToolData = channel.unary_unary( 53 '/tensorflow.ProfileAnalysis/GetSessionToolData', 54 request_serializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 55 .ProfileSessionDataRequest.SerializeToString, 56 response_deserializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 57 .ProfileSessionDataResponse.FromString, 58 ) 59 60 61class ProfileAnalysisServicer(object): 62 """////////////////////////////////////////////////////////////////////////////// 63 64 ProfileAnalysis service provide entry point for profiling TPU and for 65 serving profiled data to Tensorboard through GRPC 66 ////////////////////////////////////////////////////////////////////////////// 67 """ 68 69 def NewSession(self, request, context): 70 """Starts a profiling session, blocks until it completes. 71 72 TPUProfileAnalysis service delegate this to TPUProfiler service. 73 Populate the profiled data in repository, then return status to caller. 74 """ 75 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 76 context.set_details('Method not implemented!') 77 raise NotImplementedError('Method not implemented!') 78 79 def EnumSessions(self, request, context): 80 """Enumerate existing sessions and return available profile tools.""" 81 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 82 context.set_details('Method not implemented!') 83 raise NotImplementedError('Method not implemented!') 84 85 def GetSessionToolData(self, request, context): 86 """Retrieve specific tool's data for specific session.""" 87 context.set_code(grpc.StatusCode.UNIMPLEMENTED) 88 context.set_details('Method not implemented!') 89 raise NotImplementedError('Method not implemented!') 90 91 92def add_ProfileAnalysisServicer_to_server(servicer, server): 93 rpc_method_handlers = { 94 'NewSession': 95 grpc.unary_unary_rpc_method_handler( 96 servicer.NewSession, 97 request_deserializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 98 .NewProfileSessionRequest.FromString, 99 response_serializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 100 .NewProfileSessionResponse.SerializeToString, 101 ), 102 'EnumSessions': 103 grpc.unary_unary_rpc_method_handler( 104 servicer.EnumSessions, 105 request_deserializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 106 .EnumProfileSessionsAndToolsRequest.FromString, 107 response_serializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 108 .EnumProfileSessionsAndToolsResponse.SerializeToString, 109 ), 110 'GetSessionToolData': 111 grpc.unary_unary_rpc_method_handler( 112 servicer.GetSessionToolData, 113 request_deserializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 114 .ProfileSessionDataRequest.FromString, 115 response_serializer=third__party_dot_tensorflow_dot_core_dot_profiler_dot_profiler__analysis__pb2 116 .ProfileSessionDataResponse.SerializeToString, 117 ), 118 } 119 generic_handler = grpc.method_handlers_generic_handler( 120 'tensorflow.ProfileAnalysis', rpc_method_handlers) 121 server.add_generic_rpc_handlers((generic_handler,)) 122