Пример #1
0
 def _AddAlertGroup(anomaly_key,
                    subscription_name=None,
                    issue=None,
                    anomalies=None,
                    status=None,
                    project_id=None,
                    bisection_ids=None):
   anomaly_entity = anomaly_key.get()
   group = alert_group.AlertGroup(
       id=str(uuid.uuid4()),
       name=anomaly_entity.benchmark_name,
       subscription_name=subscription_name or 'sheriff',
       status=alert_group.AlertGroup.Status.untriaged,
       project_id=project_id or 'chromium',
       active=True,
       revision=alert_group.RevisionRange(
           repository='chromium',
           start=anomaly_entity.start_revision,
           end=anomaly_entity.end_revision,
       ),
       bisection_ids=bisection_ids or [],
   )
   if issue:
     group.bug = alert_group.BugInfo(
         bug_id=issue.get('id'),
         project=issue.get('projectId', 'chromium'),
     )
     group.project_id = issue.get('projectId', 'chromium')
   if anomalies:
     group.anomalies = anomalies
   if status:
     group.status = status
   return group.put()
Пример #2
0
  def _FileIssue(self, anomalies):
    regressions, subscriptions = self._GetPreproccessedRegressions(anomalies)
    # Only file a issue if there is at least one regression
    # We can't use subsciptions' auto_triage_enable here because it's
    # merged across anomalies.
    if not any(r.auto_triage_enable for r in regressions):
      return None, []

    template_args = self._GetTemplateArgs(regressions)
    # Rendering issue's title and content
    title = _TEMPLATE_ISSUE_TITLE.render(template_args)
    description = _TEMPLATE_ISSUE_CONTENT.render(template_args)

    # Fetching issue labels, components and cc from subscriptions and owner
    components, cc, labels = self._ComputeBugUpdate(subscriptions, regressions)

    response = self._issue_tracker.NewBug(
        title,
        description,
        labels=labels,
        components=components,
        cc=cc,
        project=self._group.project_id
    )
    if 'error' in response:
      logging.warning('AlertGroup file bug failed: %s', response['error'])
      return None, []

    # Update the issue associated witht his group, before we continue.
    return alert_group.BugInfo(
        project=self._group.project_id,
        bug_id=response['bug_id'],
    ), anomalies
 def _AddAlertGroup(anomaly_key, issue=None, anomalies=None, status=None):
     anomaly_entity = anomaly_key.get()
     group = alert_group.AlertGroup(
         id=str(uuid.uuid4()),
         name=anomaly_entity.benchmark_name,
         project_id='chromium',
         status=alert_group.AlertGroup.Status.untriaged,
         active=True,
         revision=alert_group.RevisionRange(
             repository='chromium',
             start=anomaly_entity.start_revision,
             end=anomaly_entity.end_revision,
         ),
     )
     if issue:
         group.bug = alert_group.BugInfo(
             bug_id=issue.get('id'),
             project='chromium',
         )
     if anomalies:
         group.anomalies = anomalies
     if status:
         group.status = status
     return group.put()