Example #1
0
    def completion():
        lmemcacheClient2 = memcache.Client()
        try:
            lreentry = _get_memcount(lmemcacheClient1, "reentry")
            logging.info("reentry=%s" % lreentry)
            if (lreentry or 0) > 0:
                raise PermanentTaskFailure("Reentry == %s, should be 0" %
                                           lreentry)
            _set_memcount(lmemcacheClient2, "reentry", 1)

            time.sleep(5)
            lnumCalls = _get_memcount(lmemcacheClient1, "numcalls")
            lnumCalls = (lnumCalls or 0) + 1
            logging.info("lnumCalls=%s" % lnumCalls)

            if lnumCalls == 1:
                fut = GetFutureAndCheckReady(futurekey)
                fut.set_success("called completion once")
            if lnumCalls > 1:
                raise PermanentTaskFailure("Called too many times (%s)" %
                                           lnumCalls)

            _set_memcount(lmemcacheClient1, "numcalls", lnumCalls)
        finally:
            _set_memcount(lmemcacheClient2, "reentry", 0)
Example #2
0
 def Tick(aProgress):
     fut = GetFutureAndCheckReady(futurekey)
     fut.set_localprogress(aProgress * 5)
     if aProgress < 20:
         Tick(aProgress + 1)
     else:
         fut.set_success(aProgress)
 def OnPageMapSuccess(pagemapfuturekey):
     pagemapfuture = GetFutureAndCheckReady(pagemapfuturekey)
     placeholderfuture = GetFutureAndCheckReady(placeholderfuturekey)
     future = GetFutureAndCheckReady(futurekey)
     result = pagemapfuture.get_result()
     placeholderfuture.set_success(result)
     future.set_success(result)
Example #4
0
 def completion():
     fut = GetFutureAndCheckReady(futurekey)
     fut.set_success("called completion")
Example #5
0
 def SetResult():
     fut = GetFutureAndCheckReady(futurekey)
     fut.set_success(True)