def dotest(peers): for p in peers: print p['host_string'][p['host_string'].index('@')+1:], p['port'] c = Client('tcp://{hostname}:{port}'.format(hostname=p['host_string'][p['host_string'].index('@')+1:], port=p['port']), timeout=None, heartbeat=None) try: c.test('test') except: traceback.print_exc()
def monitor_zerorpc(peers): for p in peers: print p['host_string'][p['host_string'].index('@')+1:], p['port'], c = Client('tcp://{hostname}:{port}'.format(hostname=p['host_string'][p['host_string'].index('@')+1:], port=p['port']), timeout=60, heartbeat=None) try: c.test('test') except RemoteError: print 'passed' except TimeoutExpired: with settings(host_string=p['host_string'], warn_only=True): run('kill $(sudo lsof -t -i:{0})'.format(p['port']))