You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Suppose you have the following background session object with a parallelcluster object.
# Create a new `R` background session.session<-callr::r_session$new()
# Create a cluster with two worker processes and record the process IDs.worker_pids<-session$run(function() {
# Create a cluster.cluster<<-parallel::makeCluster(spec=2, type="PSOCK")
# Return the worker process IDs.return(unlist(parallel::clusterCall(cluster, Sys.getpid)))
})
# Run a task in the background that keeps the cluster busy indefinitely.session$call(function() {
# Send the task to the cluster workers.parallel::parSapply(cluster, 1:10, function(x) {
# An infinite loop.while (TRUE) { Sys.sleep(0.0001) }
})
})
# Interrupt the session.session$interrupt()
# Read the session interruption condition.session$read()
# Confirm the session is `idle`.session$get_state()
The following will hang indefinitely on macOS because the workers are still busy (i.e., I believe the SIGINT signal is not propagated to the workers). However, it will output as expected on Windows.
# Send the run and output the results.session$run(function() {
parallel::clusterCall(cluster, print, "Subsequent cluster call.")
})
At this point I sent a manual interrupt (i.e., Ctrl + C) on macOS.
# Close the session.session$close()
# Remove the reference to the `session` object.
rm(session)
# Request garbage collection.
gc(full=TRUE)
On macOS the worker processes are still running.
# Check the status of the worker processes.
lapply(worker_pids, function(pid) {
ps::ps_is_running(
ps::ps_handle(pid)
)
})
# Clean.tools::pskill(worker_pids, tools::SIGTERM)
Is this expected behavior? Am I missing something obvious?
The text was updated successfully, but these errors were encountered:
Suppose you have the following background
session
object with aparallel
cluster
object.The following will hang indefinitely on
macOS
because the workers are still busy (i.e., I believe theSIGINT
signal is not propagated to the workers). However, it will output as expected onWindows
.At this point I sent a manual interrupt (i.e.,
Ctrl + C
) onmacOS
.On
macOS
the worker processes are still running.Is this expected behavior? Am I missing something obvious?
The text was updated successfully, but these errors were encountered: