Date: 2026-04-16
Accepted.
Most chachaml operations need two pieces of implicit context:
We need a way for code inside a with-run block — including code many
calls deep — to find that context without threading a run-id and a
store handle through every signature.
Options considered:
^:dynamic): exactly the Clojure-shaped answer.
Lexically scoped via binding, automatically propagate to the same
thread, threadable to other threads via bound-fn.chachaml.context defines two dynamic vars:
(def ^:dynamic *store* nil)
(def ^:dynamic *run* nil)
chachaml.core/use-store! sets a global default by alter-var-root-ing
*store*. with-store and with-run rebind them lexically. Code in
chachaml.core reads *run* to determine where to attach logged data.
For multi-threaded use (parallel runs), users wrap their work with
bound-fn or pass the run map explicitly — a documented escape hatch.
binding.bound-fn); we document
this in the API for with-run.with-run
in the same thread becomes a child run, which matches user
expectations and is also the MLflow convention.Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |