Skip to content

Commit 253257f

Browse files
BUG FIX: Respect options(warn=2) on workers [#794]
1 parent 91850c3 commit 253257f

File tree

3 files changed

+22
-2
lines changed

3 files changed

+22
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future
2-
Version: 1.49.0-9021
2+
Version: 1.49.0-9022
33
Title: Unified Parallel and Distributed Processing in R for Everyone
44
Depends:
55
R (>= 3.2.0)

NEWS.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@
1212
graphics devices explicitly (e.g. `pdf()` or `png()`) before
1313
plotting. Alternatively, explicitly set R option `device` inside
1414
the future expression.
15-
15+
1616
## Bug Fixes
1717

18+
* Setting `options(warn = 2)` on a parallel worker was ignored -
19+
warnings were not escalated to errors on the worker, and was
20+
instead relayed as-is in the parent R session, unless `options(warn
21+
= 2)` was also set in the parent. Now `options(warn = 2)` on a
22+
worker causes warnings to be escalated immediately to errors on the
23+
worker, which therefore also terminates the future.
24+
1825
* The `multicore` backend did not relay `immediateCondition`:s in a
1926
near-live fashion, but only when the results of the futures where
2027
collected.

R/backend_api-evalFuture.R

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,6 +1044,13 @@ evalFutureInternal <- function(data) {
10441044
!is.null(conditionClasses) &&
10451045
inherits(cond, conditionClasses)
10461046
) {
1047+
1048+
## SPECIAL CASE: If a warnings and option 'warn' is >= 2 on the
1049+
## worker, then let it escalate to an error here on the worker
1050+
if (inherits(cond, "warning") && getOption("warn") >= 2L) {
1051+
return()
1052+
}
1053+
10471054
## Relay 'immediateCondition' conditions immediately?
10481055
## If so, then do not muffle it and flag it as signaled
10491056
## already here.
@@ -1058,6 +1065,12 @@ evalFutureInternal <- function(data) {
10581065
}
10591066
} else {
10601067
if (!split && !is.null(conditionClasses)) {
1068+
## SPECIAL CASE: If a warnings and option 'warn' is >= 2 on the
1069+
## worker, then let it escalate to an error here on the worker
1070+
if (inherits(cond, "warning") && getOption("warn") >= 2L) {
1071+
return()
1072+
}
1073+
10611074
## Muffle all non-captured conditions
10621075
muffleCondition(cond, pattern = muffleInclude)
10631076
}

0 commit comments

Comments
 (0)