Open mcelhennyi opened 11 months ago
Upon further reading/inspection I now realize I am misinterpreting what the intention of a parallel node is and what SuccessOnSelected really means. The docs for SuccessOnOne reads that the "one" being a success implies that the others are not finished yet (aka still RUNNING status). This "rule" applies to all policies (although not stated in the description for SuccessOnSelected)
The issue for me was that the first two branches of my tree would return success/failure depending on the situation, but never running. However the way the policy evaluation is written here, if any of the nodes return failure that means that the policies are never checked.
I think it would make more sense to allow that to be configurable: Either the parallel node checks the policies EVERY tick or ONLY when the nodes are running/successful.
Leaving open now as a feature request.
I am trying to make use of the
SuccessOnSelected
Policy for the parallel node. I have three nodes. Two nodes I do not care about them returning success, one node I care about its return (i want success). I have created a test project to emulate my system, and when I run it I do not ever get the success from the selected node to create a success on the parallel node.I expect to see the Node print "Success" and the program to exit just after due to the root node status also being "Success".
Upon reading the code for the Parallel composite policy section, it seems like the way its written, that the only way the policies are checked are when the children nodes are all
status != Failure
. The line here utilizes the pythonnext()
function, which will only throw theStopIteration
exception when the list its iterating over is empty/fully iterated through. The list this implementation is iterating over is a list of all nodes that arestatus == Failure
. The only way this will throw the exception is if NO nodes are in a Failure state.If my policy is to be successful when only a single specific node is Success, then this will never fire.
Am I misusing this library, or is this in fact a bug?