Skip to content

Commit

Permalink
feat: add basic notify cmd ^ celery config
Browse files Browse the repository at this point in the history
feat: checkpoint with celery beat comptibility

feat: move task checkpoint

Revert "feat: move task checkpoint"

This reverts commit 8a80117.

feat: configure settings and task file

feat: add configuration to emails command

this also set the celery import to could find the task and celery worker
register it.

the signals tasks are registered by default due the receiver import it when the plugin
is connected

chore: rename of cmd and celery notification task

feat: add command emails course due date
  • Loading branch information
johanseto committed Apr 17, 2023
1 parent e2651f5 commit 09ec99e
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
""""Management command to check and if conditions are
stadified, manage the delivery upcoming course due date emails to a celery task."""

import logging

from django.core.management import BaseCommand

from eox_nelp.notifications.tasks import send_course_due_date_emails


logger = logging.getLogger(__name__)


class Command(BaseCommand):
def handle(self, *args, **options): # lint-amnesty, pylint: disable=too-many-statements
logger.info('----Checking course due emails by command.-----')
Empty file.
15 changes: 15 additions & 0 deletions eox_nelp/notifications/tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# tasks.py

import logging

from celery import shared_task

logger = logging.getLogger(__name__)

@shared_task
def send_course_due_date_emails():
"""
Task to send upcoming course due date emails.
"""
logger.info("------Sending upcoming course due date emails.-------")
logger.info("This is a log message. yeah yeah")
9 changes: 8 additions & 1 deletion eox_nelp/settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
]

COURSE_CREATOR_APP = 'cms.djangoapps.course_creators'

EOX_NELP_CELERY_TASKS = (
"eox_nelp.notifications.tasks",
)

def plugin_settings(settings):
"""
Expand All @@ -35,3 +37,8 @@ def plugin_settings(settings):

if COURSE_CREATOR_APP not in settings.INSTALLED_APPS:
settings.INSTALLED_APPS.append(COURSE_CREATOR_APP)

if getattr(settings, "CELERY_IMPORTS", None):
settings.CELERY_IMPORTS += EOX_NELP_CELERY_TASKS
else:
settings.CELERY_IMPORTS = EOX_NELP_CELERY_TASKS

0 comments on commit 09ec99e

Please sign in to comment.