def failure(self, error, cause):
"""Marks the task as a failure with a given reason
Note: This method will silently fail if the task has timed out
Args:
error (string): Failure error
cause (string): Failure error cause
"""
if self.token is None:
raise Exception("Not currently working on a task")
try:
resp = self.client.send_task_failure(taskToken = self.token,
error = error,
cause = cause)
except ClientError as e:
# eat the timeout
if not self.is_timeout(e):
self.log.exception("Eror sending task failure")
raise
finally:
self.token = None # finished with task
评论列表
文章目录