kill(manager, pid::Int, config::WorkerConfig)
kill(manager::FooManager, pid::Int, config::WorkerConfig)
Implemented by cluster managers. It is called on the master process, by rmprocs
. It should cause the remote worker specified by pid
to exit. Base.kill(manager::ClusterManager.....)
executes a remote exit()
on pid
Examples
-
Terminate a process:
julia> proc = run(`sleep 10`) julia> kill(proc)
In this example, the
kill
function is used to terminate the processproc
. By default, it sends theSIGTERM
signal to the process, which terminates it. -
Send a specific signal to a process:
julia> proc = run(`sleep 10`) julia> kill(proc, SIGINT)
The
kill
function can also be used to send a specific signal to a process. In this example, theSIGINT
signal is sent to the processproc
.
Common mistake example:
julia> proc = run(`sleep 10`)
julia> kill(proc, "SIGTERM")
ERROR: MethodError: no method matching kill(::Base.Process, ::String)
In this example, the wrong signal is provided as a string instead of the corresponding constant from the Libc
module. Make sure to use the appropriate constant for the desired signal instead of a string representation.
See Also
accept, bind, :@spawn, connect, fetch, getaddrinfo, gethostname, getipaddr, getsockname, init_worker, IPv4, IPv6, isready, issocket, kill, listen, recv, recvfrom, remotecall, remotecall_fetch, remotecall_wait, RemoteRef, send, setopt,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.