예제 #1
0
def create_work():
    print 'creating work'

    for n in range(5):
        ping_pid = gen_id()
        job_pid = gen_id()
        print 'pinging: %s <- %s' % (job_pid, ping_pid)
        assert isok(client.depend(job_pid, ping_pid, PING_ROLE))

    print 'waking up'
    assert isok(client.wakeup(WAKEUP_KEY))
예제 #2
0
 def acquire_jobs():
     while True:
         # acquire a job
         r = client.start_next(PING_ROLE)
         if isok(r):
             job = r.json()
             yield job[PID]
         else:
             return