def get(self): """The get handler method is called from a cron job. It expects no parameters and has no output. It checks all current bisect try jobs and send comments to an issue on the issue tracker if a bisect job has completed. """ credentials = utils.ServiceAccountCredentials() issue_tracker = issue_tracker_service.IssueTrackerService( additional_credentials=credentials) # Set privilege so we can also fetch internal try_job entities. datastore_hooks.SetPrivilegedRequest() jobs_to_check = try_job.TryJob.query( try_job.TryJob.status.IN(['started', 'pending'])).fetch() all_successful = True for job in jobs_to_check: try: _CheckJob(job, issue_tracker) except Exception as e: # pylint: disable=broad-except logging.error('Caught Exception %s: %s\n%s', type(e).__name__, e, traceback.format_exc()) all_successful = False if all_successful: utils.TickMonitoringCustomMetric('UpdateBugWithResults')
def get(self): """The get handler method is called from a cron job. It expects no parameters and has no output. It checks all current bisect try jobs and send comments to an issue on the issue tracker if a bisect job has completed. """ credentials = rietveld_service.Credentials( rietveld_service.GetDefaultRietveldConfig(), rietveld_service.PROJECTHOSTING_SCOPE) issue_tracker = issue_tracker_service.IssueTrackerService( additional_credentials=credentials) jobs_to_check = try_job.TryJob.query( try_job.TryJob.status == 'started').fetch() for job in jobs_to_check: try: if job.use_buildbucket: logging.info('Checking job %s with Buildbucket job ID %s.', job.key.id(), getattr(job, 'buildbucket_job_id', None)) else: logging.info('Checking job %s with Rietveld issue ID %s.', job.key.id(), getattr(job, 'rietveld_issue_id', None)) _CheckJob(job, issue_tracker) except Exception as e: # pylint: disable=broad-except logging.error('Caught Exception %s: %s', type(e).__name__, e) utils.TickMonitoringCustomMetric('UpdateBugWithResults')
def post(self): """Runs auto bisects.""" if 'stats' in self.request.query_string: self.RenderHtml('result.html', _PrintStartedAndFailedBisectJobs()) return datastore_hooks.SetPrivilegedRequest() if _RestartFailedBisectJobs(): utils.TickMonitoringCustomMetric('RestartFailedBisectJobs')
def post(self): """Performs any automatic triaging operations. This will include updating Anomaly entities, and checking whether they should be marked as "recovered", as well as updating Bug entities, and commenting on the issue tracker if all alerts for a bug are recovered. """ datastore_hooks.SetPrivilegedRequest() # Handle task queue requests. if self.request.get('update_recovered_bug'): bug_id = int(self.request.get('bug_id')) TriageBugs.UpdateRecoveredBugs(bug_id) return TriageAnomalies.Process() utils.TickMonitoringCustomMetric('TriageAnomalies') TriageBugs.Process() utils.TickMonitoringCustomMetric('TriageBugs')