Example #1
0
def UnderLimitForAutorevert():
    """Returns True if currently under the limit for autoreverts."""
    action_settings = waterfall_config.GetActionSettings()

    # Do not auto commit revert if not configured to do so.
    limit = action_settings.get('auto_commit_revert_daily_threshold_flake')

    query = MasterFlakeAnalysis.query(
        MasterFlakeAnalysis.autorevert_submission_time >=
        time_util.GetMostRecentUTCMidnight(),
        MasterFlakeAnalysis.has_submitted_autorevert == True)

    return query.count(limit) < limit
Example #2
0
    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)
        }
Example #3
0
def UnderDailyLimit():
    # TODO(crbug.com/942222): Distinguish between Flake Analyzer and Flake
    # Detection bug operations.
    action_settings = waterfall_config.GetActionSettings()
    daily_bug_limit = action_settings.get(
        'max_flake_detection_bug_updates_per_day',
        flake_constants.DEFAULT_MAX_BUG_UPDATES_PER_DAY)
    query = master_flake_analysis.MasterFlakeAnalysis.query(
        master_flake_analysis.MasterFlakeAnalysis.request_time >=
        time_util.GetMostRecentUTCMidnight())
    bugs_filed_today = 0

    more = True
    cursor = None
    while more:
        results, cursor, more = query.fetch_page(100, start_cursor=cursor)
        for result in results:
            if result.has_attempted_filing and result.bug_id:
                bugs_filed_today += 1

    return bugs_filed_today < daily_bug_limit
Example #4
0
  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}
Example #5
0
 def testGetMostRecentUTCMidnight(self):
     self.assertEqual(datetime, type(time_util.GetMostRecentUTCMidnight()))