コード例 #1
0
    def _connect_session_impl(self,
                              cleanup_instance=True,
                              dangling_timeout_seconds=60):
        """
        Args:
            cleanup_instance (bool, optional): If True, also delete graphscope
                instance (such as pod) in closing process.
            dangling_timeout_seconds (int, optional): After seconds of client
                disconnect, coordinator will kill this graphscope instance.
                Disable dangling check by setting -1.

        """
        request = message_pb2.ConnectSessionRequest(
            cleanup_instance=cleanup_instance,
            dangling_timeout_seconds=dangling_timeout_seconds,
        )

        response = self._stub.ConnectSession(request)
        response = check_grpc_response(response)

        self._session_id = response.session_id
        return (
            response.session_id,
            response.session_type,
            json.loads(response.engine_config),
            response.pod_name_list,
            response.num_workers,
            response.namespace,
        )
コード例 #2
0
 def _fetch_logs_impl(self):
     request = message_pb2.FetchLogsRequest(session_id=self._session_id)
     responses = self._stub.FetchLogs(request)
     for resp in responses:
         resp = check_grpc_response(resp)
         message = resp.message.rstrip()
         if message:
             logger.info(message, extra={"simple": True})
コード例 #3
0
 def _fetch_logs_impl(self):
     request = message_pb2.FetchLogsRequest(session_id=self._session_id)
     responses = self._stub.FetchLogs(request)
     for resp in responses:
         resp = check_grpc_response(resp)
         message = resp.message.rstrip()
         if message:
             print(message, end="\n", file=sys.stdout, flush=True)
コード例 #4
0
 def create_learning_engine(self, object_id, handle, config):
     request = message_pb2.CreateLearningInstanceRequest(
         object_id=object_id,
         handle=handle,
         config=config,
     )
     response = self._stub.CreateLearningInstance(request)
     response = check_grpc_response(response)
     return response.endpoints
コード例 #5
0
 def create_interactive_engine(self, object_id, schema_path,
                               gremlin_server_cpu, gremlin_server_mem):
     request = message_pb2.CreateInteractiveRequest(
         object_id=object_id,
         schema_path=schema_path,
         gremlin_server_cpu=gremlin_server_cpu,
         gremlin_server_mem=gremlin_server_mem,
     )
     response = self._stub.CreateInteractiveInstance(request)
     return check_grpc_response(response)
コード例 #6
0
    def _connect_session_impl(self):
        request = message_pb2.ConnectSessionRequest()

        response = self._stub.ConnectSession(request)
        response = check_grpc_response(response)

        self._session_id = response.session_id
        return (
            response.session_id,
            json.loads(response.engine_config),
            response.pod_name_list,
        )
コード例 #7
0
 def _run_step_impl(self, dag_def):
     request = message_pb2.RunStepRequest(session_id=self._session_id,
                                          dag_def=dag_def)
     response = self._stub.RunStep(request)
     return check_grpc_response(response)
コード例 #8
0
 def _close_session_impl(self):
     request = message_pb2.CloseSessionRequest(session_id=self._session_id)
     response = self._stub.CloseSession(request)
     return check_grpc_response(response)
コード例 #9
0
 def close_learning_engine(self, object_id):
     request = message_pb2.CloseLearningInstanceRequest(object_id=object_id)
     response = self._stub.CloseLearningInstance(request)
     return check_grpc_response(response)
コード例 #10
0
 def close_interactive_engine(self, object_id):
     request = message_pb2.CloseInteractiveRequest(object_id=object_id)
     response = self._stub.CloseInteractiveInstance(request)
     return check_grpc_response(response)
コード例 #11
0
 def _close_session_impl(self, stop_instance=True):
     request = message_pb2.CloseSessionRequest(session_id=self._session_id,
                                               stop_instance=stop_instance)
     response = self._stub.CloseSession(request)
     return check_grpc_response(response)
コード例 #12
0
 def create_interactive_engine(self, object_id, schema_path):
     request = message_pb2.CreateInteractiveRequest(object_id=object_id,
                                                    schema_path=schema_path)
     response = self._stub.CreateInteractiveInstance(request)
     return check_grpc_response(response)