Esempio n. 1
0
 def IsMonitored(client, test):
     reason = []
     has_subscribers = utils.IsMonitored(client, test.test_path)
     if not has_subscribers:
         reason.append('subscriptions')
     if not test.has_rows:
         reason.append('has_rows')
     if reason:
         logging.info('Skip test: %s reason=%s', test.key, ','.join(reason))
         return False
     logging.info('Process test: %s', test.key)
     return True
Esempio n. 2
0
def _CreateHistogramTasks(suite_path,
                          histograms,
                          revision,
                          benchmark_description,
                          completion_token=None):
    tasks = []
    duplicate_check = set()
    measurement_add_futures = []
    sheriff_client = sheriff_config_client.GetSheriffConfigClient()

    for hist in histograms:
        diagnostics = FindHistogramLevelSparseDiagnostics(hist)
        test_path = '%s/%s' % (suite_path,
                               histogram_helpers.ComputeTestPath(hist))

        # Log the information here so we can see which histograms are being queued.
        logging.debug('Queueing: %s', test_path)

        if test_path in duplicate_check:
            raise api_request_handler.BadRequestError(
                'Duplicate histogram detected: %s' % test_path)

        duplicate_check.add(test_path)

        # We create one task per histogram, so that we can get as much time as we
        # need for processing each histogram per task.
        task_dict = _MakeTaskDict(hist, test_path, revision,
                                  benchmark_description, diagnostics,
                                  completion_token)
        tasks.append(_MakeTask([task_dict]))

        if completion_token is not None:
            measurement_add_futures.append(
                completion_token.AddMeasurement(
                    test_path, utils.IsMonitored(sheriff_client, test_path)))
    ndb.Future.wait_all(measurement_add_futures)

    return tasks
Esempio n. 3
0
 def testIsMonitored_Negative(self):
   sheriff_client = sheriff_config_client.GetSheriffConfigClient()
   self.assertFalse(utils.IsMonitored(sheriff_client, 'test'))