Killing parallel tasks

Hi (:

Hopefully I can explain what I’m trying to do here clearly…
So I’ve got a very large tree structure. The task I’m doing involves traversing some subset of this tree and evaluating some subset of its nodes. Traversal of the tree is done using a simple depth-first-search process. “Evaluating” here is effectively just assigning a number to a node - none of the other details of the evaluation process are relevant here. Ray has really really helped speed this process up since I can use it to run multiple simultaneous evaluator processes. Say that you define a “completed traversal” as any single run from a designated root node to a terminal node (i.e. a node with no sub-nodes under it). I’ve got a specified number of completed traversals which need to be run before this process ends.
So say I’ve got a bunch of ray workers all traversing this tree and adding all the (node,value) pairs they encounter/compute to some dictionary. Each time a worker encounters a terminal node, it increments a counter by one to keep track of the completed traversals, like this:

		if currentNode.IsTerminal():


Here, “valTracker” is a ray actor (subclasses a python dictionary) which keeps track of all the data returned by the workers traversing the tree. What I want to do here, when a worker hits a terminal node and increments this traversal counter (done by invoking the valTracker.TraversalCompleted.remote() function), is:

if valTracker.TraversalsCompleted == valTracker.RequiredTraversals:
	kill all active traversal workers

This could save me a good deal of time, as those workers won’t return anything until certain conditions have been met; hence sitting there waiting for them to return something could take a long time if they happen to be trying to evaluate a node with many children when the other worker that just finished the final required traversal reports its DONE status.

Happy to provide any additional details you guys might need to help answer this question.
Thanks for all the work you guys have on this awesome tool, has really made my life a lot easier (:

Can a moderator please delete this? Got it figured out. Simple use of ray.cancel in the right place solved the problem.