| dispatch_chunks | R Documentation |
Executes a function over chunks using the worker pool with supervision. Handles worker death and recycling transparently by requeuing failed chunks.
dispatch_chunks(
chunks,
fun,
...,
pool = NULL,
health_check_interval = 10L,
max_retries = 3L,
timeout = 3600,
scheduler_policy = NULL,
on_result = NULL,
store_results = TRUE,
retain_chunks = TRUE
)
chunks |
List of chunk descriptors. Each chunk will be passed to |
fun |
Function to execute. Receives (chunk, ...) as arguments. |
... |
Additional arguments passed to |
pool |
A |
health_check_interval |
Integer. Check pool health every N chunks (default 10). |
max_retries |
Integer. Maximum retries per chunk before permanent failure (default 3). |
timeout |
Numeric. Seconds to wait for each chunk (default 3600). |
scheduler_policy |
Optional list of scheduling hints (advanced). Currently:
|
on_result |
Optional callback (advanced). If provided, called on the
master process as |
store_results |
Logical (advanced). If FALSE, successful chunk values are
not retained in the returned |
retain_chunks |
Logical (advanced). If FALSE, completed chunk descriptors are stored minimally (avoids retaining large shard lists in memory). |
A shard_dispatch_result object with results and diagnostics.
pool_create(2)
chunks <- list(list(id = 1L, x = 1), list(id = 2L, x = 2))
result <- dispatch_chunks(chunks, function(chunk) chunk$x * 2, pool = pool_get())
pool_stop()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.