File tree Expand file tree Collapse file tree 4 files changed +32
-2
lines changed
Expand file tree Collapse file tree 4 files changed +32
-2
lines changed Original file line number Diff line number Diff line change 11Package: BiocParallel
22Type: Package
33Title: Bioconductor facilities for parallel evaluation
4- Version: 1.43.1
4+ Version: 1.43.2
55Authors@R: c(
66 person("Martin", "Morgan",
77
Original file line number Diff line number Diff line change @@ -3,7 +3,11 @@ CHANGES IN VERSION 1.44
33
44NEW FEATURES
55
6- o (1.43.1) Support NULL return value from bplapply. see
6+ o (1.43.2) Lazy-load S4 classes in workers; see
7+ <https://github.com/Bioconductor/BiocParallel/issues/262>
8+ <https://github.com/Bioconductor/BiocParallel/pull/270>
9+
10+ o (1.43.1) Support NULL return value from bplapply; see
711 <https://github.com/Bioconductor/BiocParallel/issues/267>
812 <https://github.com/Bioconductor/BiocParallel/pull/269>
913
Original file line number Diff line number Diff line change 129129 timeout <- Inf
130130 timeout
131131}
132+
133+ # # This function walks through a nested list and attempts to trigger
134+ # # loading of any encountered S4 class definitions using getClassDef().
135+ # #
136+ # # Limitations:
137+ # # - It does NOT guarantee that all required packages will be loaded,
138+ # # because S4 objects may be hidden in attributes, environments, or other
139+ # # non-list structures that are not traversed here.
140+ .autoload_s4_classes <- function (obj ) {
141+ seen <- character ()
142+ recurse <- function (x ) {
143+ if (isS4(x )) {
144+ cl <- class(x )
145+ if (! cl %in% seen ) {
146+ seen <<- c(seen , cl )
147+ methods :: getClassDef(cl )
148+ }
149+ } else if (is.list(x )) {
150+ lapply(x , recurse )
151+ }
152+ }
153+ recurse(obj )
154+ }
Original file line number Diff line number Diff line change 311311
312312 t1 <- proc.time()
313313 value <- tryCatch({
314+ # # Lazy loading causes some packages fail to load in the worker
315+ # # environment. This works in 99% cases (see function comments).
316+ .autoload_s4_classes(msg $ data $ args $ X )
314317 do.call(msg $ data $ fun , msg $ data $ args )
315318 }, error = function (e ) {
316319 # # return as 'list()' because msg$fun has lapply semantics
You can’t perform that action at this time.
0 commit comments