RuntimeContext: Construct a RuntimeContext

View source: R/contexts.R

RuntimeContextR Documentation

Construct a RuntimeContext

Description

Captures reproducibility and backend settings. A context stored on an Engine configures direct Engine$run() calls. When supplied explicitly to run_cohort(), it configures the cohort and takes precedence over scalar seed/backend/worker controls; its replicate_id must be NULL because cohort replication is identified by sim_id.

Usage

RuntimeContext(
  seed = NULL,
  replicate_id = NULL,
  backend = "none",
  n_workers = NULL
)

Arguments

seed

Optional integer scalar; top-level seed. NULL = unseeded.

replicate_id

Optional integer scalar; stochastic replicate index for a direct Engine run. Cohorts use sim_id and reject a non-NULL value on an explicitly supplied RuntimeContext.

backend

Character scalar; one of "none" (default), "cluster", "mclapply", "future".

n_workers

Optional integer; number of parallel workers.

Details

The public reproducibility contract is: seed + draw_id + replicate_id + entity_id = deterministic output. Internal stream allocation (stream_id) is set by the run harness and must not be set by users directly.

Value

A list of class "RuntimeContext".


fluxCore documentation built on Sept. 22, 2026, 5:07 p.m.