Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
flask-covid19
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Wöhlke
flask-covid19
Commits
f1ffcb15
Commit
f1ffcb15
authored
4 years ago
by
Thomas Wöhlke
Browse files
Options
Downloads
Patches
Plain Diff
work 24.01.2021
parent
43411dd8
No related branches found
No related tags found
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
app.py
+7
-7
7 additions, 7 deletions
app.py
app_mq.py
+12
-7
12 additions, 7 deletions
app_mq.py
config.py
+3
-0
3 additions, 0 deletions
config.py
database.py
+1
-1
1 addition, 1 deletion
database.py
setup.py
+2
-3
2 additions, 3 deletions
setup.py
start_server_mq.sh
+2
-2
2 additions, 2 deletions
start_server_mq.sh
with
27 additions
and
20 deletions
app.py
+
7
−
7
View file @
f1ffcb15
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
=
T
ru
e
)
app
.
run
(
debug
=
ru
n_run_with_debug
)
This diff is collapsed.
Click to expand it.
server
_mq.py
→
app
_mq.py
+
12
−
7
View file @
f1ffcb15
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
config.py
+
3
−
0
View file @
f1ffcb15
...
...
@@ -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
This diff is collapsed.
Click to expand it.
database.py
+
1
−
1
View file @
f1ffcb15
...
...
@@ -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
'
:
{
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
2
−
3
View file @
f1ffcb15
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
'
,
...
...
This diff is collapsed.
Click to expand it.
start_server_mq.sh
+
2
−
2
View file @
f1ffcb15
#!/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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment