in amazon_polly_async_batch/dynamo.py [0:0]
def put_new_task(self, polly_task, work_item, message):
"""
Given a dict of details of a task already submitted to Polly, and the work item that started it, adds a record
to the task table for tracking. When the job is complete, a notification will be sent to the response processor,
which will load this task detail and update the set records.
:param polly_task: the return structure from Polly after the task was submitted
:param work_item: the work item that we're processing
:param message: a human-readable message describing the status as needed
"""
now = datetime.datetime.now()
next_month = now + datetime.timedelta(days=+30)
dynamodb.put_item(
TableName=self.table_name,
Item={
'taskId': {'S': polly_task.get('TaskId', str(uuid.uuid4()))},
'taskStatus': {'S': polly_task.get('TaskStatus', 'failed')},
'creationTime': {'S': now.isoformat()},
'expirationTime': {'S': next_month.isoformat()},
'outputUri': {'S': polly_task.get('OutputUri', '')},
'outputKey': {'S': work_item.get('output-file', 'none')},
'setName': {'S': work_item.get('set-name')},
'message': {'S': message}
}
)