Browse code

Team works in Stream

git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/Streamer@68875 bc3139a8-67e5-0310-9ffc-ced21a209358

Martin Morgan authored on 28/08/2012 19:14:37
Showing 3 changed files

... ...
@@ -1,7 +1,7 @@
1 1
 Package: Streamer
2 2
 Type: Package
3 3
 Title: Enabling stream processing of large files
4
-Version: 1.3.9
4
+Version: 1.3.10
5 5
 Author: Martin Morgan, Nishant Gopalakrishnan
6 6
 Maintainer: Martin Morgan <mtmorgan@fhcrc.org>
7 7
 Description: Large data files can be difficult to work with in R,
... ...
@@ -49,6 +49,7 @@
49 49
       idle = function() status() == "IDLE",
50 50
       yielding = function() status() == "YIELD",
51 51
       valued = function() status() == "VALUE",
52
+      done = function() any(status() == "DONE"),
52 53
 
53 54
       .idx = function() which.max(idle()),
54 55
       .yidx = function() if (.yid == 1L) 1L else match(.yid, names()),
... ...
@@ -110,8 +111,9 @@
110 111
                   consume(callSuper())
111 112
           }
112 113
           task <- tasks[[yidx]]
113
-          if (task$status != "DONE") {
114
+          if (!done()) {
114 115
               .self$tasks[[yidx]]$status <- "IDLE"
116
+              consume(callSuper())
115 117
               .self$.yid <- .yid + 1L
116 118
           }
117 119
           task$result
118 120
new file mode 100644
... ...
@@ -0,0 +1,13 @@
1
+test_MulticoreTeam_yield <- function()
2
+{
3
+    if (.Platform$OS.type != "unix")
4
+        return()
5
+    t <- Team(function(i) i, param=MulticoreParam(1L))
6
+    s <- stream(Seq(to=10), t)
7
+    checkIdentical(1L, yield(s))
8
+    checkIdentical(2L, yield(s))
9
+
10
+    t <- Team(function(i) i, param=MulticoreParam(1L))
11
+    s <- stream(Seq(to=10), t)
12
+    checkIdentical(1:10, sapply(s, c))
13
+}