示例#1
0
    def startMM(self):
        tool = get_tool()
        args  = ['--host', '0.0.0.0']
        args += self._verbosity_as_cmdline()
        logger.info("Starting Master Drop Manager with args: %s" % (" ".join(args)))
        self._mm_proc = tool.start_process('mm', args)
        logger.info("Started Master Drop Manager with PID %d" % (self._mm_proc.pid))

        # Also subscribe to zeroconf events coming from NodeManagers and feed
        # the Master Manager with the new hosts we find
        if self._zeroconf:
            mm_client = client.MasterManagerClient()
            node_managers = {}
            def nm_callback(zeroconf, service_type, name, state_change):
                info = zeroconf.get_service_info(service_type, name)
                if state_change is zc.ServiceStateChange.Added:
                    server = socket.inet_ntoa(info.address)
                    port = info.port
                    node_managers[name] = (server, port)
                    logger.info("Found a new Node Manager on %s:%d, will add it to the MM" % (server, port))
                    mm_client.add_node(server)
                elif state_change is zc.ServiceStateChange.Removed:
                    server,port = node_managers[name]
                    logger.info("Node Manager on %s:%d disappeared, removing it from the MM" % (server, port))

                    # Don't bother to remove it if we're shutting down. This way
                    # we avoid hanging in here if the MM is down already but
                    # we are trying to remove our NM who has just disappeared
                    if not self._shutting_down:
                        try:
                            mm_client.remove_node(server)
                        finally:
                            del node_managers[name]

            self._mm_browser = utils.browse_service(self._zeroconf, 'NodeManager', 'tcp', nm_callback)
示例#2
0
文件: test_tool.py 项目: Joewn/dfms
    def test_cmdhelp(self):

        for cmd in tool.commands:
            with open(os.devnull, 'wb') as devnull:
                p = tool.start_process(cmd, ['-h'], stdout=devnull, stderr=devnull)
                utils.wait_or_kill(p, timeout=10)
                self.assertEqual(0, p.returncode)
示例#3
0
 def startDIM(self, nodes):
     tool = get_tool()
     args  = ['--host', '0.0.0.0']
     args += self._verbosity_as_cmdline()
     if nodes:
         args += ['--nodes', ",".join(nodes)]
     logger.info("Starting Data Island Drop Manager with args: %s" % (" ".join(args)))
     self._dim_proc = tool.start_process('dim', args)
     logger.info("Started Data Island Drop Manager with PID %d" % (self._dim_proc.pid))
示例#4
0
    def startNM(self):
        tool = get_tool()
        args = ['--host', '0.0.0.0']
        args += self._verbosity_as_cmdline()
        logger.info("Starting Node Drop Manager with args: %s" % (" ".join(args)))
        self._nm_proc = tool.start_process('nm', args)
        logger.info("Started Node Drop Manager with PID %d" % (self._nm_proc.pid))

        # Registering the new NodeManager via zeroconf so it gets discovered
        # by the Master Manager
        if self._zeroconf:
            addrs = utils.get_local_ip_addr()
            self._nm_info = utils.register_service(self._zeroconf, 'NodeManager', socket.gethostname(), addrs[0][0], constants.NODE_DEFAULT_REST_PORT)
示例#5
0
    def _run_graph(self, graph, completed_uids, timeout):

        sessionId = 'lala'
        restPort  = 8888
        args = ['--port', str(restPort), '-N', hostname, '-qq']

        c = client.NodeManagerClient(port=restPort)
        dimProcess = tool.start_process('dim', args)

        with testutils.terminating(dimProcess, timeout):
            c.create_session(sessionId)
            logger.info("Appending graph")
            c.append_graph(sessionId, graph)

            # What we are actually trying to measure with all this stuff
            start = time.time()
            c.deploy_session(sessionId, completed_uids)
            delta = time.time() - start

            # A minute is more than enough, in my PC it takes around 4 or 5 [s]
            # A minute is also way less than the ~2 [h] we observed in AWS
            self.assertLessEqual(delta, 60, "It took way too much time to create all drops")
示例#6
0
    def setUp(self):
        unittest.TestCase.setUp(self)

        args = ['-H', hostname, '-qq']
        self.dmProcess = tool.start_process('nm', args)
示例#7
0
文件: test_lgweb.py 项目: Joewn/dfms
 def setUp(self):
     unittest.TestCase.setUp(self)
     self.temp_dir = tempfile.mkdtemp()
     args = ['-d', lg_dir, '-t', self.temp_dir, '-p', str(lgweb_port), '-H', 'localhost']
     self.devnull = open(os.devnull, 'wb')
     self.web_proc = tool.start_process('lgweb', args, stdout=self.devnull, stderr=self.devnull)