def notify_uploader_when_testcase_is_processed(testcase, issue): """Notify uploader by email when all the testcase tasks are finished.""" testcase_id = testcase.key.id() # Check if this is a user upload. If not, bail out. upload_metadata = data_types.TestcaseUploadMetadata.query( data_types.TestcaseUploadMetadata.testcase_id == testcase_id).get() if not upload_metadata: return # Check that we have a valid email to send the notification. If not, bail out. to_email = upload_metadata.uploader_email if not to_email: return # If this is a bundled archive with multiple testcases, then don't send email # for individual testcases. if upload_metadata.bundled: return # Check if the notification is already sent once. If yes, bail out. if data_handler.is_notification_sent(testcase_id, to_email): return # Make sure all testcase taks are done (e.g. minimization, regression, etc). if not data_handler.critical_tasks_completed(testcase): return description = data_handler.get_issue_description(testcase) if issue: _update_issue_when_uploaded_testcase_is_processed( testcase, issue, description, upload_metadata) _send_email_to_uploader(testcase_id, to_email, description) data_handler.create_notification_entry(testcase_id, to_email)
def notify_uploader_when_testcase_is_processed(policy, testcase, issue): """Notify uploader by email when all the testcase tasks are finished.""" testcase_id = testcase.key.id() # Check if this is a user upload. If not, bail out. upload_metadata = data_types.TestcaseUploadMetadata.query( data_types.TestcaseUploadMetadata.testcase_id == testcase_id).get() if not upload_metadata: return # Check that we have a valid email to send the notification. If not, bail out. to_email = upload_metadata.uploader_email if not to_email: return # If this is a bundled archive with multiple testcases, then don't send email # for individual testcases. if upload_metadata.bundled: return # Check if the notification is already sent once. If yes, bail out. if data_handler.is_notification_sent(testcase_id, to_email): return # Make sure all testcase taks are done (e.g. minimization, regression, etc). if not data_handler.critical_tasks_completed(testcase): return notify = not upload_metadata.quiet_flag if issue and not testcase.duplicate_of: issue_description = data_handler.get_issue_description(testcase) _update_issue_when_uploaded_testcase_is_processed( policy, testcase, issue, issue_description, upload_metadata.bug_summary_update_flag, notify) if notify: issue_description_without_crash_state = data_handler.get_issue_description( testcase, hide_crash_state=True) _send_email_to_uploader(testcase_id, to_email, issue_description_without_crash_state) # Make sure to create notification entry, as we use this to update bug. data_handler.create_notification_entry(testcase_id, to_email)