try: 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 queue manager" 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.del_reservations(spec, pwd.getpwuid(os.getuid())[0]) except xmlrpclib.Fault, flt: if flt.faultCode == 1: print "Error communicating with queue manager" sys.exit(1) print "Released reservation '%s', matched on %d partitions" % \ (','.join(args), len(result))
cycle = float(spec['cycle']) now = time.time() periods = math.floor((now - start) / cycle) if (periods < 0): start += cycle elif (now - start) % cycle < duration: start += (periods + 1) * cycle else: start += (periods + 2) * cycle updates = {'start': start} try: scheduler.set_reservations([{ 'name': spec['name'] }], updates, user_name) except: print "Error deferring reservation '%'" % spec['name'] continue newstart = time.strftime("%c", time.localtime(start)) print "Setting new start time for for reservation '%s': %s" % ( spec['name'], newstart) else: try: scheduler.del_reservations([{'name': spec['name']}], user_name) except: print "Error releasing reservation '%s'" % spec['name'] continue print "Releasing reservation '%s'" % spec['name']
if spec['cycle']: start = spec['start'] duration = spec['duration'] cycle = float(spec['cycle']) now = time.time() periods = math.floor((now - start)/cycle) if(periods < 0): start += cycle elif(now - start) % cycle < duration: start += (periods + 1) * cycle else: start += (periods + 2) * cycle updates = {'start':start} try: scheduler.set_reservations([{'name':spec['name']}], updates, user_name) except: print "Error deferring reservation '%'" % spec['name'] continue newstart = time.strftime("%c", time.localtime(start)) print "Setting new start time for for reservation '%s': %s" % (spec['name'], newstart) else: try: scheduler.del_reservations([{'name':spec['name']}], user_name) except: print "Error releasing reservation '%s'" % spec['name'] continue print "Releasing reservation '%s'" % spec['name']
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 queue manager" 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.del_reservations(spec, pwd.getpwuid(os.getuid())[0]) except xmlrpclib.Fault, flt: if flt.faultCode == 1: print "Error communicating with queue manager" sys.exit(1) print "Released reservation '%s', matched on %d partitions" % \ (','.join(args), len(result))