Skip to content

Commit

Permalink
periodic tasks setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gpizzorno committed Aug 19, 2020
1 parent 4c7e414 commit 0734fc7
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .ebextensions/03_celery.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ files:
source /opt/python/current/env
source /opt/python/run/venv/bin/activate
cd /opt/python/current/app
exec /opt/python/run/venv/bin/celery -A dalme worker -B --loglevel=INFO
exec /opt/python/run/venv/bin/celery -A dalme worker --beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler --loglevel=info
commands:
celery_install_01:
command: mv celeryd.conf /opt/python/etc
Expand Down
Binary file modified celerybeat-schedule
Binary file not shown.
2 changes: 1 addition & 1 deletion dalme/maintenance_mode_state.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1
0
7 changes: 0 additions & 7 deletions dalme_app/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,3 @@
from .models import *

admin.site.register(Permission)

class DalmeBaseAdmin(admin.ModelAdmin):
def save_model(self, request, obj, form, change):
if not change:
obj.creation_username = request.user.username
obj.modification_username = request.user.username
obj.save()
11 changes: 11 additions & 0 deletions dalme_app/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from celery import shared_task
from async_messages import messages
from django.contrib.auth.models import User
from django.core.management import call_command


@shared_task
Expand All @@ -17,3 +18,13 @@ def update_rs_folio_field(user_id):
messages.success(user, 'The folio ids on the DAM have been updated.')
except Exception as e:
messages.error(user, 'The folio ids on the DAM could not be updated because of the following error: ' + str(e))


@shared_task
def update_search_index():
call_command('update_index', '--remove')


@shared_task
def wagtail_publish_pages():
call_command('publish_scheduled_pages')

0 comments on commit 0734fc7

Please sign in to comment.