def start(self): signal.signal(signal.SIGTERM, self.die) log.info('Starting Inferno...') auto_rules = get_rules(self.settings['rules_directory']) pid_dir = pid.pid_dir(self.settings) # keep cycling through the automatic rules while not self.stopped: # cycle through all the automatic rules for rule in auto_rules: if self.stopped: break # skip this rule # check if pid file exists if not rule.run or self.paused or not pid.should_run( pid_dir, rule): continue pid.create_pid(pid_dir, rule, 'N/A') pid.create_last_run(pid_dir, rule) self.run_rule(rule) time.sleep(1) self.die()
def test_get_automatic_rules(self): rules = get_rules(self.rules_dir) actual = sorted([rule.name for rule in rules]) expected = [ 'automatic_rule_1', 'automatic_rule_2', 'automatic_rule_3', 'automatic_rule_4' ] eq_(actual, expected)
def test_get_automatic_rules(self): rules = get_rules(self.rules_dir) actual = sorted([rule.name for rule in rules]) expected = [ 'automatic_rule_1', 'automatic_rule_2', 'automatic_rule_3', 'automatic_rule_4'] eq_(actual, expected)
def start(self): signal.signal(signal.SIGTERM, self.die) log.info('Starting Inferno...') auto_rules = get_rules(self.settings['rules_directory']) pid_dir = pid.pid_dir(self.settings) # keep cycling through the automatic rules while not self.stopped: # cycle through all the automatic rules for rule in auto_rules: if self.stopped: break # skip this rule # check if pid file exists if not rule.run or self.paused or not pid.should_run(pid_dir, rule): continue pid.create_pid(pid_dir, rule, 'N/A') self.run_rule(rule) time.sleep(1) self.die()