Read the YAML content of _targets.yaml.
Usage
tar_config_yaml(config = Sys.getenv("TAR_CONFIG", "_targets.yaml"))Arguments
- config
Character of length 1, file path of the YAML configuration file with
targetsproject settings. Theconfigargument specifies which YAML configuration file thattar_config_get()reads from ortar_config_set()writes to in a single function call. It does not globally change which configuration file is used in subsequent function calls. The default file path of the YAML file is always_targets.yamlunless you set another default path using theTAR_CONFIGenvironment variable, e.g.Sys.setenv(TAR_CONFIG = "custom.yaml"). This also has the effect of temporarily modifying the default arguments to other functions such astar_make()because the default arguments to those functions are controlled bytar_config_get().
Storage access
Several functions like tar_make(), tar_read(), tar_load(),
tar_meta(), and tar_progress() read or modify
the local data store of the pipeline.
The local data store is in flux while a pipeline is running,
and depending on how distributed computing or cloud computing is set up,
not all targets can even reach it. So please do not call these
functions from inside a target as part of a running
pipeline. The only exception is literate programming
target factories in the tarchetypes package such as tar_render()
and tar_quarto().
Configuration
For several key functions like tar_make(), the
default values of arguments are controlled though
tar_config_get(). tar_config_get() retrieves data
from an optional YAML configuration file.
You can control the settings in the YAML
file programmatically with tar_config_set().
The default file path of this YAML file is _targets.yaml, and you can
set another path globally using the TAR_CONFIG
environment variable. The YAML file can store configuration
settings for multiple projects, and you can globally
set the default project with the TAR_PROJECT environment
variable.
The structure of the YAML file
follows rules similar to the config R package, e.g.
projects can inherit settings from one another using the inherits field.
Exceptions include:
There is no requirement to have a configuration named
"default".Other projects do not inherit from the default project` automatically.
Not all fields need values because
targetsalready has defaults.
targets does not actually invoke
the config package. The implementation in targets
was written from scratch without viewing or copying any
part of the source code of config.
See also
Other configuration:
tar_config_get(),
tar_config_projects(),
tar_config_set(),
tar_config_unset(),
tar_envvars(),
tar_option_get(),
tar_option_reset(),
tar_option_set(),
tar_option_unset(),
tar_option_with()
Examples
yaml <- tempfile()
tar_config_set(store = "my_store_a", config = yaml, project = "project_a")
tar_config_set(store = "my_store_b", config = yaml, project = "project_b")
str(tar_config_yaml(config = yaml))
#> List of 2
#> $ project_a:List of 1
#> ..$ store: chr "my_store_a"
#> $ project_b:List of 1
#> ..$ store: chr "my_store_b"