From henrik.bengtsson at ucsf.edu  Sat Jun 20 23:21:20 2015
From: henrik.bengtsson at ucsf.edu (Henrik Bengtsson)
Date: Sat, 20 Jun 2015 14:21:20 -0700
Subject: [Rd] Listing all spawned jobs/processed after
	parallel::mcparallel()?
Message-ID: <CAFDcVCR0KBxf8YTct-=WvnLssnUBAOj4pV2U40p8Z2mtS=ktOA@mail.gmail.com>

QUESTION:
Is it possible to query number of active jobs running after launching
them with parallel::mcparallel()?

For example, if I launch 3 jobs using:

> library(parallel)
> f <- lapply(1:3, FUN=mcparallel)

then I can inspect them as:

> str(f)
List of 3
 $ :List of 2
  ..$ pid: int 142225
  ..$ fd : int [1:2] 8 13
  ..- attr(*, "class")= chr [1:3] "parallelJob" "childProcess" "process"
 $ :List of 2
  ..$ pid: int 142226
  ..$ fd : int [1:2] 10 15
  ..- attr(*, "class")= chr [1:3] "parallelJob" "childProcess" "process"
 $ :List of 2
  ..$ pid: int 142227
  ..$ fd : int [1:2] 12 17
  ..- attr(*, "class")= chr [1:3] "parallelJob" "childProcess" "process"

However, if I launch them without "recording" them, or equivalently if I do:

> f <- lapply(1:3, FUN=mcparallel)
> rm(list="f")

is there a function/mechanism in R/the parallel package allowing me to
find the currently active/running processes?  ... or at least query
how many they are?  I'd like to use this to prevent spawning of more
than a maximum number of parallel processes.  (Yes, I'm away of
mclapply() and friends, but I'm looking at using more low-level
mcparallel()/mccollect()). I'm trying to decide whether I should
implement my own mechanism for keeping track of "jobs" or not.

Thanks,

Henrik



[Rd] Listing all spawned jobs/processed after parallel::mcparallel()?
Henrik Bengtsson