def br_startup(): scheduler.add_interval_task(batch.hourly_task, 60 * 60) if util.is_production(): scheduler.add_weekday_task(batch.nightly_task, range(1, 8), (3, 0)) else: scheduler.add_interval_task(batch.nightly_task, 60 * 5) saved_visit.start_extension() root_variable_providers.append(add_root_vars)
except KeyError: c[tag] = 1 def scale(t): """Scale circles, plist format: unused, lat, long, radius""" (lat,lon),(n,) = t return ('', lat, lon, int(scale_factor*sqrt(n))) plist = map(scale, dic.items()) plist.sort(lambda x, y: y[3]-x[3]) plist = plist[:circles_quantity] # Update circles every ip_list_update_interval secs scheduler.add_interval_task(action=updateCircles, taskname='updateCircles', initialdelay=1, interval=ip_list_update_interval) class Root(controllers.RootController): @expose(template="geoflow.templates.welcome") def index(self): return dict() @expose('json') def update(self): global plist return dict(plist=plist) @expose(template="geoflow.templates.statistics") def statistics(self): global country_lang return dict(country_lang=country_lang, stats=languages)
def schedule(): """ Schedule our periodic tasks """ jobs = config.get('jobs') # Weekly repository cleanup if 'clean_repo' in jobs: log.debug("Scheduling clean_repo job") scheduler.add_interval_task(action=clean_repo, taskname="Clean update repositories", initialdelay=604800, interval=604800) # Daily nagmail if 'nagmail' in jobs: log.debug("Scheduling nagmail job") scheduler.add_weekday_task(action=nagmail, weekdays=range(1, 8), timeonday=(0, 0)) # Fix invalid bug titles if 'fix_bug_titles' in jobs: log.debug("Scheduling fix_bug_titles job") scheduler.add_interval_task(action=fix_bug_titles, taskname='Fix bug titles', initialdelay=1200, interval=604800) # Warm up some data caches if 'cache_release_data' in jobs: log.debug("Scheduling cache_release_data job") scheduler.add_interval_task(action=cache_release_data, taskname='Cache release data', initialdelay=0, interval=43200) # If we're the masher, then handle the costly metric regenration if not config.get('masher') and 'refresh_metrics' in jobs: log.debug("Scheduling refresh_metrics job") scheduler.add_interval_task(action=refresh_metrics, taskname='Refresh our metrics', initialdelay=7200, interval=86400) # Approve updates that have been in testing for a certain amount of time if 'approve_testing_updates' in jobs: log.debug("Scheduling approve_testing_updates job") scheduler.add_interval_task( action=approve_testing_updates, # Run every 6 hours initialdelay=21600, interval=21600) #weekdays=range(1,8), #timeonday=(0,0)) # Automatically expire buildroot overrides if 'approve_testing_updates' in jobs: log.debug("Scheduling expire_buildroot_overrides job") scheduler.add_interval_task( action=expire_buildroot_overrides, # Run every 6 hours initialdelay=3600, interval=3600)
def schedule(): """ Schedule our periodic tasks """ jobs = config.get('jobs') # Weekly repository cleanup if 'clean_repo' in jobs: log.debug("Scheduling clean_repo job") scheduler.add_interval_task(action=clean_repo, taskname="Clean update repositories", initialdelay=604800, interval=604800) # Daily nagmail if 'nagmail' in jobs: log.debug("Scheduling nagmail job") scheduler.add_weekday_task(action=nagmail, weekdays=range(1,8), timeonday=(0,0)) # Fix invalid bug titles if 'fix_bug_titles' in jobs: log.debug("Scheduling fix_bug_titles job") scheduler.add_interval_task(action=fix_bug_titles, taskname='Fix bug titles', initialdelay=1200, interval=604800) # Warm up some data caches if 'cache_release_data' in jobs: log.debug("Scheduling cache_release_data job") scheduler.add_interval_task(action=cache_release_data, taskname='Cache release data', initialdelay=0, interval=43200) # If we're the masher, then handle the costly metric regenration if not config.get('masher') and 'refresh_metrics' in jobs: log.debug("Scheduling refresh_metrics job") scheduler.add_interval_task(action=refresh_metrics, taskname='Refresh our metrics', initialdelay=7200, interval=86400) # Approve updates that have been in testing for a certain amount of time if 'approve_testing_updates' in jobs: log.debug("Scheduling approve_testing_updates job") scheduler.add_interval_task(action=approve_testing_updates, # Run every 6 hours initialdelay=21600, interval=21600) #weekdays=range(1,8), #timeonday=(0,0)) # Automatically expire buildroot overrides if 'approve_testing_updates' in jobs: log.debug("Scheduling expire_buildroot_overrides job") scheduler.add_interval_task(action=expire_buildroot_overrides, # Run every 6 hours initialdelay=3600, interval=3600)
def test_interval_task(self): """Test adding an interval task.""" task = add_interval_task(functest, 60*10, taskname='intervaltest') self.assertEqual(task.action, functest) self.assertEqual(task.name, 'intervaltest')