def test_no_block_exception_ending_no_duration(limited_counter_class): z = scheduler_async.EventMgr(datetime.timedelta(seconds=.01), block=False, task=limited_counter_class.task) z.start() time.sleep(1) assert limited_counter_class.count == 50, "did not cease at error"
def test_single_count_blocking(counter_class): z = scheduler_async.EventMgr(datetime.timedelta(seconds=.01), end=datetime.datetime.now() + datetime.timedelta(seconds=.1), block=True, task=counter_class.task) z.start() assert counter_class.count == 10, "improper # of runs for given duration"
def test_block_exception_ending(limited_counter_class): z = scheduler_async.EventMgr(datetime.timedelta(seconds=.01), end=datetime.datetime.now() + datetime.timedelta(seconds=1), block=True, task=limited_counter_class.task) z.start() assert limited_counter_class.count == 50, "did not cease at error"
def main(): logger.info("START {}".format(str(datetime.datetime.now()))) # access configuration for alerts engine, treat conf mostly like a dict conf = configparser.ConfigParser() conf.read('alert_engine.ini') rep_t = datetime.timedelta( hours = float(conf['scan_period']['hours']), minutes = float(conf['scan_period']['minutes']), seconds = float(conf['scan_period']['seconds']), ) scanner = record_scanner.TriggerScan("pscaa01-dev",rep_t) ''' logger.debug("start test_db") scanner = record_scanner.TriggerScan("pscaa02-dev",rep_t) print(scanner.dbPvPull()) a = scanner.dbPvPull() print(type(a)) print(scanner.archPull(a)) scanner.scanTask() logger.debug("end test_db") ''' # configure Event Manager engine = scheduler_async.EventMgr( rep_t, block=True, task=scanner.scanTask ) logger.debug('ENGINE START') engine.start() logger.debug('ENGINE END')