def create_app(self): app = create_app() app.config['TESTING'] = True app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False setup_logging(path='../../logging.json', tofile=False) self.logger = logging.getLogger(__name__) return app
def create_app(self): setup_logging(path='../../logging.json', tofile=False) app = create_app(config='test_config') self.logger = logging.getLogger(__name__) connection = create_connection(RABBITMQ_IP, RABBITMQ_PORT) self.channel = connection.channel() self.channel.exchange_declare(exchange=CALENDAR_EXCHANGE, exchange_type='topic') self.channel.exchange_declare(exchange=EVENT_EXCHANGE, exchange_type='topic') self.channel.confirm_delivery() return app
type=int, default=[1000], help='Size of the thumbnail (default is 1000 pixels on shorter side)') parser.add_argument('--log', nargs=1, metavar='<N>', type=int, default=[1], help='Log level: 1-None, 2-Errors, 3-Full') # parser.set_defaults(clear='clear_true') return parser.parse_args() if __name__ == "__main__": setup_logging(level=logging.INFO) sqlite = SQLite(logging.getLogger("main")) sqlite.create_folders_table() for db_folder in sqlite.get_tables(): if db_folder not in [f.name for f in get_folders()]: sqlite.delete_table(db_folder) sqlite.delete_folder(db_folder) if get_config("mssql") is not None: mssql = MSSQL(logging.getLogger("main")) for mssql_folder in mssql.get_tables(): if mssql_folder not in [f.name for f in get_folders()]:
import os import sys sys.path.append(os.path.abspath("src")) # adds src to PYTHONPATH from src import setup_logging, create_app setup_logging() app = create_app() if __name__ == '__main__': app.run()
logger.info('Initialize data transfer to production.') etl_to_production.prepare_customer_table() etl_to_production.prepare_discount_table() etl_to_production.prepare_login_table() etl_to_production.prepare_registration_table() etl_to_production.prepare_booking_table() etl_to_production.prepare_ticket_table() etl_to_production.prepare_product_table() logger.info('Concluded ETL process.') logger.info ('Generating quaterly reports.') generate_reports.generate_billing(by='type') generate_reports.generate_billing(by='name') generate_reports.generate_billing(by='website') generate_reports.generate_billing(by='booking_month') generate_reports.generate_active_customers(by='login_month') generate_reports.generate_active_customers(by='login_day') generate_reports.generate_active_customers(by='login_week') generate_reports.generate_active_customers(by='website') generate_reports.generate_avg_checkout() generate_reports.generate_monthly_diff() logger.info('Concluded generation of reports.') if __name__ == "__main__": logger = setup_logging(logFile='etl-info.log', level='info') main()
def create_app(self): setup_logging(path='../../logging.json', tofile=False) app = create_app(config='test_config') return app
import logging from src import setup_logging, create_app setup_logging(default_level=logging.DEBUG, to_file=False) app = create_app() logger = logging.getLogger(__name__) def main(): logger.info("Launching Licksterr") app.run(debug=True) if __name__ == '__main__': main()