Skip to content

Commit 9e82f03

Browse files
Canceled future throw FutureCanceledError, which inherits from FutureInterruptError
1 parent 554a2ee commit 9e82f03

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
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.68.0-9002
2+
Version: 1.68.0-9003
33
Title: Unified Parallel and Distributed Processing in R for Everyone
44
Depends:
55
R (>= 3.2.0)

R/backend_api-11.ClusterFutureBackend-class.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1523,7 +1523,11 @@ handleInterruptedFuture <- local({
15231523
pid <- node[["session_info"]][["process"]][["pid"]]
15241524
if (!is.null(pid)) msg <- sprintf("%s (pid %s)", msg, pid)
15251525
}
1526-
result <- FutureInterruptError(msg, future = future)
1526+
if (state %in% "canceled") {
1527+
result <- FutureCanceledError(msg, future = future)
1528+
} else {
1529+
result <- FutureInterruptError(msg, future = future)
1530+
}
15271531
future[["result"]] <- result
15281532

15291533
## Remove from backend

R/backend_api-11.MulticoreFutureBackend-class.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,11 @@ result.MulticoreFuture <- local({
419419
if (future[["state"]] %in% c("canceled", "interrupted")) {
420420
if (debug) mdebugf("Detected interrupted %s whose result cannot be retrieved", sQuote(class(future)[1]))
421421
msg <- sprintf("A future (%s) of class %s was interrupted, while running on localhost (pid %d)", label, class(future)[1], pid)
422-
result <- FutureInterruptError(msg, future = future)
422+
if (future[["state"]] %in% "canceled") {
423+
result <- FutureCanceledError(msg, future = future)
424+
} else {
425+
result <- FutureInterruptError(msg, future = future)
426+
}
423427
future[["result"]] <- result
424428

425429
## Remove from backend

0 commit comments

Comments
 (0)