File: isNodeAlive.Rd

package info (click to toggle)
r-cran-parallelly 1.42.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,216 kB
  • sloc: ansic: 111; sh: 13; makefile: 2
file content (49 lines) | stat: -rw-r--r-- 1,643 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/isNodeAlive.R
\name{isNodeAlive}
\alias{isNodeAlive}
\title{Check whether or not the cluster nodes are alive}
\usage{
isNodeAlive(x, ...)
}
\arguments{
\item{x}{A cluster or a cluster node ("worker").}

\item{...}{Not used.}
}
\value{
A logical vector of length \code{length(x)} with values
FALSE, TRUE, and NA.  If it can be established that the
process for a cluster node is running, then TRUE is returned.
If it does not run, then FALSE is returned.
If neither can be inferred, or it times out, then NA is returned.
}
\description{
Check whether or not the cluster nodes are alive
}
\details{
This function works by checking whether the cluster node process is
running or not.  This is done by querying the system for its process
ID (PID), which is registered by \code{\link[=makeClusterPSOCK]{makeClusterPSOCK()}} when the node
starts. If the PID is not known, the NA is returned.
On Unix and macOS, the PID is queried using \code{\link[tools:pskill]{tools::pskill()}} with
fallback to \code{system("ps")}. On MS Windows, \code{system2("tasklist")} is used,
which may take a long time if there are a lot of processes running.
For details, see the \emph{internal} \code{\link[=pid_exists]{pid_exists()}} function.
}
\examples{
\donttest{
cl <- makeClusterPSOCK(2)

## Check if cluster node #2 is alive
print(isNodeAlive(cl[[2]]))

## Check all nodes
print(isNodeAlive(cl))
}

}
\seealso{
Use \code{\link[parallel:makeCluster]{parallel::stopCluster()}} to shut down cluster nodes.
If that's not sufficient, \code{\link[=killNode]{killNode()}} may be attempted.
}