kopia lustrzana https://github.com/glidernet/ogn-python
Update celery
rodzic
6fffa09e20
commit
a8dc2d5137
|
@ -1,12 +1,13 @@
|
|||
SQLALCHEMY_DATABASE_URI = 'postgresql://postgres@localhost:5432/ogn'
|
||||
|
||||
BROKER_URL = 'redis://localhost:6379/0'
|
||||
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
|
||||
# Celery stuff
|
||||
broker_url = 'redis://localhost:6379/0'
|
||||
result_backend = 'redis://localhost:6379/0'
|
||||
|
||||
|
||||
from datetime import timedelta
|
||||
|
||||
CELERYBEAT_SCHEDULE = {
|
||||
beat_schedule = {
|
||||
'update-ddb': {
|
||||
'task': 'ogn.collect.database.import_ddb',
|
||||
'schedule': timedelta(minutes=15),
|
||||
|
@ -37,4 +38,4 @@ CELERYBEAT_SCHEDULE = {
|
|||
},
|
||||
}
|
||||
|
||||
CELERY_TIMEZONE = 'UTC'
|
||||
timezone = 'UTC'
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
SQLALCHEMY_DATABASE_URI = 'postgresql://postgres@localhost:5432/ogn_test'
|
||||
|
||||
BROKER_URL = 'redis://localhost:6379/0'
|
||||
CELERY_RESULT_BACKEND = 'redis://localhost:6379/0'
|
||||
# Celery stuff
|
||||
broker_url = 'redis://localhost:6379/0'
|
||||
result_backend = 'redis://localhost:6379/0'
|
||||
|
||||
|
||||
CELERYBEAT_SCHEDULE = {}
|
||||
beat_schedule = {}
|
||||
|
||||
CELERY_TIMEZONE = 'UTC'
|
||||
timezone = 'UTC'
|
||||
|
|
|
@ -11,7 +11,7 @@ config = importlib.import_module(os.environ['OGN_CONFIG_MODULE'])
|
|||
|
||||
|
||||
@worker_init.connect
|
||||
def connect_db(signal, sender):
|
||||
def connect_db(sender=None, headers=None, body=None, **kwargs):
|
||||
# Load settings like DB_URI...
|
||||
engine = create_engine(config.SQLALCHEMY_DATABASE_URI, echo=False)
|
||||
|
||||
|
@ -20,11 +20,12 @@ def connect_db(signal, sender):
|
|||
|
||||
|
||||
@worker_shutdown.connect
|
||||
def close_db(signal, sender):
|
||||
def close_db(sender=None, headers=None, body=None, **kwargs):
|
||||
sender.app.session.close()
|
||||
|
||||
|
||||
app = Celery('ogn.collect',
|
||||
backend='amqp://',
|
||||
include=["ogn.collect.database",
|
||||
"ogn.collect.logbook",
|
||||
"ogn.collect.stats",
|
||||
|
|
2
setup.py
2
setup.py
|
@ -35,7 +35,7 @@ setup(
|
|||
'SQLAlchemy==1.2.12',
|
||||
'geopy==1.17.0',
|
||||
'manage.py==0.2.10',
|
||||
'celery[redis]>=3.1,<3.2',
|
||||
'celery[redis]==4.2.1',
|
||||
'alembic==1.0.0',
|
||||
'aerofiles==0.4.1',
|
||||
'geoalchemy2==0.5.0',
|
||||
|
|
Ładowanie…
Reference in New Issue