-
Help
DescriptionWith |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
8ab2305 now implements I think this approach is appropriate when those settings do not invalidate previous work. In other words, if the right decision is to rerun the target when a setting changes, it would be preferable to avoid Anyway, here is an example where it is fine to use library(targets)
tar_option_set(
controller = crew::crew_controller_local()
)
tar_target(
name = target_name,
command = data.frame(x = 1),
format = tar_format(
read = function(path) {
readRDS(file = path)
},
write = function(object, path) {
version <- as.integer(Sys.getenv("SERIALIZATION", unset = ""))
saveRDS(object = object, file = path, version = version)
}
),
resources = tar_resources(
custom_format = tar_resources_custom_format(
envvars = c(SERIALIZATION = "3")
)
)
) |
Beta Was this translation helpful? Give feedback.
8ab2305 now implements
tar_resources_custom_format()
which allows you to send custom environment variables to the functions you define intar_format()
. These environment variables reach parallel workers. @noamross, this might be useful for #1232.I think this approach is appropriate when those settings do not invalidate previous work. In other words, if the right decision is to rerun the target when a setting changes, it would be preferable to avoid
tar_resources_custom_format()
and instead bake the setting's value into the body of aread
orwrite
function.Anyway, here is an example where it is fine to use
tar_resources_custom_format()
. No matter what serialization method you choose,rea…