Hi Truc: If I'm understanding the code, you need to get the PID from a cluster call BEFORE it gets out of control, correct? Is there a way to get the PIDs from the cluster object running on the master process directly (e.g. a parallel PSOCK cluster)? I see it prints the PID (I suppose I can parse the text), but is there a "cleaner" way to get the PIDs from this object? --j On Tue, Feb 25, 2014 at 3:02 PM, Truc Nguyen Trung
<Truc.Trung at igs.uib.no> wrote:
Hi again !
Sorry I should explain a little more clearly about your problem.
1 Try to download package called "Haplin"
2. library(Haplin)
write haplinSlide
By reading line by line you will see how we do it
################################################
if (.para == "parallel") {
w <- makeCluster(spec = cpus, outfile = slaveOutfile)
.plat <- .Platform$OS.type
if (.plat == "windows")
.cmds <- "taskkill /pid "
if (.plat == "unix")
.cmds <- "kill "
.pids <- sapply(w, function(x) {
parallel:::sendCall(x, eval, list(quote(Sys.getpid())))
parallel:::recvResult(x)
})
.cmds <- paste(.cmds, .pids, sep = "")
on.exit({
if (!missing(slaveOutfile)) sink(file = slaveOutfile,
append = T)
sapply(.cmds, system)
for (.w in w) {
try(parallel:::postNode(.w, "DONE"), silent = T)
try(parallel:::closeNode(.w), silent = T)
}
if (!missing(slaveOutfile)) sink()
})
}
#####################################################
We have developed a Haplin GUI which you can see the sock PID .....
I hope this can help you.
Truc
________________________________________ From: jgrn307 at gmail.com [jgrn307 at gmail.com] on behalf of Jonathan Greenberg [jgrn at illinois.edu] Sent: Tuesday, February 25, 2014 7:17 PM To: Truc Nguyen Trung Subject: Re: [R-sig-hpc] Out-of-control SOCK/PSOCK cluster Truc: Did you send this to the wrong person? I'm not sure what that software has to do with killing parallel workers. --j On Tue, Feb 25, 2014 at 12:09 PM, Truc Nguyen Trung <Truc.Trung at igs.uib.no> wrote: Please take a look at http://haplin.fhi.no. I think it may help .... Truc ________________________________________ From: r-sig-hpc-bounces at r-project.org [r-sig-hpc-bounces at r-project.org] on behalf of Jonathan Greenberg [jgrn at illinois.edu] Sent: Tuesday, February 25, 2014 7:00 PM To: r-sig-hpc at r-project.org Subject: [R-sig-hpc] Out-of-control SOCK/PSOCK cluster R-sig-hpc'ers: I was curious if there are any "safe" ways to kill an out-of-control SOCK/PSOCK workers on Windows/Macs. Thus far, on a Windows box I've been having to force-quit them from the task manager or by running a command line "Taskkill". On Mac, I use a kill -9 or the Activity Monitor. I'd like to write an R script to do this, but right now all I can do is kill ALL R workers via name matching, which may kill non-cluster R instances. Is there a way to get the PIDs or is there an existing function to safely kill a cluster, specifically one created via the parallel package? Cheers! --j -- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 259 Computing Applications Building, MC-150 605 East Springfield Avenue Champaign, IL 61820-6371 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007 _______________________________________________ R-sig-hpc mailing list R-sig-hpc at r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-hpc -- Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 259 Computing Applications Building, MC-150 605 East Springfield Avenue Champaign, IL 61820-6371 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007
Jonathan A. Greenberg, PhD Assistant Professor Global Environmental Analysis and Remote Sensing (GEARS) Laboratory Department of Geography and Geographic Information Science University of Illinois at Urbana-Champaign 259 Computing Applications Building, MC-150 605 East Springfield Avenue Champaign, IL 61820-6371 Phone: 217-300-1924 http://www.geog.illinois.edu/~jgrn/ AIM: jgrn307, MSN: jgrn307 at hotmail.com, Gchat: jgrn307, Skype: jgrn3007