コード例 #1
0
 def testGuessMetric_SummaryMetricWithTIRLabel(self):
   testing_common.AddTests(
       ['M'], ['b'],
       {'benchmark': {'chart': {'tir_label': {'page': {}}}}})
   self.assertEqual(
       'tir_label-chart/tir_label-chart',
       start_try_job.GuessMetric('M/b/benchmark/chart/tir_label'))
コード例 #2
0
ファイル: auto_bisect.py プロジェクト: JamesLinus/catapult
def _MakeBisectTryJob(bug_id, test_anomaly, test):
    """Tries to automatically select parameters for a bisect job.

  Args:
    bug_id: A bug ID which some alerts are associated with.

  Returns:
    A TryJob entity, which has not yet been put in the datastore.

  Raises:
    NotBisectableError: A valid bisect config could not be created.
  """
    good_revision = _GetRevisionForBisect(test_anomaly.start_revision - 1,
                                          test)
    bad_revision = _GetRevisionForBisect(test_anomaly.end_revision, test)
    if not can_bisect.IsValidRevisionForBisect(good_revision):
        raise NotBisectableError('Invalid "good" revision: %s.' %
                                 good_revision)
    if not can_bisect.IsValidRevisionForBisect(bad_revision):
        raise NotBisectableError('Invalid "bad" revision: %s.' % bad_revision)
    if test_anomaly.start_revision == test_anomaly.end_revision:
        raise NotBisectableError('Same "good"/"bad" revisions, bisect skipped')

    metric = start_try_job.GuessMetric(test.test_path)
    story_filter = start_try_job.GuessStoryFilter(test.test_path)

    bisect_bot = start_try_job.GuessBisectBot(test.master_name, test.bot_name)
    if not bisect_bot:
        raise NotBisectableError(
            'Could not select a bisect bot: %s for (%s, %s)' %
            (bisect_bot, test.master_name, test.bot_name))

    new_bisect_config = start_try_job.GetBisectConfig(
        bisect_bot=bisect_bot,
        master_name=test.master_name,
        suite=test.suite_name,
        metric=metric,
        story_filter=story_filter,
        good_revision=good_revision,
        bad_revision=bad_revision,
        repeat_count=10,
        max_time_minutes=20,
        bug_id=bug_id)

    if 'error' in new_bisect_config:
        raise NotBisectableError('Could not make a valid config.')

    config_python_string = utils.BisectConfigPythonString(new_bisect_config)

    bisect_job = try_job.TryJob(bot=bisect_bot,
                                config=config_python_string,
                                bug_id=bug_id,
                                master_name=test.master_name,
                                internal_only=test.internal_only,
                                job_type='bisect')

    return bisect_job
コード例 #3
0
ファイル: auto_bisect.py プロジェクト: bopopescu/catapult-1
def _MakeBisectTryJob(bug_id, run_count=0):
    """Tries to automatically select parameters for a bisect job.

  Args:
    bug_id: A bug ID which some alerts are associated with.
    run_count: An integer; this is supposed to represent the number of times
        that a bisect has been tried for this bug; it is used to try different
        config parameters on different re-try attempts.

  Returns:
    A TryJob entity, which has not yet been put in the datastore.

  Raises:
    NotBisectableError: A valid bisect config could not be created.
  """
    anomalies = anomaly.Anomaly.query(anomaly.Anomaly.bug_id == bug_id).fetch()
    if not anomalies:
        raise NotBisectableError('No Anomaly alerts found for this bug.')

    good_revision, bad_revision = _ChooseRevisionRange(anomalies)
    if not can_bisect.IsValidRevisionForBisect(good_revision):
        raise NotBisectableError('Invalid "good" revision: %s.' %
                                 good_revision)
    if not can_bisect.IsValidRevisionForBisect(bad_revision):
        raise NotBisectableError('Invalid "bad" revision: %s.' % bad_revision)

    test = _ChooseTest(anomalies, run_count)
    if not test or not can_bisect.IsValidTestForBisect(test.test_path):
        raise NotBisectableError('Could not select a test.')

    metric = start_try_job.GuessMetric(test.test_path)

    bisect_bot = start_try_job.GuessBisectBot(test.master_name, test.bot_name)
    if not bisect_bot or '_' not in bisect_bot:
        raise NotBisectableError('Could not select a bisect bot.')

    use_recipe = bool(start_try_job.GetBisectDirectorForTester(bisect_bot))

    new_bisect_config = start_try_job.GetBisectConfig(
        bisect_bot=bisect_bot,
        master_name=test.master_name,
        suite=test.suite_name,
        metric=metric,
        good_revision=good_revision,
        bad_revision=bad_revision,
        repeat_count=10,
        max_time_minutes=20,
        bug_id=bug_id,
        use_archive='true',
        use_buildbucket=use_recipe)

    if 'error' in new_bisect_config:
        raise NotBisectableError('Could not make a valid config.')

    config_python_string = utils.BisectConfigPythonString(new_bisect_config)

    bisect_job = try_job.TryJob(bot=bisect_bot,
                                config=config_python_string,
                                bug_id=bug_id,
                                master_name=test.master_name,
                                internal_only=test.internal_only,
                                job_type='bisect',
                                use_buildbucket=use_recipe)

    return bisect_job
