Pipeline SDK
TTL, on-change, forever, and composed cache policies for pipeline steps.
Pass a cache policy to any step so its result is reused on the next run. A
policy decides when a cached step is still valid: for a fixed window
(ttl), until a tracked file changes (on_change), or until its command
changes (forever). Compose policies to require all of them.
ttl(duration) -> CacheTTL| Parameter | Type | Default | Description |
|---|---|---|---|
duration | timedelta | required | How long the cached result remains valid. |
on_change(*paths) -> CacheOnChange| Parameter | Type | Default | Description |
|---|---|---|---|
paths | str | () | — |
import harmont as hm
from datetime import timedelta
deps = hm.sh(
"make deps",
cache=hm.compose(
hm.on_change("requirements.txt"),
hm.ttl(timedelta(hours=6)),
),
)import { sh, compose, onChange, ttl } from "@harmont/hm";
const deps = sh("make deps", {
cache: compose(onChange("requirements.txt"), ttl(6 * 60 * 60)),
});See the cache reference for every policy.