Skip to content

Script Development / Task Context DFF.CTX

DFF.CTX is a temporary KV context scoped to a Task. The entry Script and imported Scripts within the same Task can share the same context; the context is not persisted.

API

Call Return Value Description
DFF.CTX.has(key) bool Check whether the Key exists
DFF.CTX(key) / DFF.CTX.get(key) Any value Read the specified Key
DFF.CTX.get_all() dict Read the entire context
DFF.CTX.set(key, value) None Write the specified Key
DFF.CTX.delete(key) None Delete the specified Key
DFF.CTX.clear() None Clear the context
Example
1
2
3
4
5
6
7
8
DFF.CTX.set('trace_meta', {'source': 'api'})

if DFF.CTX.has('trace_meta'):
    meta = DFF.CTX('trace_meta')

all_context = DFF.CTX.get_all()
DFF.CTX.delete('trace_meta')
DFF.CTX.clear()

get(...) and get_all() return independent snapshots. Modifying the return value will not update the saved context; you need to call set(...) again. Stored values should remain JSON-compatible.

When you need to save state across different Tasks, use DFF.STORE or external storage.