import argparse import os from common.helper.logging import Logging from setup.config import load_config import pytz from src.bosses import Bosses from src.email.supervisor import Email def main(args): configs = load_config(args.config_folder) configs.set('timezone', pytz.timezone('America/Santiago')) params = { 'folders': { 'config': args.config_folder, 'log': args.log_folder, 'data': args.data_folder }, 'bosses': Bosses(args.data_folder), 'logging': Logging(configs.get('timezone'), args.log_folder, 'email'), 'logger': { 'name': 'email' } } setup = { 'workers': [ ('common.helper.logger', 'Worker'), ('src.email', 'Obtenedor'), ('src.email', 'Validador'), ('src.email', 'Confirmador') ], 'queues': ['log', 'emails', 'valid', 'invalid'], 'events': [], 'locks': [] } email = Email(configs, params, setup) email.start() email.join() if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('-c', '--config_folder', default=os.path.join(os.path.realpath('../..'), 'config')) parser.add_argument('-d', '--data_folder', default=os.path.join(os.path.realpath('../..'), 'data')) parser.add_argument('-l', '--log_folder', default=os.path.join(os.path.realpath('../..'), 'logs')) _args = parser.parse_args() main(_args)