예제 #1
0
def _StartPinpointBisect(bug_id, test_anomaly, test):
    # Convert params to Pinpoint compatible
    master_to_depot = {'ChromiumPerf': 'chromium'}
    if not test.master_name in master_to_depot:
        raise NotBisectableError('Unsupported master: %s' % test.master_name)

    repository = master_to_depot[test.master_name]

    params = {
        'test_path': test.test_path,
        'start_commit': test_anomaly.start_revision - 1,
        'end_commit': test_anomaly.end_revision,
        'start_repository': repository,
        'end_repository': repository,
        'bug_id': bug_id,
        'bisect_mode': 'performance',
        'story_filter': start_try_job.GuessStoryFilter(test.test_path),
    }

    try:
        results = pinpoint_service.NewJob(
            pinpoint_request.PinpointParamsFromBisectParams(params))
    except pinpoint_request.InvalidParamsError as e:
        raise NotBisectableError(e.message)

    # For compatibility with existing bisect, switch these to issueId/url
    if 'jobId' in results:
        results['issue_id'] = results['jobId']
        del results['jobId']

    if 'jobUrl' in results:
        results['issue_url'] = results['jobUrl']
        del results['jobUrl']

    return results
예제 #2
0
def _StartPinpointBisect(bug_id, test_anomaly, test):
    # Convert params to Pinpoint compatible
    start_git_hash, start_repository = _GetPinpointRevisionInfo(
        test_anomaly.start_revision - 1, test)
    end_git_hash, end_repository = _GetPinpointRevisionInfo(
        test_anomaly.end_revision, test)
    params = {
        'test_path': test.test_path,
        'start_commit': start_git_hash,
        'end_commit': end_git_hash,
        'start_repository': start_repository,
        'end_repository': end_repository,
        'bug_id': bug_id,
        'bisect_mode': 'performance',
        'story_filter': start_try_job.GuessStoryFilter(test.test_path),
    }
    results = pinpoint_service.NewJob(
        pinpoint_request.PinpointParamsFromBisectParams(params))

    # For compatibility with existing bisect, switch these to issueId/url
    if 'jobId' in results:
        results['issue_id'] = results['jobId']
        del results['jobId']

    if 'jobUrl' in results:
        results['issue_url'] = results['jobUrl']
        del results['jobUrl']

    return results
예제 #3
0
def _StartPinpointBisect(bug_id, test_anomaly, test):
    # Convert params to Pinpoint compatible
    params = {
        'test_path': test.test_path,
        'start_commit': test_anomaly.start_revision - 1,
        'end_commit': test_anomaly.end_revision,
        'bug_id': bug_id,
        'bisect_mode': 'performance',
        'story_filter': start_try_job.GuessStoryFilter(test.test_path),
        'alerts': json.dumps([test_anomaly.key.urlsafe()])
    }

    try:
        results = pinpoint_service.NewJob(
            pinpoint_request.PinpointParamsFromBisectParams(params))
    except pinpoint_request.InvalidParamsError as e:
        raise NotBisectableError(e.message)

    # For compatibility with existing bisect, switch these to issueId/url
    if 'jobId' in results:
        results['issue_id'] = results['jobId']
        test_anomaly.pinpoint_bisects.append(str(results['jobId']))
        test_anomaly.put()
        del results['jobId']

    if 'jobUrl' in results:
        results['issue_url'] = results['jobUrl']
        del results['jobUrl']

    return results
예제 #4
0
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
예제 #5
0
 def post(self):
     story_filter = start_try_job.GuessStoryFilter(
         self.request.get('test_path'))
     self.response.write(json.dumps({'story_filter': story_filter}))
예제 #6
0
 def testGuessStory_DisableFilterForWebrtc(self):
     self.assertEqual(
         '',
         start_try_job.GuessStoryFilter(
             'ChromiumPerf/win7/media.foo/fg/story1'))
예제 #7
0
 def testGuessStory_DisableFilterForSuite(self):
     self.assertEqual(
         '',
         start_try_job.GuessStoryFilter(
             'ChromiumPerf/win7/octane/fg/story1'))
예제 #8
0
 def testGuessStory_NonTelemetry(self):
     self.assertEqual(
         '',
         start_try_job.GuessStoryFilter(
             'ChromiumPerf/win7/angle_perftests/fg/story1'))
예제 #9
0
 def testGuessStory(self):
     self.assertEqual(
         'story1',
         start_try_job.GuessStoryFilter(
             'ChromiumPerf/win7/memory.foo/fg/story1'))
예제 #10
0
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)
    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 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,
        story_filter=story_filter,
        good_revision=good_revision,
        bad_revision=bad_revision,
        repeat_count=10,
        max_time_minutes=20,
        bug_id=bug_id,
        use_archive='true')

    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