Open antisvin opened 9 years ago
Since RuleEngine always executes rules sequentially, it seems like this class is useless.
true if you look at the somewhat simplistic RuleEngine. However, in the long run the rule engine should support parallel execution - in principle, rules don't depend on other rules but only on the context, except for a sequence being established by priorities (yet, two rules of the same priority can still execute in parallel). We shouldn't impose a constraint on the rule engine -- that's the purpose of SequencedRuleset.
Or maybe we should make something like TransactionalRule - that would restore context in case of error.
that might be a good thing to have, although I haven't encountered the problem in practice. In general, clients calling a rule engine build the context from some input, e.g. one or many Django models, so in case of failure in the rules, nothing is lost. Do you have a specific use case in mind?
similar to TableRuleset's functionality,
that's only true for now (=> #15), and only for individual rules in TableRuleset, each contained rule works independent of all the others.
Since RuleEngine always executes rules sequentially, it seems like this class is useless.
There's something similar that we may want to add instead - a class that executes rules only if all of its rules' should_trigger methods return True (rather than checking and executing them one by one). That's somewhat similar to TableRuleset's functionality, but allows defining separate rules with complex conditions and code.
Or maybe we should make something like TransactionalRule - that would restore context in case of error.
Either way, I don't see the value in SequencedRuleset as is.