Exemple #1
0
def run():
    cm = vps_util.my_cm()
    region = vps_util.my_region()
    print "Starting retire server at cloudmaster %s, region %s." % (cm, region)
    qname = cm + ":retireq"
    destroy_qname = cm + ":destroyq"
    q = redisq.Queue(qname, redis_shell, TIMEOUT)
    while True:
        task, remover = q.next_job()
        if task:
            name, ip = task.split('|')
            is_baked_in = redis_shell.sismember(region + ":bakedin-names", name)
            if is_baked_in:
                print "Not retiring baked-in server %s (%s)" % (name, ip)
            else:
                print "Retiring", name, ip
                vps_util.retire_lcs(name, ip)
            txn = redis_shell.pipeline()
            remover(txn)
            if not is_baked_in:
                # Introduce the job with the timestamp already filled in, so it will
                # only be pulled when it 'expires'. This effectively adds a delay to
                # give clients some time to move over to their new server before we
                # actually destroy the old one.
                txn.lpush(destroy_qname, "%s*%s" % (name, int(time.time())))
            txn.execute()
        else:
            time.sleep(10)
Exemple #2
0
def run():
    cm = vps_util.my_cm()
    region = vps_util.my_region()
    print "Starting retire server at cloudmaster %s, region %s." % (cm, region)
    qname = cm + ":retireq"
    destroy_qname = cm + ":destroyq"
    q = redisq.Queue(qname, redis_shell, TIMEOUT)
    while True:
        task, remover = q.next_job()
        if task:
            name, ip = task.split('|')
            is_baked_in = redis_shell.sismember(region + ":bakedin-names",
                                                name)
            if is_baked_in:
                print "Not retiring baked-in server %s (%s)" % (name, ip)
            else:
                print "Retiring", name, ip
                vps_util.retire_lcs(name, ip)
            txn = redis_shell.pipeline()
            remover(txn)
            if not is_baked_in:
                # Introduce the job with the timestamp already filled in, so it will
                # only be pulled when it 'expires'. This effectively adds a delay to
                # give clients some time to move over to their new server before we
                # actually destroy the old one.
                txn.lpush(destroy_qname, "%s*%s" % (name, int(time.time())))
            txn.execute()
        else:
            time.sleep(10)
Exemple #3
0
def run():
    dc = os.getenv("DC")
    print "Using datacenter", dc
    qname = dc + ":retireq"
    destroy_qname = dc + ":destroyq"
    q = redisq.Queue(qname, redis_shell, TIMEOUT)
    while True:
        task, remover = q.next_job()
        if task:
            name, ip = task.split('|')
            print "Retiring", name, ip
            vps_util.retire_lcs(name, ip)
            txn = redis_shell.pipeline()
            remover(txn)
            # Introduce the job with the timestamp already filled in, so it will
            # only be pulled when it 'expires'. This effectively adds a delay to
            # give clients some time to move over to their new server before we
            # actually destroy the old one.
            txn.lpush(destroy_qname, "%s*%s" % (name, int(time.time())))
            txn.execute()
        time.sleep(10)
Exemple #4
0
def run():
    dc = os.getenv("DC")
    print "Using datacenter", dc
    qname = dc + ":retireq"
    destroy_qname = dc + ":destroyq"
    q = redisq.Queue(qname, redis_shell, TIMEOUT)
    while True:
        task, remover = q.next_job()
        if task:
            name, ip = task.split('|')
            print "Retiring", name, ip
            vps_util.retire_lcs(name, ip)
            txn = redis_shell.pipeline()
            remover(txn)
            # Introduce the job with the timestamp already filled in, so it will
            # only be pulled when it 'expires'. This effectively adds a delay to
            # give clients some time to move over to their new server before we
            # actually destroy the old one.
            txn.lpush(destroy_qname, "%s*%s" % (name, int(time.time())))
            txn.execute()
        time.sleep(10)