Browse code

Team terminates on end of upstream

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

Martin Morgan authored on 30/08/2012 18:54:06
Showing 2 changed files

... ...
@@ -111,11 +111,11 @@
111 111
                   consume(callSuper())
112 112
           }
113 113
           task <- tasks[[yidx]]
114
-          if (!done()) {
114
+          .self$.yid <- .yid + 1L
115
+          if (task$status != "DONE")
115 116
               .self$tasks[[yidx]]$status <- "IDLE"
117
+          if (!done())
116 118
               consume(callSuper())
117
-              .self$.yid <- .yid + 1L
118
-          }
119 119
           task$result
120 120
       },
121 121
 
... ...
@@ -10,4 +10,9 @@ test_MulticoreTeam_yield <- function()
10 10
     t <- Team(function(i) i, param=MulticoreParam(1L))
11 11
     s <- stream(Seq(to=10), t)
12 12
     checkIdentical(1:10, sapply(s, c))
13
+
14
+    t <- Team(function(x) mean(x), param=MulticoreParam(5L))
15
+    s <- stream(Seq(to=50, yieldSize=5), t)
16
+    exp <- as.vector(sapply(split(1:50, rep(1:10, each=5)), mean))
17
+    checkIdentical(exp, sapply(s, c))
13 18
 }