Skip to contents

EDI uses an empirical, blocklist-first dispatch policy to decide when an inference routine's "bootstrap" or "rand_ci" resampling should be forced serial even if multiple cores are available (see get_parallel_dispatch_policy for the built-in table and the PCRE pattern/response-type matching rules it encodes). This function lets the user update that policy at runtime without editing package internals.

Usage

set_parallel_dispatch_policy(policy = NULL, reset = FALSE)

Arguments

policy

Either NULL (no change), a named list of policy-section overrides, or a custom dispatch function (see Details).

reset

If TRUE, restore the built-in default policy and remove any custom function override.

Value

Invisible NULL when policy is supplied (a mutation), or invisibly the current policy configuration list when called for its side-effect-free query/reset value.

Details

The policy can be updated in two mutually exclusive ways:

  • Pass a named list to policy to merge with the current policy configuration via modifyList, one section at a time. Supported top-level keys are bootstrap and rand_ci, and each key's value is itself a list that may contain serial_inference_class_patterns (character vector of PCRE regular expressions) and/or serial_response_types (character vector of exact response-type strings); an unrecognized top-level key raises an error rather than being silently ignored.

  • Pass a custom function with signature function(inference_class, response_type, operation) to policy to replace the entire pattern-table dispatch logic with your own rule; it must return a list with at least force_serial (logical) and reason (character). Supplying a function clears any list-based overrides accumulated so far and is stored separately from the pattern-table configuration.

Use reset = TRUE to discard both the list-based overrides and any custom function, restoring the package's built-in default policy exactly as returned by get_parallel_dispatch_policy. Do not expect a universal "more cores is faster" rule — this policy exists because several resampling workloads have shown consistent multicore slowdowns in package benchmarks.

See also

get_parallel_dispatch_policy for the policy schema and built-in defaults (including why this table is a safety blocklist, not a performance one); set_num_cores for setting the actual worker-count upper bound this policy operates within; tune_EDI_for_this_machine for the separate, machine-dependent question of when parallel execution is worthwhile (never applied here — this policy is only ever overridden explicitly, by you).

Examples

set_parallel_dispatch_policy(reset = TRUE)