Esempio n. 1
0
 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
Esempio n. 2
0
 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
Esempio n. 3
0
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
Esempio n. 4
0
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