Celery provides a more robust set of queueing options for both tasks and worker processes. Updates include: - infrastructure necessary to run Celery, including celery entrypoint - backgrounded functions are now imported directly from atst.jobs - update tests as-needed - update kubernetes worker pod command
19 lines
454 B
Python
19 lines
454 B
Python
from flask import current_app as app
|
|
|
|
from atst.queue import celery
|
|
|
|
|
|
@celery.task()
|
|
def send_mail(recipients, subject, body):
|
|
app.mailer.send(recipients, subject, body)
|
|
|
|
|
|
@celery.task()
|
|
def send_notification_mail(recipients, subject, body):
|
|
app.logger.info(
|
|
"Sending a notification to these recipients: {}\n\nSubject: {}\n\n{}".format(
|
|
recipients, subject, body
|
|
)
|
|
)
|
|
app.mailer.send(recipients, subject, body)
|