Skip to content

Commit 95b79a0

Browse files
Assert that there are expected 'actions' values when settings 'state' to legacy 'canceled' or 'interrupted'
1 parent 4973ce0 commit 95b79a0

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
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-9101
2+
Version: 1.68.0-9102
33
Title: Unified Parallel and Distributed Processing in R for Everyone
44
Depends:
55
R (>= 3.2.0)

R/backend_api-Future-class.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,20 @@ getExpression.Future <- local({
10181018
}
10191019
}
10201020
}
1021+
1022+
## FIXME: Automatically remap 'interrupted' and 'canceled' to 'finished'
1023+
## Could also set 'actions' to 'cancel' and 'interrupt' accordingly,
1024+
## if not already done
1025+
1026+
## Validate that 'actions' field is consistent with legacy 'state' values
1027+
if (is.element(value, c("canceled", "interrupted"))) {
1028+
actions <- future[["actions"]]
1029+
if (value == "interrupted") {
1030+
stop_if_not("interrupt" %in% actions)
1031+
} else if (value == "canceled") {
1032+
stop_if_not("cancel" %in% actions)
1033+
}
1034+
}
10211035
}
10221036

10231037
NextMethod()

0 commit comments

Comments
 (0)