Print out some additional debugging information in the email script so we can tell what is happening and where.

This commit is contained in:
Dan 2021-07-22 16:02:08 -04:00
parent 61504664d4
commit 7f5c7417d8
2 changed files with 22 additions and 11 deletions

View File

@ -55,7 +55,7 @@ def process_waiting_tasks():
with app.app_context(): with app.app_context():
WorkflowService.do_waiting() WorkflowService.do_waiting()
scheduler.add_job(process_waiting_tasks,'interval',minutes=5) scheduler.add_job(process_waiting_tasks,'interval',minutes=1)
scheduler.start() scheduler.start()

View File

@ -1,3 +1,6 @@
import sys
import traceback
from crc import app from crc import app
from crc.api.common import ApiError from crc.api.common import ApiError
from crc.scripts.script import Script from crc.scripts.script import Script
@ -44,16 +47,24 @@ email (subject="My Subject", recipients=["dhf8r@virginia.edu", pi.email], cc='as
if recipients: if recipients:
message = task.task_spec.documentation message = task.task_spec.documentation
data = task.data data = task.data
content, content_html = EmailService().get_rendered_content(message, data) try:
EmailService.add_email( content, content_html = EmailService().get_rendered_content(message, data)
subject=subject, EmailService.add_email(
sender=app.config['DEFAULT_SENDER'], subject=subject,
recipients=recipients, sender=app.config['DEFAULT_SENDER'],
content=content, recipients=recipients,
content_html=content_html, content=content,
cc=cc, content_html=content_html,
study_id=study_id cc=cc,
) study_id=study_id
)
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
print("*** format_exception:")
# exc_type below is ignored on 3.5 and later
print(repr(traceback.format_exception(exc_type, exc_value,
exc_traceback)))
raise e
def get_email_addresses(self, users, study_id): def get_email_addresses(self, users, study_id):
emails = [] emails = []