def setUp(self): test_helpers.patch(self, [ 'system.environment.is_running_on_app_engine', ]) self.mock.is_running_on_app_engine.return_value = True self.testbed = testbed.Testbed() self.testbed.activate() self.testbed.init_memcache_stub() self.cache = memoize.MemcacheLarge(100) test_helpers.patch(self, [ 'metrics.logs.log', ]) def fn(): pass self.key = self.cache.get_key(fn, ('a', 'b'), {'c': 'd'}) self.value = {'z': 'a' * (memoize.MemcacheLarge.CHUNK_LEN + 3) * 5}
if not datetime_end: raise helpers.EarlyExitException('Missing end date.', 400) if datetime_end < utils.utcnow().date(): logs.log('Building results for older stats %s %s %s %s %s.' % (fuzzer, jobs, group_by, date_start, date_end)) return _build_old_results(fuzzer, jobs, group_by, date_start, date_end) logs.log('Building results for stats including today %s %s %s %s %s.' % (fuzzer, jobs, group_by, date_start, date_end)) return _build_todays_results(fuzzer, jobs, group_by, date_start, date_end) @memoize.wrap(memoize.MemcacheLarge(MEMCACHE_TODAY_TTL_IN_SECONDS)) def _build_todays_results(fuzzer, jobs, group_by, date_start, date_end): """Wrapper around _build_results that is intended for use by queries where date_end is today. Caches results for 15 minutes.""" return _build_results(fuzzer, jobs, group_by, date_start, date_end) @memoize.wrap(memoize.MemcacheLarge(MEMCACHE_OLD_TTL_IN_SECONDS)) def _build_old_results(fuzzer, jobs, group_by, date_start, date_end): """Wrapper around _build_results that is intended for use by queries where date_end is before today. Caches results for 24 hours.""" return _build_results(fuzzer, jobs, group_by, date_start, date_end) def _build_results(fuzzer, jobs, group_by, date_start, date_end): """Build results."""