Closed berndbischl closed 11 years ago
Here is the diff for the less than optimal local hack I did to make it work for a current paper in BE / reduceResultsExperiments:
reduceResultsExperiments = function(reg, ids, part=NA_character_, fun, ...,
- strings.as.factors=default.stringsAsFactors(), block.size) {
+ strings.as.factors=default.stringsAsFactors(), block.size, impute.val) {
checkExperimentRegistry(reg, strict=TRUE)
BatchJobs:::syncRegistry(reg)
@@ -42,10 +44,14 @@ reduceResultsExperiments = function(reg, ids, part=NA_character_, fun, ...,
ids = BatchJobs:::dbFindDone(reg)
} else {
ids = BatchJobs:::checkIds(reg, ids)
- ndone = BatchJobs:::dbFindDone(reg, ids, negate=TRUE)
- if (length(ndone) > 0L)
- stopf("No results available for experiments with ids: %s", collapse(ndone))
+ # ndone = BatchJobs:::dbFindDone(reg, ids, negate=TRUE)
+ # if (length(ndone) > 0L)
+ # stopf("No results available for experiments with ids: %s", collapse(ndone))
}
+ ndone = BatchJobs:::dbFindDone(reg, ids, negate=TRUE)
+ isdone = setNames(rep(TRUE, length(ids)), ids)
+ if (length(ndone) > 0L)
+ isdone[as.character(ndone)] = FALSE
BatchJobs:::checkPart(reg, part)
if (missing(fun)){
fun = function(job, res) res
@@ -63,6 +69,14 @@ reduceResultsExperiments = function(reg, ids, part=NA_character_, fun, ...,
n = length(ids)
messagef("Reducing %i results...", n)
+
+ impute = function(reg, job, part, ...) {
+ if (isdone[as.character(job$id)]) {
+ fun(job, BatchJobs:::getResult(reg, job$id, part), ...)
+ } else {
+ impute.val
+ }
+ }
getRow = function(j, reg, part, ...) {
c(list(prob = j$prob.id),
@@ -70,7 +84,8 @@ reduceResultsExperiments = function(reg, ids, part=NA_character_, fun, ...,
list(algo = j$algo.id),
j$algo.pars,
list(repl = j$repl),
- fun(j, BatchJobs:::getResult(reg, j$id, part), ...))
+ impute(reg, j, part, ...)
+ )
}
Fixed.
Didnt we discuss to implement this?
Michel, I thought we already had this, currently I don't see this anywhere in the code?
If it has not been done, this is a feature request to both of us, also for reduceResultsExperiments.