Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop a Python Ray Cluster

I've been looking through the documentation, and I can't find any way to stop Ray after an answer is calculated within a tolerance level. Right now I'm writing the answer to a csv with a print('Ok to stop'), and then I kill the process manually. I'd like to stop all of the workers, and then have it automatically move on to another problem. Is there an error that I can raise that will make all of the workers stop?

Thanks.


1 Answers

If you start a ray cluster with ray.init, the cluster should be killed when your python program exists. If you start it with ray start, you can use the ray stop command to shutdown the cluster. You can also use ray stop --force to forcefully kill all processes left.

like image 183
Sang Avatar answered Jul 28 '26 20:07

Sang