72 changes: 72 additions & 0 deletions geonode/base/fixtures/django_celery_beat.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[
{
"model": "django_celery_beat.intervalschedule",
"pk": 1,
"fields": {
"every": 60,
"period": "seconds"
}
},
{
"model": "django_celery_beat.crontabschedule",
"pk": 1,
"fields": {
"minute": "0",
"hour": "4",
"day_of_week": "*",
"day_of_month": "*",
"month_of_year": "*"
}
},
{
"model": "django_celery_beat.periodictasks",
"pk": 1,
"fields": {
"last_update": "2019-10-14T12:56:49.352Z"
}
},
{
"model": "django_celery_beat.periodictask",
"pk": 1,
"fields": {
"name": "celery.backend_cleanup",
"task": "celery.backend_cleanup",
"interval": null,
"crontab": 1,
"solar": null,
"args": "[]",
"kwargs": "{}",
"queue": null,
"exchange": null,
"routing_key": null,
"expires": null,
"enabled": true,
"last_run_at": null,
"total_run_count": 0,
"date_changed": "2019-10-14T12:50:54.847Z",
"description": ""
}
},
{
"model": "django_celery_beat.periodictask",
"pk": 2,
"fields": {
"name": "delayed-security-sync-task",
"task": "geonode.security.tasks.synch_guardian",
"interval": 1,
"crontab": null,
"solar": null,
"args": "[]",
"kwargs": "{}",
"queue": null,
"exchange": null,
"routing_key": null,
"expires": null,
"enabled": true,
"last_run_at": null,
"total_run_count": 0,
"date_changed": "2019-10-14T12:56:37.554Z",
"description": ""
}
}
]
8 changes: 1 addition & 7 deletions geonode/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@
'mptt',
'storages',
'floppyforms',
'django_celery_beat',

# Theme
'django_forms_bootstrap',
Expand Down Expand Up @@ -1703,15 +1704,8 @@ def get_geonode_catalogue_service():
# }

DELAYED_SECURITY_SIGNALS = ast.literal_eval(os.environ.get('DELAYED_SECURITY_SIGNALS', 'False'))
DELAYED_SECURITY_INTERVAL = int(os.getenv('DELAYED_SECURITY_INTERVAL', 60))
CELERY_ENABLE_UTC = True
CELERY_TIMEZONE = TIME_ZONE
CELERY_BEAT_SCHEDULE = {
'delayed-security-sync-task': {
'task': 'geonode.security.tasks.synch_guardian',
'schedule': timedelta(seconds=DELAYED_SECURITY_INTERVAL),
}
}

# Half a day is enough
CELERY_TASK_RESULT_EXPIRES = 43200
Expand Down
9 changes: 7 additions & 2 deletions pavement.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ def sync(options):
sh("%s python -W ignore manage.py loaddata sample_admin.json" % settings)
sh("%s python -W ignore manage.py loaddata geonode/base/fixtures/default_oauth_apps.json" % settings)
sh("%s python -W ignore manage.py loaddata geonode/base/fixtures/initial_data.json" % settings)
sh("%s python -W ignore manage.py loaddata geonode/base/fixtures/django_celery_beat.json" % settings)
sh("%s python -W ignore manage.py set_all_layers_alternate" % settings)


Expand Down Expand Up @@ -616,8 +617,12 @@ def start_django(options):
# "notifications.events",
# "geonode.layer.viewer"
]
sh('%s celery -A geonode.celery_app:app worker -Q %s -B -E -l INFO %s' %
(settings, ",".join(celery_queues), foreground))
sh('%s celery -A geonode.celery_app:app worker -Q %s -B -E -l INFO %s %s' % (
settings,
",".join(celery_queues),
'--scheduler django_celery_beat.schedulers:DatabaseScheduler',
foreground
))

if ASYNC_SIGNALS:
sh('%s python -W ignore manage.py runmessaging %s' % (settings, foreground))
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dj-database-url==0.5.0
dj-pagination==2.4.0
pinax-notifications==5.0.3
django-celery-monitor<=1.1.2
django-celery-beat==1.1.1
django-floppyforms<=1.7.0
django-forms-bootstrap<=3.1.0
django-activity-stream==0.8.0
Expand Down