def start_servers(): procs = [] procs.append(start_process('loads.transport.broker')) for x in range(3): procs.append(start_process('loads.transport.agent')) procs.append(start_process('loads.examples.echo_server')) # wait for the echo server to be started tries = 0 while True: try: requests.get('http://0.0.0.0:9000') break except requests.ConnectionError: time.sleep(.2) tries += 1 if tries > 20: raise # wait for the broker to be up with 3 slaves. client = Pool() while len(client.list()) != 3: time.sleep(.1) # control that the broker is responsive client.ping() for wid in client.list(): status = client.status(wid)['status'] assert status == {}, status client.close() return procs
def start_servers(): procs = [] procs.append(start_process('loads.transport.broker')) for x in range(3): procs.append(start_process('loads.transport.agent')) procs.append(start_process('loads.examples.echo_server')) # wait for the echo server to be started tries = 0 while True: try: requests.get('http://0.0.0.0:9000') break except requests.ConnectionError: time.sleep(.2) tries += 1 if tries > 20: raise # wait for the broker to be up with 3 slaves. client = Pool() while len(client.list()) != 3: time.sleep(.1) # control that the broker is responsive client.ping() for wid in client.list(): status = client.status(wid)['status'] assert status == {}, status client.close() return procs
def start_servers(): if len(_PROCS) != 0: return _PROCS _PROCS.append( start_process('loads.transport.broker', '--db', 'python', '--heartbeat', 'tcp://0.0.0.0:9876')) for x in range(10): _PROCS.append(start_process('loads.transport.agent')) _PROCS.append(start_process('loads.examples.echo_server')) # wait for the echo server to be started tries = 0 while True: try: requests.get('http://0.0.0.0:9000') break except requests.ConnectionError: time.sleep(.2) tries += 1 if tries > 20: raise # wait for the broker to be up with 3 slaves. client = Pool() while len(client.list()) != 10: time.sleep(.1) # control that the broker is responsive client.ping() for wid in client.list(): status = client.status(wid)['status'] assert status == {}, status client.close() if verify_broker() is None: raise ValueError('Broker seem down') return _PROCS
def start_servers(): if len(_PROCS) != 0: return _PROCS _PROCS.append(start_process('loads.transport.broker', '--db', 'python', '--heartbeat', 'tcp://0.0.0.0:9876')) for x in range(10): _PROCS.append(start_process('loads.transport.agent')) _PROCS.append(start_process('loads.examples.echo_server')) # wait for the echo server to be started tries = 0 while True: try: requests.get('http://0.0.0.0:9000') break except requests.ConnectionError: time.sleep(.2) tries += 1 if tries > 20: raise # wait for the broker to be up with 3 slaves. client = Pool() while len(client.list()) != 10: time.sleep(.1) # control that the broker is responsive client.ping() for wid in client.list(): status = client.status(wid)['status'] assert status == {}, status client.close() if verify_broker() is None: raise ValueError('Broker seem down') return _PROCS