Skip to content

Commit ba83cfb

Browse files
Truncate the call stack for using the default graphics device
1 parent f4fc456 commit ba83cfb

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-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-9016
2+
Version: 1.49.0-9017
33
Title: Unified Parallel and Distributed Processing in R for Everyone
44
Depends:
55
R (>= 3.2.0)

R/protected_api-FutureCondition-class.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,17 @@ DefaultDeviceMisuseFutureCondition <- function(message = NULL, incidents = NULL,
327327
message <- sprintf("%s (%s) opened the default graphics device", class(future)[1], label)
328328
if (length(incidents) > 0L) {
329329
calls <- lapply(incidents, FUN = lapply, deparse)
330+
calls <- lapply(calls, FUN = function(calls) {
331+
if (length(calls) > 3L) calls <- c(head(calls, n = 3L), "...")
332+
calls
333+
})
330334
calls <- lapply(calls, FUN = paste, collapse = " -> ")
331335
calls <- unlist(calls, use.names = FALSE)
332336
calls <- sprintf("%d: %s", seq_along(calls), calls)
333337
calls <- paste(calls, collapse = "; ")
334338
message <- sprintf("%s (%s) opened the default graphics device (%s)", class(future)[1], label, calls)
335339
}
336-
message <- sprintf("%s. This happens for instance if plot() is called without explicitly opening a graphics device before. Using default graphics devices in parallel processing will typically leave behind a 'Rplots.pdf' file on the parallel worker. If the intention is to plot to file, please open a graphics device explicitly (e.g. pdf() or png()) [recommended], or set your preferred `options(default = ...)` [not recommended], then plot, and make sure to close it at the end (i.e. dev.off())", message)
340+
message <- sprintf("%s. This happens for instance if plot() is called without explicitly opening a graphics device before. Using default graphics devices in parallel processing will typically leave behind an 'Rplots.pdf' file on the parallel worker. If the intention is to plot to file, please open a graphics device explicitly (e.g. pdf() or png()) [recommended], or set your preferred `options(default = ...)` [not recommended], then plot, and make sure to close it at the end (i.e. dev.off())", message)
337341
message <- sprintf("%s. See also help(\"future.options\", package = \"future\")", message)
338342
}
339343
cond <- FutureCondition(message = message, call = call, uuid = uuid, future = future)

0 commit comments

Comments
 (0)