Exemple #1
0
    def add_node(self, session_id, node):
        """
        Add node to session.

        :param int session_id: session id
        :param core_pb2.Node node: node to add
        :return: response with node id
        :rtype: core_pb2.AddNodeResponse
        :raises grpc.RpcError: when session doesn't exist
        """
        request = core_pb2.AddNodeRequest(session_id=session_id, node=node)
        return self.stub.AddNode(request)
Exemple #2
0
    def add_node(self,
                 session_id: int,
                 node: wrappers.Node,
                 source: str = None) -> int:
        """
        Add node to session.

        :param session_id: session id
        :param node: node to add
        :param source: source application
        :return: id of added node
        :raises grpc.RpcError: when session doesn't exist
        """
        request = core_pb2.AddNodeRequest(session_id=session_id,
                                          node=node.to_proto(),
                                          source=source)
        response = self.stub.AddNode(request)
        return response.node_id