def set_failure(self, exception):
selfkey = self.key
@ndb.transactional
def set_status_transactional():
self = selfkey.get()
didput = False
if not self.status:
self.status = "failure"
self.initialised = True
self.readyforresult = True
self.exceptionser = cloudpickle.dumps(exception)
self.runtimesec = self.get_runtime().total_seconds()
didput = True
self.put()
return self, didput
self, needcalls = set_status_transactional()
if needcalls:
self._callOnFailure()
if not self.parentkey:
# top level. Fail everything below
taskkwargs = self.get_taskkwargs()
@task(**taskkwargs)
def failchildren(futurekey):
children = get_children(futurekey)
if children:
for child in children:
child.set_failure(exception)
failchildren(child.key)
failchildren(self.key)
评论列表
文章目录