TaskStateStore

Key-value state scoped to one task instance, shared across its retries within the same Dag run.

Values must be JSON-serializable. Every key has an expiry: by default the deployment's [state_store] default_retention_days, which the coordinator passes to the JVM as AIRFLOW__STATE_STORE__DEFAULT_RETENTION_DAYS; set also takes an explicit retention, or NEVER_EXPIRE for a key that garbage collection skips.

Values are stored in the metadata database as-is; the [workers] state_store_backend used by Python tasks is not applied here.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun clear()

Deletes every key stored for this task instance.

Link copied to clipboard
fun delete(key: String)

Deletes the value stored under key. Does nothing if the key is not set.

Link copied to clipboard
fun get(key: String): Any?

Reads the value stored under key.

Link copied to clipboard
fun set(key: String, value: Any, retention: Duration? = null)

Stores value under key, replacing any existing value.