def run(self, address, q1, q2, home): r2 = RemoteBroker(address, home=home) try: # take whatever handset is available w, d = r2.get_resource({'type':'workspace'}, {'type':'handset'}) except Exception, e: print('FAIL %s: got no handset: %s' % (pretty, str(e))) return
def run(self, address, q1, q2, home): # get own interface to the broker. expect all client's resources to # get reclaimed when the interface gets garbage collected r2 = RemoteBroker(address, home=home) # take whatever handset is available try: w, d = r2.get_resource({'type':'workspace'}, {'type':'handset'}) except Exception, e: print('FAIL %s: got no handset: %s' % (pretty, str(e))) return
def t6(HOME, b): pretty = '%s t6' % __file__ print(pretty) for i in range(3): # the broker connection will be garbage collected between iterations, # causing the broker to free all resources allocated to the client. b2 = RemoteBroker(b.address, home=HOME.path) try: w,h,r = b2.get_resource( {'type':'workspace'}, {'type':'handset'}, {'type':'relay'} ) except Exception, e: print('FAIL %s: allocation %d failed: %s' % (pretty, i, str(e))) return False
def t14(HOME, b): pretty = '%s t14' % __file__ print(pretty) for i in range(3): b2 = RemoteBroker(b.address, home=HOME.path) result = b2.get_resource( {'type':'relay', 'uid':'master-a'}, {'type':'handset', 'serial':'master-1'}, {'type':'workspace'} ) if len(result) != 3: print('FAIL %s: wrong number of resources: %s' % (pretty, result)) return False b2.yield_resources(*result) return True