Skip to content

Commit d436889

Browse files
CLEANUP: batchtools registry is only created and the finalizer is only registered when the future is launched
1 parent ff58a85 commit d436889

File tree

4 files changed

+16
-19
lines changed

4 files changed

+16
-19
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
^.git
66
^.github
77
^.make
8+
^.local
89
^INSTALL[.]md$
910
^OVERVIEW[.]md$
1011
^README[.]md$

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
.ghi
1818
.issues
1919
.make
20+
.local
2021
revdep/data.sqlite
2122
revdep/checks/*
2223
revdep/library/*

NEWS

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
Package: future.batchtools
22
==========================
33

4-
Version: 0.9.0-9000 [2020-12-21]
4+
Version: 0.9.0-9000 [2020-12-23]
5+
6+
SIGNIFICANT CHANGES:
7+
8+
* Lazy batchtools futures only creates the internal batchtools registry when
9+
the future is launched.
510

611
DOCUMENTATION:
712

R/BatchtoolsFuture-class.R

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -127,28 +127,18 @@ as_BatchtoolsFuture <- function(future,
127127

128128
stop_if_not(is.list(resources))
129129

130-
## Create batchtools registry
131-
reg <- temp_registry(
132-
label = future$label,
130+
## batchtools configuration
131+
future$config <- list(
132+
reg = NULL,
133+
jobid = NA_integer_,
134+
resources = resources,
133135
conf.file = conf.file,
134136
cluster.functions = cluster.functions,
135-
config = registry
137+
registry = registry,
138+
finalize = finalize
136139
)
137-
debug <- getOption("future.debug", FALSE)
138-
if (debug) mprint(reg)
139-
140-
## batchtools configuration
141-
config <- list(reg = reg, jobid = NA_integer_,
142-
resources = resources)
143140

144-
future$config <- config
145-
146-
future <- structure(future, class = c("BatchtoolsFuture", class(future)))
147-
148-
## Register finalizer?
149-
if (finalize) future <- add_finalizer(future, debug = debug)
150-
151-
future
141+
structure(future, class = c("BatchtoolsFuture", class(future)))
152142
}
153143

154144

0 commit comments

Comments
 (0)