Hey, I’m wondering how to stop a ray tune task in another script. Just like, I have a cluster contains A and B, I start ray tune script in A, and wanna stop the tune task on B. How can I achieve this?
THX.
Hi @creamiracle, the easiest way to trigger a graceful shutdown is probably to send SIGINT
or SIGUSR
to the PID of the script.
If you have the pid, you can just use
import os, signal
os.kill(pid, signal.SIGUSR1)
Hey, thanks for the reply, is there any way that I can make a script or dict save the task id with pid at the beginning of the task, then I can give out this pid and kill it?
And also, what is the use of the function “stop_all”
Thanks again.
I have tried cancel and kill pid but it seems no sense…
You can use
import os
print(os.getpid())
to print out the PID of the current process (or change the call to save it somewhere else).
If the process is already running, you can use ps aux
on linux/osx to find out the pid of the script.