scheduler = ComponentProxy("scheduler", defer=False) except ComponentLookupError: print "Failed to connect to scheduler" raise SystemExit, 1 # Check if reservation exists spec = [{'name': arg} for arg in args] try: result = scheduler.get_reservations(spec) except xmlrpclib.Fault, flt: if flt.faultCode == 1: print "Error communicating with scheduler" sys.exit(1) if len(result) and len(result) != len(args): print "Reservation subset matched" elif not result: print "No Reservations matched" raise SystemExit, 1 try: result = scheduler.release_reservations(spec, pwd.getpwuid(os.getuid())[0]) except xmlrpclib.Fault, flt: if flt.faultCode == 1: print "Error communicating with scheduler" sys.exit(1) print "Released reservation '%s', matched on %d partitions" % \ (','.join(args), len(result))