Determines whether a task needs to be rerun by checking:
Task file modifications (file hash comparison)
Dependency file modifications (extracted from source() calls)
Cohort manifest changes — compares CohortManifest$getManifestHash() against the hash recorded on the previous run. A rerun is forced when the hash differs, when no hash was recorded (first run, or a legacy history row), or when the current hash cannot be computed at all.
Previous run errors (checked in logs and history)
Version changes. History is scoped by task, config block, and
pipeline_version, so separate test namespaces do not reuse one another's run state.
Usage
shouldRerunTask(
taskFile,
configBlock,
executionSettings,
pipelineVersion,
tasksFolderPath = here::here("analysis/tasks"),
cohortManifestHash = NULL
)Arguments
- taskFile
Character. Name or path of the task file (e.g., "task1.R")
- configBlock
Character. The config block name (e.g., "optum_dod")
- executionSettings
ExecutionSettings object
- pipelineVersion
Character. Current pipeline version (e.g., "1.0.0")
- tasksFolderPath
Character. Path to tasks folder (default: here::here("analysis/tasks"))
- cohortManifestHash
Character or NULL. A pre-computed cohort manifest hash (see
.getCohortManifestHash()). When NULL (default) it is computed here; callers that check many tasks in one run pass it in to avoid re-loading the manifest per task.
Value
List with elements:
should_rerun: Logical. TRUE if task should be rerun
reasons: Character vector. Why task should be rerun
last_run_info: List with previous run details (time, version, status)
task_file_hash: Current hash of task file
cohort_manifest_hash: Current hash of cohort manifest definitions