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():
WorkflowService.do_waiting()
scheduler.add_job(process_waiting_tasks,'interval',minutes=5)
scheduler.add_job(process_waiting_tasks,'interval',minutes=1)
scheduler.start()

View File

@ -1,3 +1,6 @@
import sys
import traceback
from crc import app
from crc.api.common import ApiError
from crc.scripts.script import Script
@ -44,16 +47,24 @@ email (subject="My Subject", recipients=["dhf8r@virginia.edu", pi.email], cc='as
if recipients:
message = task.task_spec.documentation
data = task.data
content, content_html = EmailService().get_rendered_content(message, data)
EmailService.add_email(
subject=subject,
sender=app.config['DEFAULT_SENDER'],
recipients=recipients,
content=content,
content_html=content_html,
cc=cc,
study_id=study_id
)
try:
content, content_html = EmailService().get_rendered_content(message, data)
EmailService.add_email(
subject=subject,
sender=app.config['DEFAULT_SENDER'],
recipients=recipients,
content=content,
content_html=content_html,
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):
emails = []