Set the number of threads used by DVS operations
Description
Section titled “Description”Controls the thread pool size for parallel file operations (add, get, status).
The value is stored as the dvs.num_threads option and synced to the
Rust backend before each operation.
Details
Section titled “Details”Can also be set via .Rprofile or temporarily with withr::with_options().
Each add, get and status operation takes its thread count from the first rule that applies:
- A thread count set here or in the
dvs.num_threadsoption: that many threads, at most 32. - The
DVS_NUM_THREADSenvironment variable, when it is a whole number above 0: that many threads, at most 32. Any other value is ignored. - Otherwise 4 threads per CPU, at most 16.
An operation never uses more threads than it has files. NULL and 0 set
no thread count, so the operation falls through to DVS_NUM_THREADS or to
4 threads per CPU. --threads 0 in the CLI does the same.
set_dvs_threads(threads)Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
threads | A whole number of threads, or NULL or 0 to set no thread count. NA, a negative or fractional number, TRUE, FALSE, a string or more than one value raises a dvs_error_argument condition. |
The previous value of dvs.num_threads (invisibly).
Examples
Section titled “Examples”# Not run:set_dvs_threads(4)
# Temporarily use 2 threadswithr::with_options(list(dvs.num_threads = 2), { dvs_add(paths = "big_data.csv")})