in source/client/python/api-v0.1/api/state_table_dynamodb.py [0:0]
def retry_task(self, task_id, new_retry_count):
"""
Puts task back into pending state, available for workers to be picked up
Args:
task_id: task id to be retired
new_retry_count:
Returns:
Nothing
"""
try:
self.state_table.update_item(
Key={
'task_id': task_id
},
UpdateExpression="SET #var_task_owner = :val1, #var_task_status = :val2, #var_retries = :val3",
ExpressionAttributeValues={
':val1': 'None',
':val2': self.__make_task_state_from_task_id(TASK_STATE_PENDING, task_id),
':val3': new_retry_count
},
ExpressionAttributeNames={
"#var_task_owner": "task_owner",
"#var_task_status": "task_status",
"#var_retries": "retries"
}
)
except ClientError as e:
if e.response['Error']['Code'] in ["ThrottlingException", "ProvisionedThroughputExceededException"]:
msg = f"{__name__} Failed. Throttling."
logging.warning(msg)
raise StateTableException(e, msg, caused_by_throttling=True)
else:
msg = f"{__name__} Failed. Exception: [{e.response['Error']}]"
logging.error(msg)
raise Exception(e)
except Exception as e:
msg = f"{__name__} Failed. Exception: [{e.response['Error']}]"
logging.error(msg)
raise e