[R] Auto-killing processes spawned by foreach::doMC

Henrik Bengtsson hb at biostat.ucsf.edu
Thu Nov 4 01:06:24 CET 2010


I am also interest in ways to in R send signals to other R
sessions/processes, ideally in (what appears to be) an OS-independent
way.  For what it is worth, related question have been asked before,
cf. R-devel thread 'Sending signals to current R process from R
running under MS Windows (c.f. Esc)' started on 2009-11-28:


Still no workable suggestions/solutions AFAIK.


On Wed, Nov 3, 2010 at 2:55 PM, Steve Lianoglou
<mailinglist.honeypot at gmail.com> wrote:
> Hi all,
> Sometimes I'll find myself "ctrl-c"-ing like a madman to kill some
> code that's parallelized via foreach/doMC when I realized that I just
> set my cpu off to do something boneheaded, and it will keep doing that
> thing for a while.
> In these situations, since I interrupted its normal execution,
> foreach/doMC doesn't "clean up" after itself by killing the processes
> that were spawned. Furthermore, I believe that when I quit my "main" R
> session, the spawned processes still remain (there, but idle).
> I can go in via terminal (or some task manager/activity monitor) and
> kill them manually, but does foreach (or something else (maybe
> multicore?)) keep track of the process IDs that it spawned?
> Is there some simple doCleanup() function I can write to get these R
> processes and kill them automagically?
> For what it's worth, I'm running on linux & os x, R-2.12 and the
> latest versions of foreach/doMC/multicore (though, I feel like this
> has been true since I've started using foreach/doMC way back when).
> Thanks,
> -steve
> --
> Steve Lianoglou
> Graduate Student: Computational Systems Biology
>  | Memorial Sloan-Kettering Cancer Center
>  | Weill Medical College of Cornell University
> Contact Info: http://cbio.mskcc.org/~lianos/contact
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list