示例#1
0
    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))
示例#2
0
            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']
示例#3
0
        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']
示例#4
0
        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))