Hi, Is there any way to cancel multiple object reference at once? Here is the definition of ray.cancel:
def cancel(object_ref: "ray.ObjectRef", *, force: bool = False, recursive: bool = True):
So I cannot do this:
readies, rests = ray.wait(futures, timeout=10, num_returns=1)
I get an error:
TypeError: cancel() takes 1 positional argument but 4 were given
Hi @kyleqian ! Currently
ray.cancel takes only a single object ref. I think improving it to take a list of object refs is not a bad idea (feature request is here [Core] `ray.cancel` multiple ObjectRefs · Issue #24559 · ray-project/ray · GitHub).
What kind of workload are you running? Would batching cancel requests speed it up in some way?
Thank you. I use Ray to process images and often need to cancel multiple tasks if one of them failed. Batching cancel requests could be have better performance than manual loop.
I see. How big of a performance improvement would you have if you had the ability to cancel in batch? If it’s large then we can add that to the GitHub issue for prioritization
When some tasks fail, dozens to hundreds of related tasks may be canceled. I think batching cancel request can reduce the number of RPCs, and it will make the code more concise.