Ejemplo n.º 1
0
def restart_loop(stop_at):
    while time.time() < stop_at:
        while len(servers_to_restart) > 0:
            id = servers_to_restart.popleft()
            try:
                res = restart_server(id)
                print(res)
                logging.info('Restarted server %s' % id)
            except Exception as e:
                logging.error('Could not restart server %s because %s ' % (id, repr(e)))
                servers_to_restart.append(id)
            yield from asyncio.sleep(1)
        yield from asyncio.sleep(1)
Ejemplo n.º 2
0
            account = Account(uid)
            print(account.pretty_string())

if args.show_all_active_nodes:
    print('%d servers total' % len(active_servers))
    for id in active_servers:
        account = Account(droplet_to_uid[id])
        print(account.pretty_string())

if args.reconfigure_all_nodes:
    for id in active_servers:
        droplets_to_configure.add(id, 0)

if args.restart_all_nodes:
    for id in active_servers:
        servers_to_restart.append(id)

if args.show_last_n_msgs != 0:
    n = args.show_last_n_msgs
    for msg in all_msgs[:n]:
        print(msg)

if args.msg_user_uid != '' and args.msg_content != '':
    account = Account(process_uid(args.msg_user_uid))
    account.add_msg(args.msg_content)

# if args.set_uid_total_minutes_to_zero != '':
#     account = Account(process_uid(args.set_uid_total_minutes_to_zero))
#

if args.server_owner != '':