def _do_run_queue(self, first_elem): ''' Actually run first element in queue ''' # Make a copy of current settings conf = CONFIG.copy() # Make sure we abide to M-Lab policy if privacy.count_valid(conf, 'privacy.') != 3: privacy.complain() raise RuntimeError('runner_core: bad privacy settings') elif first_elem[0] == 'rendezvous': runner_rendezvous.run(conf['agent.master'], '9773') elif first_elem[0] == 'speedtest': uri = RUNNER_TESTS.test_to_negotiate_uri('speedtest') conf['speedtest.client.uri'] = uri client = ClientSpeedtest(POLLER) client.configure(conf) client.connect_uri() elif first_elem[0] == 'bittorrent': uri = RUNNER_TESTS.test_to_negotiate_uri('bittorrent') conf['bittorrent._uri'] = uri bittorrent.run(POLLER, conf) elif first_elem[0] == 'dload': RunnerDload(first_elem[2]) elif first_elem[0] == 'raw': address = RUNNER_HOSTS.get_random_host() handler = RawNegotiate() handler.connect((address, 8080), CONFIG['prefer_ipv6'], 0, {}) elif first_elem[0] == 'mlab-ns': handler = RunnerMlabns() if not first_elem[2]: extra = {'policy': ''} # get closest server by default else: extra = first_elem[2] handler.connect(('mlab-ns.appspot.com', 80), CONFIG['prefer_ipv6'], 0, extra) elif first_elem[0] in self.dynamic_tests: address = RUNNER_HOSTS.get_random_host() port = 80 # XXX self.dynamic_tests[first_elem[0]]["test_func"]({ "address": address, "conf": CONFIG.copy(), "poller": POLLER, "port": port, }) else: raise RuntimeError('runner_core: asked to run an unknown test')
def _do_run_queue(self): ''' Actually run first element in queue ''' # Make a copy of current settings conf = CONFIG.copy() # Make sure we abide to M-Lab policy if privacy.count_valid(conf, 'privacy.') != 3: privacy.complain() raise RuntimeError('Bad privacy settings') # Run rendezvous elif self.queue[0][0] == 'rendezvous': uri = "http://%s:9773/rendezvous" % conf['agent.master'] runner_rendezvous.run(uri) # Run speedtest elif self.queue[0][0] == 'speedtest': uri = RUNNER_TESTS.test_to_negotiate_uri('speedtest') # # If we have no negotiate URI for this test, possibly # because we are offline, abort it. # if not uri: raise RuntimeError('No negotiate URI for speedtest') conf['speedtest.client.uri'] = uri client = ClientSpeedtest(POLLER) client.configure(conf) client.connect_uri() # Run bittorrent elif self.queue[0][0] == 'bittorrent': uri = RUNNER_TESTS.test_to_negotiate_uri('bittorrent') # # If we have no negotiate URI for this test, possibly # because we are offline, abort it. # if not uri: raise RuntimeError('No negotiate URI for bittorrent') conf['bittorrent._uri'] = uri bittorrent.run(POLLER, conf) # Run dload elif self.queue[0][0] == 'dload': RunnerDload(self.queue[0][2]) # Safety net else: raise RuntimeError('Asked to run an unknown test')