[Rd] mccollect does not return named, ordered results when wait=FALSE

Martin Morgan mtmorgan at fhcrc.org
Sat Aug 18 18:05:55 CEST 2012

?mccollect say

      'mccollect' returns any results that are available in a list.  The
      results will have the same order as the specified jobs.  If there
      are multiple jobs and a job has a name it will be used to name the
      result, otherwise its process ID will be used.  If none of the
      specified children are still running, it returns 'NULL'.

which does not seem to be true when wait=FALSE

 > sleeper = function(i) mcparallel({ Sys.sleep(i); i }, i)
 > p = lapply(1:2, sleeper); Sys.sleep(2); mccollect(p, wait=FALSE)
[1] 2

[1] 1

 > p = lapply(1:2, sleeper); Sys.sleep(2); mccollect(p, wait=TRUE)
[1] 1

[1] 2

It would be programmatically convenient if mccollect returned a list 
equal in length to it's first argument (except when all tasks are 
complete), e.g., a length 2 named list with second element NULL rather than

 > p = lapply(1:2, sleeper); Sys.sleep(1); mccollect(p, wait=FALSE)
[1] 1

 > sessionInfo()
R Under development (unstable) (2012-08-18 r60311)
Platform: x86_64-unknown-linux-gnu (64-bit)

  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C

attached base packages:
[1] parallel  stats     graphics  grDevices utils     datasets  methods
[8] base

other attached packages:
[1] BiocInstaller_1.5.12

loaded via a namespace (and not attached):
[1] tools_2.16.0

Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793

More information about the R-devel mailing list