def update_task_and_set_table()

in amazon_polly_async_batch/responseprocessor.py [0:0]


def update_task_and_set_table(task_record, success):
    """
    Updates the task table with a completion and increments the `successes` or `failures` field for the set with the
    newest values.

    :param task_record: the task record as it came from Dynamo
    :param success: boolean whether the task succeeded or not
    """
    # Update the task record to show status and completion time
    logger.debug('Updating task {}'.format(task_record['taskId']))
    task_record['completionTime'] = {'S': datetime.datetime.now().isoformat()}
    task_record['taskStatus'] = {'S': 'succeeded' if success else 'failed'}
    dynamo.TaskTable(TASK_TABLE).put_task(task_record)
    if success:
        dynamo.SetTable(SET_TABLE).post_success(task_record['setName']['S'])
    else:
        dynamo.SetTable(SET_TABLE).post_failure(task_record['setName']['S'])