Skip to content

Commit ae35a0e

Browse files
TESTS: Some speedup by avoiding print():ing Future:s
1 parent fb609c2 commit ae35a0e

File tree

8 files changed

+1
-20
lines changed

8 files changed

+1
-20
lines changed

tests/BatchtoolsFuture,gc.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ plan(batchtools_local)
66

77
for (how in c("resolve", "value")) {
88
f <- future({ 1 })
9-
print(f)
109

1110
if (how == "value") {
1211
v <- value(f)

tests/BatchtoolsFuture.R

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ message("*** BatchtoolsFuture() ...")
55
message("*** BatchtoolsFuture() - cleanup ...")
66

77
f <- batchtools_local({ 1L })
8-
print(f)
98
res <- await(f, cleanup = TRUE)
109
print(res)
1110
# future (>= 1.7.0-9000)
@@ -19,7 +18,6 @@ message("*** BatchtoolsFuture() - deleting exceptions ...")
1918

2019
## Deleting a non-resolved future
2120
f <- BatchtoolsFuture({ x <- 1 })
22-
print(f)
2321
res <- tryCatch({
2422
delete(f)
2523
}, warning = function(w) w)
@@ -44,7 +42,6 @@ message("*** BatchtoolsFuture() - registry exceptions ...")
4442

4543
## Non-existing batchtools registry
4644
f <- BatchtoolsFuture({ x <- 1 })
47-
print(f)
4845

4946
## Hack to emulate where batchtools registry is deleted or fails
5047
f$state <- "running"
@@ -69,15 +66,13 @@ message("*** BatchtoolsFuture() - registry exceptions ... DONE")
6966
message("*** BatchtoolsFuture() - exceptions ...")
7067

7168
f <- BatchtoolsFuture({ 42L })
72-
print(f)
7369
res <- tryCatch({
7470
loggedError(f)
7571
}, error = function(ex) ex)
7672
print(res)
7773
stopifnot(inherits(res, "error"))
7874

7975
f <- BatchtoolsFuture({ 42L })
80-
print(f)
8176
res <- tryCatch({
8277
loggedOutput(f)
8378
}, error = function(ex) ex)
@@ -110,7 +105,6 @@ if (fullTest && availableCores(constraints = "multicore") > 1) {
110105
Sys.sleep(5)
111106
x <- 1
112107
})
113-
print(f)
114108

115109
res <- tryCatch({
116110
value(f)

tests/BatchtoolsFutureError.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ for (cleanup in c(FALSE, TRUE)) {
1414
print(x)
1515
stop("Woops!")
1616
})
17-
print(f)
1817

1918
resolve(f)
2019

tests/batchtools_custom.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ f <- batchtools_custom({
6464
stop("Whoops!")
6565
1
6666
}, cluster.functions = cf)
67-
print(f)
6867
v <- value(f, signal = FALSE)
6968
print(v)
7069
stopifnot(inherits(v, "simpleError"))

tests/batchtools_interactive.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ f <- batchtools_interactive({
2828
c <- 2
2929
a * b * c
3030
})
31-
print(f)
3231

3332
## Although 'f' is a batchtools_interactive future and therefore
3433
## resolved/evaluates the future expression only
@@ -55,7 +54,6 @@ f <- batchtools_interactive({
5554
stop("Whoops!")
5655
1
5756
})
58-
print(f)
5957
v <- value(f, signal = FALSE)
6058
print(v)
6159
stopifnot(inherits(v, "simpleError"))

tests/batchtools_local.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ f <- batchtools_local({
2828
c <- 2
2929
a * b * c
3030
})
31-
print(f)
3231

3332
## Although 'f' is a batchtools_local future and therefore
3433
## resolved/evaluates the future expression only
@@ -55,7 +54,6 @@ f <- batchtools_local({
5554
stop("Whoops!")
5655
1
5756
})
58-
print(f)
5957
v <- value(f, signal = FALSE)
6058
print(v)
6159
stopifnot(inherits(v, "simpleError"))

tests/future,labels.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,18 @@ for (strategy in strategies) {
1212
fcn <- get(strategy, mode = "function")
1313
stopifnot(inherits(fcn, strategy))
1414
f <- fcn(42, label = label)
15-
print(f)
1615
stopifnot(identical(f$label, label))
1716
v <- value(f)
1817
stopifnot(v == 42)
18+
print(f)
1919

2020
f <- future(42, label = label)
21-
print(f)
2221
stopifnot(identical(f$label, label))
2322
v <- value(f)
2423
stopifnot(v == 42)
2524

2625
v %<-% { 42 } %label% label
2726
f <- futureOf(v)
28-
print(f)
2927
stopifnot(identical(f$label, label))
3028
stopifnot(v == 42)
3129

tests/globals,manual.R

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ f <- future({
2929
x <- 1:10
3030
sumtwo(a + b * x)
3131
}, globals = TRUE)
32-
print(f)
3332
rm(list = names(globals))
3433
y <- value(f)
3534
print(y)
@@ -55,7 +54,6 @@ f <- future({
5554
x <- 1:10
5655
sumtwo(a + b * x)
5756
}, globals = FALSE)
58-
print(f)
5957
rm(list = names(globals))
6058
y <- tryCatch(value(f), error = identity)
6159
if (!inherits(f, c("EagerFuture", "MulticoreFuture"))) {
@@ -74,7 +72,6 @@ f <- future({
7472
x <- 1:10
7573
sumtwo(a + b * x)
7674
}, globals = globals)
77-
print(f)
7875
v <- value(f)
7976
print(v)
8077
stopifnot(all.equal(v, v0))
@@ -96,7 +93,6 @@ f <- future({
9693
x <- 1:10
9794
sumtwo(a + b * x)
9895
}, globals = c("a", "b", "sumtwo"))
99-
print(f)
10096
rm(list = names(globals))
10197
v <- value(f)
10298
print(v)

0 commit comments

Comments
 (0)