R/status-calculators.R
statusCalculate_family.RdA family of ready-made quoted expressions for the statusCalculate
argument of experimentTmux() and experimentFuture(). Pass one of
these objects directly instead of writing a custom quote({...}) block:
experimentTmux(..., statusCalculate = statusCalculate_LandR)Each expression is evaluated once per queue row inside
tmuxRefreshQueueStatus(). Before evaluation the row's non-meta
columns are unpacked into the local environment by name, as are any
objects forwarded through .... The expression may assign to any subset
of the recognised meta-column names (started_at, finished_at,
heartbeat_at, heartbeat_iter, iterationsTotal, …) and should set
done <- TRUE to signal that the job has completed.
statusCalculate_FireSenseFit
statusCalculate_LandRA base::quote()d block expression (is.call(statusCalculate_FireSenseFit) is TRUE).
A base::quote()d block expression (is.call(statusCalculate_LandR) is TRUE).
statusCalculate_FireSenseFit: Heartbeat calculator for fireSense fire-spread simulations.
Scans the job's output directory for burnMap_year<XXXX>.tif files and
"Annual Fire Maps" output files to populate the queue meta-columns:
heartbeat_iterMost recent fire-map year found after the worker
claimed the job, or times$start if none yet.
heartbeat_atModification timestamp of that file
(NA until the first fire-map appears).
started_atModification timestamp of the running-flag file (i.e. when the worker claimed the job).
doneTRUE when a burnMap file containing year<times$end>
is found.
finished_atTimestamp of the final-year burnMap (set only when
done).
iterationsTotalThe end year extracted from the burnMap filename
(set only when done).
statusCalculate_LandR: Heartbeat calculator for LandR vegetation simulations.
Scans the job's output directory for cohortData_year<XXXX>.rds
checkpoint files (written at each SpaDES save event) and maps them to the
standard queue meta-columns:
heartbeat_iterCurrent simulation year reached (character).
heartbeat_atTimestamp of the latest checkpoint file.
started_atTimestamp of the earliest checkpoint file (may be
refined later by the running-flag-file logic in
tmuxRefreshQueueStatus()).
doneSet to TRUE when heartbeat_iter >= outs$times$end,
triggering a status transition to DONE.
finished_atTimestamp of the final checkpoint (set only when
done).
iterationsTotalThe end year as a character string (set only
when done).
The expressions below expect the following to be available, either as
queue-data-frame columns or as named objects in the ... passed to
tmuxRefreshQueueStatus():
pathBuildA function whose arguments match the queue columns
used to construct the output-directory path. For
statusCalculate_LandR the call is
pathBuild(.ELFind, .samplingRange, .GCM, .SSP, .rep).
outsA list (typically stored in dots_path and loaded into
the worker's environment before global.R is sourced) whose element
outs$times$end gives the simulation end year.
statusCalculate_FireSenseFit only)timesA list with elements $start and $end giving the
simulation start and end years (integers). Typically a queue column.