Пример #1
0
    def _StartPinpointJob(self, configuration):
        """Creates, starts a Pinpoint job and returns its URL."""
        try:
            resp = pinpoint_service.NewJob(
                start_git_hash='HEAD',
                end_git_hash='HEAD',
                target='performance_test_suite',
                patch=self._GetBranchIssueUrl(),
                bug_id=self.bug_id or '',
                story=self.story,
                extra_test_args='--pageset-repeat=%d' % self.repeat,
                configuration=configuration,
                benchmark='system_health.common_%s' %
                ('desktop' if self._IsDesktop() else 'mobile'))
        except request.RequestError as e:
            cli_helpers.Comment(
                'Failed to start a Pinpoint job for {config} automatically:\n {err}',
                config=configuration,
                err=e.content)
            return

        cli_helpers.Info('Started a Pinpoint job for {configuration} at {url}',
                         configuration=configuration,
                         url=resp['jobUrl'])
        return resp['jobUrl']
 def testNewJob(self):
   self.assertEqual(pinpoint_service.NewJob(
       name='test_job', configuration='some_config'), 'OK')
   self.mock_request.assert_called_once_with(
       pinpoint_service.SERVICE_URL + '/new', method='POST',
       data={'name': 'test_job', 'configuration': 'some_config',
             'user': '******'},
       use_auth=True, accept='json')
Пример #3
0
def StartJobFromConfig(config_path):
  """Start a pinpoint job based on a config file."""
  src = sys.stdin if config_path == '-' else open(config_path)
  with src as f:
    config = json.load(f)

  if not isinstance(config, dict):
    raise ValueError('Invalid job config')

  response = pinpoint_service.NewJob(**config)
  print 'Started:', response['jobUrl']
Пример #4
0
def StartJobFromConfig(config_path):
    """Start a pinpoint job based on a config file."""
    src = sys.stdin if config_path == '-' else open(config_path)
    with src as f:
        config = json.load(f)

    if not isinstance(config, dict):
        raise ValueError('Invalid job config')

    # As of crrev.com/c/1965875 try jobs must specify a base git hash.
    if not 'base_git_hash' in config:
        config['base_git_hash'] = config['start_git_hash']
        del config['start_git_hash']
        del config['end_git_hash']

    response = pinpoint_service.NewJob(**config)
    print('Started:', response['jobUrl'])