Exemple #1
0
    def _StartTask(self):
        """Kick off a Swarming task to run a test."""
        if self._previous_execution and not self._previous_execution.bot_id:
            if self._previous_execution.failed:
                # If the previous Execution fails before it gets a bot ID, it's likely
                # it couldn't find any device to run on. Subsequent Executions probably
                # wouldn't have any better luck, and failing fast is less complex than
                # handling retries.
                raise errors.SwarmingNoBots()
            else:
                return

        pool_dimension = None
        for dimension in self._dimensions:
            if dimension['key'] == 'pool':
                pool_dimension = dimension

        if self._previous_execution:
            dimensions = [
                pool_dimension, {
                    'key': 'id',
                    'value': self._previous_execution.bot_id
                }
            ]
        else:
            dimensions = self._dimensions

        properties = {
            'inputs_ref': {
                'isolatedserver': self._isolate_server,
                'isolated': self._isolate_hash,
            },
            'extra_args': self._extra_args,
            'dimensions': dimensions,
            'execution_timeout_secs':
            '21600',  # 6 hours, for rendering.mobile.
            'io_timeout_secs': '14400',  # 4 hours, to match the perf bots.
        }
        properties.update(_VPYTHON_PARAMS)
        body = {
            'name': 'Pinpoint job',
            'user': '******',
            'priority': '100',
            'expiration_secs': '86400',  # 1 day.
            'properties': properties,
        }
        if self._swarming_tags:
            body['tags'] = [
                '%s:%s' % (k, self._swarming_tags[k])
                for k in self._swarming_tags
            ]

        logging.debug('Requesting swarming task with parameters: %s', body)

        response = swarming.Swarming(self._swarming_server).Tasks().New(body)

        logging.debug('Response: %s', response)

        self._task_id = response['task_id']
Exemple #2
0
    def _StartTask(self):
        """Kick off a Swarming task to run a test."""
        if (self._previous_execution and not self._previous_execution.bot_id
                and self._previous_execution.failed):
            raise errors.SwarmingNoBots()

        properties = {
            'inputs_ref': {
                'isolatedserver': self._isolate_server,
                'isolated': self._isolate_hash,
            },
            'extra_args': self._extra_args,
            'dimensions': self._dimensions,
            # TODO(dberris): Make this configuration dependent.
            'execution_timeout_secs': '2700',  # 45 minutes for all tasks.
            'io_timeout_secs': '2700',  # Also set 45 minutes for all tasks.
        }
        body = {
            'name':
            'Pinpoint job',
            'user':
            '******',
            'priority':
            '100',
            'service_account':
            _TESTER_SERVICE_ACCOUNT,
            'task_slices': [{
                'properties': properties,
                'expiration_secs': '86400',  # 1 day.
            }],
        }
        if self._swarming_tags:
            # This means we have additional information available about the Pinpoint
            # tags, and we should add those to the Swarming Pub/Sub updates.
            body.update({
                'tags':
                ['%s:%s' % (k, v) for k, v in self._swarming_tags.items()],
                # TODO(dberris): Consolidate constants in environment vars?
                'pubsub_topic':
                'projects/chromeperf/topics/pinpoint-swarming-updates',
                'pubsub_auth_token':
                'UNUSED',
                'pubsub_userdata':
                json.dumps({
                    'job_id': self._swarming_tags.get('pinpoint_job_id'),
                    'task': {
                        'type': 'test',
                        'id': self._swarming_tags.get('pinpoint_task_id'),
                    },
                }),
            })

        logging.debug('Requesting swarming task with parameters: %s', body)

        response = swarming.Swarming(self._swarming_server).Tasks().New(body)

        logging.debug('Response: %s', response)

        self._task_id = response['task_id']
