From 2658e20caea803ed3aadd19d9d497ebeec8506dc Mon Sep 17 00:00:00 2001 From: thomaswoehlke <thomas.woehlke@gmail.com> Date: Sun, 25 Apr 2021 12:10:23 +0200 Subject: [PATCH] work --- src/covid19/blueprints/admin/admin_service.py | 4 +++- src/covid19/blueprints/admin/admin_views.py | 4 ++-- src/covid19/blueprints/ecdc/ecdc_service.py | 5 +++++ src/covid19/blueprints/owid/owid_service.py | 5 +++++ .../rki/rki_bundeslaender/rki_bundeslaender_service.py | 5 +++++ .../rki/rki_vaccination/rki_vaccination_service.py | 5 +++++ src/covid19/blueprints/who/who_service.py | 5 +++++ src/covid19/blueprints/who/who_service_update.py | 4 ++-- 8 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/covid19/blueprints/admin/admin_service.py b/src/covid19/blueprints/admin/admin_service.py index f35a29ce..dc43f986 100644 --- a/src/covid19/blueprints/admin/admin_service.py +++ b/src/covid19/blueprints/admin/admin_service.py @@ -16,7 +16,9 @@ class AdminService: app.logger.info(" Admin Service [ready]") def task_database_drop_create(self): + app.logger.info(" AdminService.task_database_drop_create() [begin]") self.run_admin_database_dump() + app.logger.info(" AdminService.task_database_drop_create() [begin]") return self def run_admin_database_dump(self): @@ -69,7 +71,7 @@ class AdminService: app.logger.info("------------------------------------------------------------") return self - def run_admin_database_drop(self): + def run_admin_database_drop_and_create(self): app.logger.info(" run database drop and create [begin]") app.logger.info("------------------------------------------------------------") self.__database.drop_all() diff --git a/src/covid19/blueprints/admin/admin_views.py b/src/covid19/blueprints/admin/admin_views.py index 88f94557..18dba945 100644 --- a/src/covid19/blueprints/admin/admin_views.py +++ b/src/covid19/blueprints/admin/admin_views.py @@ -241,7 +241,7 @@ def url_admin_database_dump_reimport(): def url_admin_database_dropcreate_only(): app.logger.info("url_admin_database_drop [start]") flash("admin_service.run_admin_database_drop started") - admin_service.run_admin_database_drop() + admin_service.run_admin_database_drop_and_create() app.logger.info("url_admin_database_drop [done]") return redirect(url_for('app_admin.url_admin_tasks')) @@ -249,7 +249,7 @@ def url_admin_database_dropcreate_only(): @app_admin.route('/database/drop') def url_admin_database_drop(): app.logger.info("url_admin_database_drop [start]") - admin_service.run_admin_database_drop() + admin_service.run_admin_database_drop_and_create() if drop_and_create_data_again: who_service.pretask_database_drop_create() ecdc_service.pretask_database_drop_create() diff --git a/src/covid19/blueprints/ecdc/ecdc_service.py b/src/covid19/blueprints/ecdc/ecdc_service.py index 1cd1b35c..ead68848 100644 --- a/src/covid19/blueprints/ecdc/ecdc_service.py +++ b/src/covid19/blueprints/ecdc/ecdc_service.py @@ -22,12 +22,17 @@ class EcdcService: def pretask_database_drop_create(self): flash("ecdc_service.download started") + app.logger.info("ecdc_service.download started") self.service_download.download_file() + app.logger.info("ecdc_service.download done") + flash("ecdc_service.download done") return self def task_database_drop_create(self): + app.logger.info("ecdc_service.task_database_drop_create started") self.service_import.import_file() self.service_update.update_star_schema_initial() + app.logger.info("ecdc_service.task_database_drop_create done") return self def run_download_only(self): diff --git a/src/covid19/blueprints/owid/owid_service.py b/src/covid19/blueprints/owid/owid_service.py index 9e0d20b1..524c5ef0 100644 --- a/src/covid19/blueprints/owid/owid_service.py +++ b/src/covid19/blueprints/owid/owid_service.py @@ -23,14 +23,19 @@ class OwidService: def pretask_database_drop_create(self): flash("OwidService.pretask_database_drop_create started") + app.logger.info("OwidService.pretask_database_drop_create started") self.service_download.download_file() + app.logger.info("OwidService.pretask_database_drop_create done") + flash("OwidService.pretask_database_drop_create done") return self def task_database_drop_create(self): + app.logger.info("OwidService.task_database_drop_create started") self.service_import.import_file() # TODO #212 implement OwidService.task_database_drop_create() self.service_update.update_dimension_tables_only() self.service_update.update_fact_table_incremental_only() + app.logger.info("OwidService.task_database_drop_create done") return self #def run_download_only(self): diff --git a/src/covid19/blueprints/rki/rki_bundeslaender/rki_bundeslaender_service.py b/src/covid19/blueprints/rki/rki_bundeslaender/rki_bundeslaender_service.py index 021f7588..ac24c73e 100644 --- a/src/covid19/blueprints/rki/rki_bundeslaender/rki_bundeslaender_service.py +++ b/src/covid19/blueprints/rki/rki_bundeslaender/rki_bundeslaender_service.py @@ -22,12 +22,17 @@ class RkiBundeslaenderService: def pretask_database_drop_create(self): flash("RkiBundeslaenderService.pretask_database_drop_create started") + app.logger.info("RkiBundeslaenderService.pretask_database_drop_create started") self.service_download.download_file() + app.logger.info("RkiBundeslaenderService.pretask_database_drop_create done") + flash("RkiBundeslaenderService.pretask_database_drop_create done") return self def task_database_drop_create(self): + app.logger.info("RkiBundeslaenderService.task_database_drop_create started") self.service_import.import_file() self.service_update.update_star_schema_initial() + app.logger.info("RkiBundeslaenderService.task_database_drop_create done") return self def run_download_only(self): diff --git a/src/covid19/blueprints/rki/rki_vaccination/rki_vaccination_service.py b/src/covid19/blueprints/rki/rki_vaccination/rki_vaccination_service.py index e300f9ff..72dd2f67 100644 --- a/src/covid19/blueprints/rki/rki_vaccination/rki_vaccination_service.py +++ b/src/covid19/blueprints/rki/rki_vaccination/rki_vaccination_service.py @@ -22,12 +22,17 @@ class RkiVaccinationService: def pretask_database_drop_create(self): flash("vaccination_service.run_download started") + app.logger.info("vaccination_service.run_download started") self.service_download.download_file() + app.logger.info("vaccination_service.run_download done") + flash("vaccination_service.run_download done") return self def task_database_drop_create(self): + app.logger.info("vaccination_service.task_database_drop_create started") self.service_import.import_file() self.service_update.update_star_schema_initial() + app.logger.info("vaccination_service.task_database_drop_create done") return self def run_download_only(self): diff --git a/src/covid19/blueprints/who/who_service.py b/src/covid19/blueprints/who/who_service.py index 9a9f6882..371869fd 100644 --- a/src/covid19/blueprints/who/who_service.py +++ b/src/covid19/blueprints/who/who_service.py @@ -22,13 +22,18 @@ class WhoService: def pretask_database_drop_create(self): flash("WhoService.pretask_database_drop_create started") + app.logger.info("WhoService.pretask_database_drop_create started") self.service_download.download_file() + app.logger.info("WhoService.pretask_database_drop_create done") + flash("WhoService.pretask_database_drop_create done") return self def task_database_drop_create(self): + app.logger.info("WhoService.task_database_drop_create started") self.service_import.import_file() self.service_update.update_dimension_tables_only() self.service_update.update_fact_table_incremental_only() + app.logger.info("WhoService.task_database_drop_create done") return self #def run_download_only(self): diff --git a/src/covid19/blueprints/who/who_service_update.py b/src/covid19/blueprints/who/who_service_update.py index 887f9ca3..f12a4e29 100644 --- a/src/covid19/blueprints/who/who_service_update.py +++ b/src/covid19/blueprints/who/who_service_update.py @@ -118,7 +118,7 @@ class WhoServiceUpdate: db.session.add(o) i += 1 k += 1 - if i % 500 == 0: + if i % 1000 == 0: app.logger.info(" update WHO incremental ... "+str(i)+" rows") db.session.commit() app.logger.info(" update WHO incremental ... " + str(i) + " rows [" + str(my_date) + "] (" + str(k) + ")") @@ -153,7 +153,7 @@ class WhoServiceUpdate: result_item.row_imported = True db.session.add(result_item) i += 1 - if i % 500 == 0: + if i % 1000 == 0: app.logger.info(" update WHO initial ... "+str(i)+" rows") db.session.commit() db.session.commit() -- GitLab