def test_app_knownpools(self): app = ApplicationService(component='test') app.startup() pools = app.knownpools() self.assertTrue(len(pools) > 0) for pool in pools: self.assertTrue(isinstance(pool, AvailablePool))
'''#runs tasks on schedule #should read tasks from configuration #examples: when to discover. when to monitor. when to ... #will run tasks by sending command (raising event) ''' import datetime import time from helpers.queuehelper import QueueName, QueueEntry from helpers.taskschedule import TaskSchedule from backend.fcmapp import ApplicationService #one-time schedule provision when app starts up APP = ApplicationService(component='schedule') APP.startup() APP.send(QueueName.Q_POOLCONFIGURATIONCHANGED, '') SLEEP_SECONDS = APP.configuration.get('schedule.sleep.seconds') HEARTBEAT = TaskSchedule(run_on_init=True) HEARTBEAT.start = datetime.datetime.now().replace( microsecond=0, second=0, minute=0) + datetime.timedelta(hours=1) HEARTBEAT.interval = 60 * APP.configuration.get('schedule.hearbeat.minutes') MONITOR = TaskSchedule(run_on_init=True) MONITOR.interval = APP.configuration.get('schedule.monitor.seconds') DISCOVER = TaskSchedule(run_on_init=True) DISCOVER.interval = 60 * APP.configuration.get('schedule.discover.minutes') CAMERA = TaskSchedule(run_on_init=True) CAMERA.start = datetime.datetime.now().replace( microsecond=0, second=0, minute=0) + datetime.timedelta(hours=1)