Skip to content

Commit e22dbe4

Browse files
authored
fix: load mlr3 packages of the main session on the worker (#1189)
* fix: load mlr3 packages of the main session on the worker * ...
1 parent 79524c5 commit e22dbe4

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# mlr3 (development version)
22

3+
* fix: The `mlr_reflections` were broken when an extension package was not loaded on the workers.
4+
Extension packages must now register themselves in the `mlr_reflections$loaded_packages` field.
5+
36
# mlr3 0.21.0
47

58
* BREAKING CHANGE: Deprecated `data_format` and `data_formats` for `Learner`, `Task`, and `DataBackend` classes.

R/helper_exec.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ future_map = function(n, FUN, ..., MoreArgs = list()) {
3535
lg$debug("Running resample() via future with %i iterations", n)
3636
future.apply::future_mapply(
3737
FUN, ..., MoreArgs = MoreArgs, SIMPLIFY = FALSE, USE.NAMES = FALSE,
38-
future.globals = FALSE, future.packages = "mlr3", future.seed = TRUE,
38+
future.globals = FALSE, future.packages = mlr_reflections$loaded_packages, future.seed = TRUE,
3939
future.scheduling = scheduling, future.chunk.size = chunk_size, future.stdout = stdout
4040
)
4141
}

R/mlr_reflections.R

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#' This environment be modified by third-party packages, e.g. by adding information about new task types
99
#' or by extending the set of allowed feature types.
1010
#'
11+
#' Third-party packages that modify the reflections must register themselves in the `loaded_packages` field.
12+
#'
1113
#' The following objects are set by \CRANpkg{mlr3}:
1214
#'
1315
#' * `task_types` (`data.table()`)\cr
@@ -153,6 +155,9 @@ local({
153155
### Logger
154156
mlr_reflections$loggers = list()
155157

156-
### cache package version
158+
### Cached package version
157159
mlr_reflections$package_version = packageVersion("mlr3")
160+
161+
### Loaded packages
162+
mlr_reflections$loaded_packages = "mlr3"
158163
})

man/mlr_reflections.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)