def third_step(): for i in range(7): sleep(2) print "in third" # r_except() print "request id ", do_work.request.id MonitorThread.update_jobs_state(do_work.request.id, do_work, 'THIRD_STEP', 80, 100)
def do_work(): """ Get some rest, asynchronously, and update the state all the time """ for i in range(12): sleep(1) MonitorThread.update_jobs_state(do_work.request.id, do_work, 'DO_WORK', 25, 100) print 'calling second' second_step() print 'calling third' third_step() forth_step()
def forth_step(): for i in range(2): sleep(2) print "in forth" print "request id ", do_work.request.id MonitorThread.update_jobs_state(do_work.request.id, do_work, 'FORTH_STEP', 100, 100)
def second_step(): for i in range(6): sleep(2) print "in second" print "request id ", do_work.request.id MonitorThread.update_jobs_state(do_work.request.id, do_work, 'SEC_STEP', 40, 100)