the big format
This commit is contained in:
45
app/main.py
45
app/main.py
@ -6,31 +6,36 @@ from helpers import aws_helper
|
||||
from daemonize import Daemonize
|
||||
from sqs_listener import SqsListener
|
||||
|
||||
logging.basicConfig(stream=sys.stdout, level=logging.INFO, format="%(levelname)s %(asctime)s - %(message)s")
|
||||
logging.basicConfig(stream=sys.stdout,
|
||||
level=logging.INFO,
|
||||
format="%(levelname)s %(asctime)s - %(message)s")
|
||||
|
||||
|
||||
class ServiceListener(SqsListener):
|
||||
def handle_message(self, body, attributes, messages_attributes):
|
||||
# gather/manage/process data based on the particular needs
|
||||
logging.info('Incoming message: %s', body)
|
||||
|
||||
service = LoftService(body)
|
||||
service.process()
|
||||
def handle_message(self, body, attributes, messages_attributes):
|
||||
# gather/manage/process data based on the particular needs
|
||||
logging.info('Incoming message: %s', body)
|
||||
|
||||
service = LoftService(body)
|
||||
service.process()
|
||||
|
||||
logging.info('Process complete for %s', service.file_name)
|
||||
|
||||
logging.info('Process complete for %s', service.file_name)
|
||||
|
||||
def main():
|
||||
logging.info('Starting Solver Service (v1.1.2)...')
|
||||
listener = ServiceListener(
|
||||
os.environ['SQS_QUEUE'],
|
||||
region_name=os.environ['AWS_REGION'],
|
||||
aws_access_key=os.environ['AWS_ACCESS_KEY_ID'],
|
||||
aws_secret_key=os.environ['AWS_SECRET_ACCESS_KEY'],
|
||||
queue_url=os.environ['SQS_QUEUE']
|
||||
)
|
||||
listener.listen()
|
||||
logging.info('Starting Solver Service (v1.1.2)...')
|
||||
listener = ServiceListener(
|
||||
os.environ['SQS_QUEUE'],
|
||||
region_name=os.environ['AWS_REGION'],
|
||||
aws_access_key=os.environ['AWS_ACCESS_KEY_ID'],
|
||||
aws_secret_key=os.environ['AWS_SECRET_ACCESS_KEY'],
|
||||
queue_url=os.environ['SQS_QUEUE'])
|
||||
listener.listen()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
myname=os.path.basename(sys.argv[0])
|
||||
pidfile='/tmp/%s' % myname
|
||||
daemon = Daemonize(app=myname,pid=pidfile, action=main, foreground=True)
|
||||
daemon.start()
|
||||
myname = os.path.basename(sys.argv[0])
|
||||
pidfile = '/tmp/%s' % myname
|
||||
daemon = Daemonize(app=myname, pid=pidfile, action=main, foreground=True)
|
||||
daemon.start()
|
||||
|
Reference in New Issue
Block a user