Exemple #1
0
 def testGetStartEndDates(self, _):
     self.assertEqual(
         (datetime(2017, 3, 18, 0, 0, 0), datetime(2017, 3, 20, 0, 0, 0)),
         time_util.GetStartEndDates(None, None))
     self.assertEqual((None, datetime(2017, 3, 20, 0, 0, 0)),
                      time_util.GetStartEndDates(None, '2017-03-19'))
     self.assertEqual(
         (datetime(2017, 3, 18, 0, 0, 0), datetime(2017, 3, 20, 0, 0, 0)),
         time_util.GetStartEndDates('2017-03-18', None))
     self.assertEqual(
         (datetime(2017, 3, 15, 0, 0, 0), datetime(2017, 3, 16, 0, 0, 0)),
         time_util.GetStartEndDates('2017-03-15', '2017-03-16'))
Exemple #2
0
    def HandleGet(self):
        client_id = self.request.get('client_id', CrashClient.CRACAS)

        now = time_util.GetUTCNow()
        last_week = time_util.GetUTCNow() - timedelta(days=7)

        start_date, end_date = time_util.GetStartEndDates(
            self.request.get('start_date'),
            self.request.get('end_date'),
            default_start=last_week,
            default_end=now)

        publish_to_client = bool(self.request.get('publish'))
        count = 0
        for crash_keys in IterateCrashBatches(client_id, start_date, end_date):
            pipeline = RerunPipeline(client_id, crash_keys, publish_to_client)
            # Attribute defined outside __init__ - pylint: disable=W0201
            pipeline.target = appengine_util.GetTargetNameForModule(
                RERUN_SERVICE)
            pipeline.start(queue_name=RERUN_QUEUE)
            count += 1

        if count == 0:
            message = 'No rerun pipeline started.'
        else:
            message = '%d rerun pipeline(s) kicked off.' % count

        return {'data': {'message': message}}
Exemple #3
0
    def testGetStartEndDatesDefaultStartDefaultEnd(self, _):
        default_start = datetime(2017, 3, 15, 0, 0, 0)
        default_end = datetime(2017, 3, 16, 0, 0, 0)
        self.assertEqual(
            (default_start, default_end),
            time_util.GetStartEndDates(None,
                                       None,
                                       default_start=default_start,
                                       default_end=default_end))
        self.assertEqual(
            (default_start, datetime(2017, 3, 20, 0, 0, 0)),
            time_util.GetStartEndDates(None,
                                       '2017-03-19',
                                       default_start=default_start))

        self.assertEqual((datetime(2017, 3, 18, 0, 0, 0), default_end),
                         time_util.GetStartEndDates('2017-03-18',
                                                    None,
                                                    default_end=default_end))
    def HandleGet(self):
        start = self.request.get('start_date')
        end = self.request.get('end_date')

        if not start and not end:
            midnight_today = time_util.GetMostRecentUTCMidnight()
            end_date = midnight_today - timedelta(days=1)
            start_date = end_date - timedelta(days=_DAYS_TO_CHECK)
        else:
            # Manually accessed the page with a specific date range to process.
            start_date, end_date = time_util.GetStartEndDates(start, end)

        return {
            'template': 'check_reverted_cls.html',
            'data': _GetRevertCLData(start_date, end_date)
        }
  def HandleGet(self):  # pragma: no cover
    """Shows the metrics of revert CLs created."""
    start = self.request.get('start_date')
    end = self.request.get('end_date')

    if not start and not end:
      # Default to 1 week of data, starting from 1 day before the most previous
      # midnight.
      previous_utc_midnight = time_util.GetMostRecentUTCMidnight()
      start_date = previous_utc_midnight - timedelta(days=8)
      end_date = previous_utc_midnight - timedelta(days=1)
    else:
      start_date, end_date = time_util.GetStartEndDates(start, end)

    suspected_cls = _GetAnalysesWithinDateRange(start_date, end_date)
    data = _GenerateFinditMetrics(suspected_cls)
    data['tree_closures'] = _GenerateTreeClosureMetrics('chromium', 'compile',
                                                        start_date, end_date)
    data['start_date'] = time_util.FormatDatetime(start_date)
    data['end_date'] = time_util.FormatDatetime(end_date)

    return {'template': 'auto_revert_metrics.html', 'data': data}