Skip to content
Snippets Groups Projects
Commit f1ffcb15 authored by Thomas Wöhlke's avatar Thomas Wöhlke :alien:
Browse files

work 24.01.2021

parent 43411dd8
No related branches found
No related tags found
No related merge requests found
from logging.config import dictConfig
from flask import render_template, redirect, url_for, flash
from sqlalchemy.exc import OperationalError
from database import db, app, my_logging_config
from database import db, app, my_logging_config, run_run_with_debug
from org.woehlke.covid19.who.who_model import WhoGlobalDataImportTable
from org.woehlke.covid19.who.who_model import WhoRegion, WhoCountry, WhoDateReported, WhoGlobalData
from org.woehlke.covid19.who.who_service import WhoService
......@@ -11,11 +11,11 @@ from org.woehlke.covid19.europe.europe_service import EuropeService
from org.woehlke.covid19.vaccination.vaccination_service import VaccinationService
from org.woehlke.covid19.vaccination.vaccination_model import VaccinationDataImportTable
from org.woehlke.covid19.admin.admin_service import AdminService
from server_mq import who_run_update_task, who_update_short_task, who_update_initial_task
from server_mq import alive_message_task
from server_mq import europe_update_initial_task
from server_mq import vaccination_update_initial_task
from server_mq import admin_database_drop_create_task
from app_mq import who_run_update_task, who_update_short_task, who_update_initial_task
from app_mq import alive_message_task
from app_mq import europe_update_initial_task
from app_mq import vaccination_update_initial_task
from app_mq import admin_database_drop_create_task
drop_and_create_data_again = True
......@@ -592,4 +592,4 @@ if __name__ == '__main__':
europe_service = EuropeService(db)
vaccination_service = VaccinationService(db)
admin_service = AdminService(db)
app.run(debug=True)
app.run(debug=run_run_with_debug)
......@@ -8,17 +8,12 @@ from org.woehlke.covid19.vaccination.vaccination_service import VaccinationServi
from org.woehlke.covid19.admin.admin_service import AdminService
who_service = WhoService(db)
europe_service = EuropeService(db)
vaccination_service = VaccinationService(db)
admin_service = AdminService(db)
#
celery = Celery(app.name, broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(app.config)
celery.conf.result_backend = app.config['CELERY_BROKER_URL']
celery.conf.broker_transport_options = {'visibility_timeout': 18000, 'max_retries': 5}
celery.conf.worker_send_task_events = True
celery.conf.task_send_sent_event = True
celery.conf.worker_send_task_events = app.config['CELERY_CONF_WORKER_SEND_TASK_EVENTS']
celery.conf.task_send_sent_event = app.config['CELERY_CONF_TASK_SEND_SENT_EVENT']
@celery.task(bind=True)
......@@ -114,4 +109,14 @@ def admin_database_drop_create_task(self):
return result
if __name__ == '__main__':
db.create_all()
dictConfig(my_logging_config)
who_service = WhoService(db)
europe_service = EuropeService(db)
vaccination_service = VaccinationService(db)
admin_service = AdminService(db)
args = ['worker', '-l', 'INFO']
celery.start(args)
......@@ -5,3 +5,6 @@ POSTGRES_DB = 'covid19data'
ITEMS_PER_PAGE = 10
CELERY_BROKER_URL = 'redis://localhost:6379/0'
SECRET_KEY='vfdjv423ndf654&%%'
APP_DEBUGGER_ACTIVE = True
CELERY_CONF_WORKER_SEND_TASK_EVENTS = True
CELERY_CONF_TASK_SEND_SENT_EVENT = True
......@@ -14,7 +14,7 @@ DB_URL = 'postgresql+psycopg2://{user}:{pw}@{url}/{db}'.format(
app.config['SQLALCHEMY_DATABASE_URI'] = DB_URL
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False # silence the deprecation warning
db = SQLAlchemy(app)
run_run_with_debug = app.config['APP_DEBUGGER_ACTIVE']
my_logging_config = {
'version': 1,
'formatters': {'default': {
......
from setuptools import setup
from setuptools import setup, find_packages
setup(
name='covid19python',
version='0.0.11',
packages=['org', 'org.woehlke', 'org.woehlke.covid19', 'org.woehlke.covid19.nrw', 'org.woehlke.covid19.rki',
'org.woehlke.covid19.who', 'org.woehlke.covid19.admin', 'org.woehlke.covid19.europe'],
packages=find_packages(),
url='https://github.com/thomaswoehlke/covid19python',
license='GNU General Public License v3.0',
author='thomaswoehlke',
......
#!/usr/bin/env bash
python server_mq.py
celery -A server_mq.celery worker -l INFO
python app_mq.py
celery -A app_mq.celery worker -l INFO
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment