in amazon_polly_async_batch/setprocessor.py [0:0]
def process_set(event, context):
"""
Processes a set that is described in a YAML file. The set file describes the items to be processed and what
defaults are to be used. For every item in the YAML file, this function posts a single message to SQS.
:param event: the event raised when a yaml file hits the s3 bucket
:param context: ignored
"""
try:
# Get the name of the config file to process from the event
bucket = event['Records'][0]['s3']['bucket']['name']
key = urllib.parse.unquote_plus(event['Records'][0]['s3']['object']['key'], encoding='utf-8')
# Process all the items in the config
cfg = load_config(bucket, key)
process_config(cfg)
# Kick off the set complete waiter, which will wait for all the tasks to be done
sfn.start_execution(stateMachineArn=SET_COMPLETE_WAITER_ARN,
name=cfg.set_name_unique(),
input=json.dumps({'setName': cfg.set_name_unique()}))
except Exception as e:
logger.error('Failed to fully process set file because {}'.format(str(e)))
raise e