예제 #1
0
def main(start, stop, username, email, password):
    current = int(start)
    while current <= int(stop):
        sess = HackerrankSession()
        sess.signup(username.format(uid=current), email.format(uid=current), password)
        run(6, 2560, sess=sess, n_procs=200)
        current += 1
예제 #2
0
def run(start, stop, n_procs = 100, username='', password='', sess=None):
    if sess is None:
        sess = HackerrankSession()
        res = sess.login(username, password)
        log("Logged in as %s" % (colored.green(res['username'])))    
    
    q = Queue()
    for i in range(start, stop+1):
        q.put(i)
    
    processes = [Process(target=run_games, args=(uid, q, deepcopy(sess))) for uid in range(n_procs)]
    for p in processes:
        p.start()
    for p in processes:
        p.join()

    log("Finished in " + colored.green(" %.2fs" % (time()-_start)))