Removes the package and metadata caches of condathis and of every registered backend, and nothing else:
For the built-in micromamba backend, the package cache,
pkgs, and the repodata cache,cache, in its data directory (seeget_install_dir()).For every other backend, its own package and metadata caches, and
conda-pkgsin its data directory.conda-pkgsis the package cache of the Conda tools that run in its environments (see Child processes inregister_backend()).The contents of the condathis cache directory,
tools::R_user_dir("condathis", "cache").
clean_cache() never deletes the per-user caches of conda, mamba and
micromamba, such as ~/.cache/conda, which other tools share.
Usage
clean_cache(verbose = c("output", "silent", "cmd", "spinner", "full"))Arguments
- verbose
Character string that controls the console output. One of:
"output": show the output of the command and the messages of condathis."silent": show nothing."cmd": show the command line."spinner": show only a spinner."full": show the command line, the output, and the backend's own log.
TRUEmeans"output"andFALSEmeans"silent". Every level except"silent"shows a spinner in interactive sessions. Invalid values abort with classcondathis_invalid_verbose(see condathis-conditions). The default is shown in Usage.The command line shown, the
cmdof a result and the messages ofcondathisshow the password and the token of a URL as*****.micromambadoes the same (https://user:*****@host/channel,https://host/t/*****/channel). The command still gets them.
Value
A condathis_result object, invisibly: a classed list with
status, stdout, stderr, timeout, pid, cmd and env_name.
The values come from the micromamba command that ran, and cmd is its
command line.
When no micromamba command ran, status is 0, timeout is FALSE
and the other fields are NA. pid is always NA, and so is
env_name: the caches are not tied to an environment.
Details
Environments keep the files of their packages. These files usually share
disk space with the package cache through hard links. You free that space
only by also removing those environments (see list_envs() and
remove_env()).
When the micromamba package cache does not exist, micromamba has nothing
to clean. clean_cache() then starts no process and does not install
micromamba. It still deletes the repodata cache and clears the condathis
cache directory.
clean_cache() loads a backend whose package condathis knows, such as
"rattler" of the rattlerthis package, when its data directory has
caches or environments. When that package is not installed,
clean_cache() does not clean its caches and warns with class
condathis_backend_not_installed.
clean_cache() waits until no other R session creates an environment
or installs packages. Those sessions wait until it is done (see Other R
sessions in create_env()).
When a backend fails to clean its caches, clean_cache() still cleans
the caches of the other backends and the directories above. Then it
aborts with the first failure. That error has the classes
condathis_clean_cache_failed and condathis_backend_error, and the
error of the backend as its parent. When clean_cache() cannot delete a
directory itself, it aborts with class condathis_clean_cache_failed the
same way.
See also
condathis-conditions for every condition class.
Other setup:
get_install_dir(),
get_sys_arch(),
install_micromamba(),
micromamba_bin_path(),
with_sandbox_dir()
Examples
condathis::with_sandbox_dir({
condathis::clean_cache(verbose = "output")
})
#> ✔ Cache successfully removed.