def submit_report(self, dataset, job, tool, **kwargs): """Submit the error report to sentry """ log.info(self.github) if self.github: tool_kw = {'tool_id': unicodify(job.tool_id), 'tool_version': unicodify(job.tool_version)} label = self.get_label('{tool_id}/{tool_version}'.format(**tool_kw)) error_title = u"""Galaxy Job Error: {tool_id} v{tool_version}""".format(**tool_kw) # We'll re-use the email error reporter's template since github supports HTML error_reporter = EmailErrorReporter(dataset.id, self.app) error_reporter.create_report(job.get_user(), email=kwargs.get('email', None), message=kwargs.get('message', None), redact_user_details_in_bugreport=self.redact_user_details_in_bugreport) # The HTML report error_message = error_reporter.html_report log.info(error_title in self.issue_cache) if error_title not in self.issue_cache: # Create a new issue. self.issue_cache[error_title] = self.repo.create_issue( title=error_title, body=error_message, # Label it with a tag: tool_id/tool_version labels=[label] ) else: self.issue_cache[error_title].create_comment(error_message) return ('Submitted bug report to Github. Your issue number is %s' % self.issue_cache[error_title].number, 'success')
def submit_report(self, dataset, job, tool, **kwargs): """Submit the error report to sentry """ log.info(self.github) if self.github: tool_kw = {'tool_id': unicodify(job.tool_id), 'tool_version': unicodify(job.tool_version)} label = self.get_label('{tool_id}/{tool_version}'.format(**tool_kw)) error_title = u"""Galaxy Job Error: {tool_id} v{tool_version}""".format(**tool_kw) # We'll re-use the email error reporter's template since github supports HTML error_reporter = EmailErrorReporter(dataset.id, self.app) error_reporter.create_report(job.get_user(), email=kwargs.get('email', None), message=kwargs.get('message', None)) # The HTML report error_message = error_reporter.html_report log.info(error_title in self.issue_cache) if error_title not in self.issue_cache: # Create a new issue. self.issue_cache[error_title] = self.repo.create_issue( title=error_title, body=error_message, # Label it with a tag: tool_id/tool_version labels=[label] ) else: self.issue_cache[error_title].create_comment(error_message) return ('Submitted bug report to Github. Your issue number is %s' % self.issue_cache[error_title].number, 'success')
def _generate_error_message(self, dataset, job, kwargs): # We'll re-use the email error reporter's template since most Git providers supports HTML error_reporter = EmailErrorReporter(dataset.id, self.app) error_reporter.create_report(job.get_user(), email=kwargs.get('email', None), message=kwargs.get('message', None), redact_user_details_in_bugreport=self.redact_user_details_in_bugreport) # Return the HTML report return error_reporter.html_report
def submit_report(self, dataset, job, tool, **kwargs): """Send report as an email """ try: error_reporter = EmailErrorReporter(dataset.id, self.app) error_reporter.send_report(user=job.get_user(), email=kwargs.get('email', None), message=kwargs.get('message', None)) return ("Your error report has been sent", "success") except Exception as e: return ("An error occurred sending the report by email: %s" % str(e), "danger")