Exemple #3
0
  def _StartTask(self):
    """Kick off a Swarming task to run a test."""
    if (self._previous_execution and not self._previous_execution.bot_id
        and self._previous_execution.failed):
      # If the previous Execution fails before it gets a bot ID, it's likely
      # it couldn't find any device to run on. Subsequent Executions probably
      # wouldn't have any better luck, and failing fast is less complex than
      # handling retries.
      raise errors.SwarmingNoBots()

    properties = {
        'inputs_ref': {
            'isolatedserver': self._isolate_server,
            'isolated': self._isolate_hash,
        },
        'extra_args': self._extra_args,
        'dimensions': self._dimensions,
        'execution_timeout_secs': '21600',  # 6 hours, for rendering.mobile.
        'io_timeout_secs': '14400',  # 4 hours, to match the perf bots.
    }
    properties.update(_VPYTHON_PARAMS)
    body = {
        'name': 'Pinpoint job',
        'user': '******',
        'priority': '100',
        'expiration_secs': '86400',  # 1 day.
        'properties': properties,
    }
    if self._swarming_tags:
      # This means we have additional information available about the Pinpoint
      # tags, and we should add those to the Swarming Pub/Sub updates.
      body['tags'] = ['%s:%s' % (k, v) for k, v in self._swarming_tags.items()]
      body['pubsub_notification'] = {
          # TODO(dberris): Consolidate constants in environment vars?
          'topic':
              'projects/chromeperf/topics/pinpoint-swarming-updates',
          'auth_token':
              'UNUSED',
          'userdata':
              json.dumps({
                  'job_id': self._swarming_tags.get('pinpoint_job_id'),
                  'task': {
                      'type': 'test',
                      'id': self._swarming_tags.get('pinpoint_task_id'),
                  },
              }),
      }

    logging.debug('Requesting swarming task with parameters: %s', body)

    response = swarming.Swarming(self._swarming_server).Tasks().New(body)

    logging.debug('Response: %s', response)

    self._task_id = response['task_id']
Exemple #4
0
    def _StartTask(self):
        """Kick off a Swarming task to run a test."""
        if (self._previous_execution and not self._previous_execution.bot_id
                and self._previous_execution.failed):
            raise errors.SwarmingNoBots()

        properties = {
            'inputs_ref': {
                'isolatedserver': self._isolate_server,
                'isolated': self._isolate_hash,
            },
            'extra_args': self._extra_args,
            'dimensions': self._dimensions,
            'execution_timeout_secs': str(self.execution_timeout_secs or 2700),
            'io_timeout_secs': str(self.execution_timeout_secs or 2700),
        }

        if self.command:
            properties.update({
                # Set the relative current working directory to be the root of the
                # isolate.
                'relative_cwd': self.relative_cwd,

                # Use the command provided in the creation of the execution.
                'command': self.command + self._extra_args,
            })

            # Swarming requires that if 'command' is present in the request, that we
            # not provide 'extra_args'.
            del properties['extra_args']

        body = {
            'name':
            'Pinpoint job',
            'user':
            '******',
            'priority':
            '100',
            'service_account':
            _TESTER_SERVICE_ACCOUNT,
            'task_slices': [{
                'properties': properties,
                'expiration_secs': '86400',  # 1 day.
            }],
        }

        if self._swarming_tags:
            # This means we have additional information available about the Pinpoint
            # tags, and we should add those to the Swarming Pub/Sub updates.
            body.update({
                'tags':
                ['%s:%s' % (k, v) for k, v in self._swarming_tags.items()],
                # TODO(dberris): Consolidate constants in environment vars?
                'pubsub_topic':
                'projects/chromeperf/topics/pinpoint-swarming-updates',
                'pubsub_auth_token':
                'UNUSED',
                'pubsub_userdata':
                json.dumps({
                    'job_id': self._swarming_tags.get('pinpoint_job_id'),
                    'task': {
                        'type': 'test',
                        'id': self._swarming_tags.get('pinpoint_task_id'),
                    },
                }),
            })

        logging.debug('Requesting swarming task with parameters: %s', body)
        response = swarming.Swarming(self._swarming_server).Tasks().New(body)
        logging.debug('Response: %s', response)
        self._task_id = response['task_id']