コード例 #4
0
ファイル: auto_bisect.py プロジェクト: zeptonaut/catapult
def _MakeBisectTryJob(bug_id, run_count=0):
  """Tries to automatically select parameters for a bisect job.

  Args:
    bug_id: A bug ID which some alerts are associated with.
    run_count: An integer; this is supposed to represent the number of times
        that a bisect has been tried for this bug; it is used to try different
        config parameters on different re-try attempts.

  Returns:
    A TryJob entity, which has not yet been put in the datastore.

  Raises:
    NotBisectableError: A valid bisect config could not be created.
  """
  anomalies = anomaly.Anomaly.query(anomaly.Anomaly.bug_id == bug_id).fetch()
  if not anomalies:
    raise NotBisectableError('No Anomaly alerts found for this bug.')

  # Note: This check for bisectability is parallel to that in bisect_utils.js.
  good_revision, bad_revision = _ChooseRevisionRange(anomalies)
  if not start_try_job.IsValidRevisionForBisect(good_revision):
    raise NotBisectableError('Invalid "good" revision: %s.' % good_revision)
  if not start_try_job.IsValidRevisionForBisect(bad_revision):
    raise NotBisectableError('Invalid "bad" revision: %s.' % bad_revision)

  test = _ChooseTest(anomalies, run_count)
  if not test or not _IsValidTestForBisect(test.test_path):
    raise NotBisectableError('Could not select a test.')

  metric = start_try_job.GuessMetric(test.test_path)

  bisect_bot = start_try_job.GuessBisectBot(test.master_name, test.bot_name)
  if not bisect_bot or '_' not in bisect_bot:
    raise NotBisectableError('Could not select a bisect bot.')

  new_bisect_config = start_try_job.GetBisectConfig(
      bisect_bot=bisect_bot,
      master_name=test.master_name,
      suite=test.suite_name,
      metric=metric,
      good_revision=good_revision,
      bad_revision=bad_revision,
      repeat_count=10,
      max_time_minutes=20,
      truncate_percent=25,
      bug_id=bug_id,
      original_bot_name=test.bot_name,
      use_archive='true')

  if 'error' in new_bisect_config:
    raise NotBisectableError('Could not make a valid config.')

  config_python_string = 'config = %s\n' % json.dumps(
      new_bisect_config, sort_keys=True, indent=2, separators=(',', ': '))

  # Forcing recipe by default for linux bisects.
  use_buildbucket = bisect_bot in _FORCED_RECIPE_BOTS

  bisect_job = try_job.TryJob(
      bot=bisect_bot,
      config=config_python_string,
      bug_id=bug_id,
      master_name=test.master_name,
      internal_only=test.internal_only,
      job_type='bisect',
      use_buildbucket=use_buildbucket)

  return bisect_job