-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rigging up the email to the celery debug_task again.
- Loading branch information
Showing
2 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import time | ||
|
||
import celery | ||
from django.core.mail import send_mail | ||
|
||
|
||
# Set the default Django settings module for the 'celery' program. | ||
|
@@ -26,7 +27,22 @@ | |
|
||
@app.task(bind=True, ignore_result=True) | ||
def debug_task(self): | ||
logger.info("Starting debug task") | ||
time.sleep(5) | ||
logger.info("Debug task finished") | ||
logger.debug(f"Request: {self.request!r}") | ||
# Send email | ||
send_mail( | ||
subject="Debug Task Started", | ||
message="The debug task has started.", | ||
from_email=None, # Use default from email | ||
recipient_list=["[email protected]"], | ||
fail_silently=False, | ||
) | ||
|
||
time.sleep(30) | ||
|
||
# Send email | ||
send_mail( | ||
subject="Debug Task Finished", | ||
message="The debug task has finished.", | ||
from_email=None, # Use default from email | ||
recipient_list=["[email protected]"], | ||
fail_silently=False, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters