added methodology for delegating to service, fixed some formatting, cleaned up dangling imports
This commit is contained in:
16
app/main.py
16
app/main.py
@ -23,7 +23,21 @@ class ServiceListener(Consumer):
|
||||
# but depending on if we can add the tagset to the sqs message body
|
||||
# we either extract that and then delegate to the appropriate service
|
||||
# or get the action tag from the object through the aws helper function
|
||||
service = FormGenerationService(body)
|
||||
service = None
|
||||
key = aws_helper.get_key_from_message(body)
|
||||
bucket = aws_helper.get_bucket_from_message(body)
|
||||
action = aws_helper.get_object_tag(key, bucket, 'action')['Value']
|
||||
|
||||
logging.info(f'Process starting for {action}')
|
||||
|
||||
if action == 'formGeneration':
|
||||
service = FormGenerationService(body)
|
||||
elif action == 'abilityEstimation':
|
||||
service = AbilityEstimationService(body)
|
||||
else:
|
||||
logging.error(f'action of type {action} does not exist.')
|
||||
return
|
||||
|
||||
service.process()
|
||||
|
||||
logging.info('Process complete for %s', service.file_name)
|
||||
|
Reference in New Issue
Block a user