In some cases it can happen that a rule is not loaded when it should be called, e.g.
if you have a circular dependency and thus you can't define the dependency on loading, and the system is still on startup
in a test system where rules are sometimes loaded, sometimes not
I haven't found a function to test if the rule is available.
Now I do something like this to not stop the function, but it still logs the KeyError.
try:
Rule = self.get_rule("MyRule")
Rule.DoSomething()
except KeyError:
self.log.warning(
LOGGER + "System noch nicht initialisiert - versuche später nochmal"
)
I would prefer to have something like this:
if self.is_rule_loaded("MyRule"):
Rule = self.get_rule("MyRule")
Rule.DoSomething()
else:
self.log.warning(
LOGGER + "System noch nicht initialisiert - versuche später nochmal"
)
Is this functionality already existing or can it get implemented?
In some cases it can happen that a rule is not loaded when it should be called, e.g.
I haven't found a function to test if the rule is available. Now I do something like this to not stop the function, but it still logs the KeyError.
I would prefer to have something like this:
Is this functionality already existing or can it get implemented?