Job caching¶
If cache set to False (detected in the sequence of configuration files, Pipen constructor, and process definition), the job is running anyway regardless of previous runs.
If a previous run of a job fails, the job will be running anyway.
If a job is done successfully, a signature file will be generated for the job. When we try to run the job again, the signature will be used to check if we can skip running the job again but to use the results generated by previous run.
We can also do a force-cache for a job by setting cache to "force". This make sure of the results of previous successful run regardless of input or script changes. This is useful for the cases that, for example, you make some changes to input/script, but you don't want them to take effect immediately, especially when the job takes long time to run.
Job signature¶
The signature of a job (job.signature.toml) consists of the input types and data, the output types and data, and ctime — the maximum modification time over the rendered job script, the declared file/directory inputs and the declared outputs. Validation is modification-time based: pipen compares mtimes and never hashes file contents. So these situations will make job-cache checking fail (job will start over):
- Any changes in
inputoroutputtypes - Any changes in
inputoroutputdata - Any changes to
script - Any touches to input files — including a bare
touchwith no content change, which invalidates exactly the same jobs as editing the file's content (only the mtime is compared) - Any touches to input directories
- Use
dirsigas the depth to check the files under the directories - Otherwise if it is
0, only the directories themselves are checked. Note that modify a file inside a directory may not change the last modified time of the directory itself. -
Any deletions to the output files/directories Note that only the files/directories specified by
outputare checked. Files or subdirectories in the output directories will NOT be checked. -
Because only mtimes are compared,
touching a declared input invalidates the same job scope as a real content edit — the file's bytes are never looked at. ctimealso covers the rendered job script, so a value interpolated into the script that is not a modelled input (for example an absolute path taken fromenvs) invalidates every job of that process when it changes, even though no declared input or output changed.