Emits a self-contained R script (worker.R) that executes one SLURM array
chunk on a compute node with zero dependency on slurmpilot itself. The
worker loads payload.rds and chunks.rds, validates checkpoint SHA-256
integrity before skipping completed chunks, initializes independent
L'Ecuyer-CMRG per-chunk / per-task parallel RNG streams via base
parallel::nextRNGStream() and parallel::nextRNGSubStream(), writes
atomic .rds result checkpoints with .sha256 sidecar digests and .json
status telemetry, and propagates non-zero exit codes on task failure.
Examples
script_lines <- render_worker_script()
head(script_lines, 10)
#> [1] "#!/usr/bin/env Rscript"
#> [2] "# Auto-generated by slurmpilot: standalone zero-dependency array chunk worker"
#> [3] "# Features: atomic checkpoints, SHA-256 sidecars, L'Ecuyer-CMRG parallel RNG streams"
#> [4] ""
#> [5] "parse_cli_args <- function(args) {"
#> [6] " out <- list("
#> [7] " work_dir = Sys.getenv('SLURMPILOT_WORK_DIR', unset = getwd()),"
#> [8] " chunk_id = Sys.getenv('SLURMPILOT_CHUNK_ID', unset = Sys.getenv('SLURM_ARRAY_TASK_ID', unset = '')),"
#> [9] " attempt = Sys.getenv('SLURMPILOT_ATTEMPT', unset = '1'),"
#> [10] " force = FALSE"
