Exemple #1
0
def command_run(args):
    LOG.info(args)
    graph = BuildGraph()
    graph.build_graph()

    client = NodeManagerClient(args.host, args.port)

    session_id = get_session_id()
    client.create_session(session_id)
    client.append_graph(session_id, graph.drop_list)
    client.deploy_session(session_id, graph.start_oids)
def command_run(args):
    LOG.info(args)
    graph = BuildGraph()
    graph.build_graph()

    client = NodeManagerClient(args.host, args.port)

    session_id = get_session_id()
    client.create_session(session_id)
    client.append_graph(session_id, graph.drop_list)
    client.deploy_session(session_id, graph.start_oids)
Exemple #3
0
def check_host(host, port, timeout=5, check_with_session=False):
    """
    Checks if a given host/port is up and running (i.e., it is open).
    If ``check_with_session`` is ``True`` then it is assumed that the
    host/port combination corresponds to a Node Manager and the check is
    performed by attempting to create and delete a session.
    """
    if not check_with_session:
        return utils.portIsOpen(host, port, timeout)

    try:
        session_id = str(uuid.uuid4())
        with NodeManagerClient(host, port, timeout=timeout) as c:
            c.create_session(session_id)
            c.destroy_session(session_id)
        return True
    except:
        return False
Exemple #4
0
 def getNodeGraphStatus(self, node, sessionId):
     if node not in self.dm.nodes:
         raise Exception("%s not in current list of nodes" % (node, ))
     with NodeManagerClient(host=node) as dm:
         return dm.graph_status(sessionId)
Exemple #5
0
 def getNodeSessionInformation(self, node, sessionId):
     if node not in self.dm.nodes:
         raise Exception("%s not in current list of nodes" % (node, ))
     with NodeManagerClient(host=node) as dm:
         return dm.session(sessionId)
Exemple #6
0
 def dmAt(self, host, port=None):
     port = port or self._dmPort
     return NodeManagerClient(host, port, 10)
Exemple #7
0
    def test_errtype(self):

        sid = 'lala'
        c = NodeManagerClient(hostname)
        c.createSession(sid)

        # already exists
        self.assertRaises(exceptions.SessionAlreadyExistsException,
                          c.createSession, sid)

        # different session
        self.assertRaises(exceptions.NoSessionException, c.addGraphSpec,
                          sid + "x", [{}])

        # invalid dropspec, it has no oid/type (is completely empty actually)
        self.assertRaises(exceptions.InvalidGraphException, c.addGraphSpec,
                          sid, [{}])

        # invalid state, the graph status is only queried when the session is running
        self.assertRaises(exceptions.InvalidSessionState, c.getGraphStatus,
                          sid)

        # valid dropspec, but the socket listener app doesn't allow inputs
        c.addGraphSpec(sid, [{
            'type': 'socket',
            'oid': 'a',
            'inputs': ['b']
        }, {
            'oid': 'b',
            'type': 'plain',
            'storage': 'memory'
        }])
        self.assertRaises(exceptions.InvalidRelationshipException,
                          c.deploySession, sid)

        # And here we point to an unexisting file, making an invalid drop
        c.destroySession(sid)
        c.createSession(sid)
        fname = tempfile.mktemp()
        c.addGraphSpec(sid, [{
            'type': 'plain',
            'storage': 'file',
            'oid': 'a',
            'filepath': fname,
            'check_filepath_exists': True
        }])
        self.assertRaises(exceptions.InvalidDropException, c.deploySession,
                          sid)