run
run
#
run_call — one memoized call, in three steps.
- Ask the scratch for the key's memo (the three answers); results are served, with one log line saying the call was cached.
- On nothing, claim the key under its per-call lock and ask again: of any number of callers arriving together exactly one gets past this point, the rest block until it seals and then hit.
- Compute in a fresh workspace, under a log scope named after the function,
then seal what the body returned; a file already in the scratch is stored as
a hard link, since nothing there is written in place. A
Missingresult (any position, for a tuple) is not a result to seal: the workspace is released, one line is logged andMissingis returned, so the next call runs the body again.
run_call(key, identity, label, returns, body)
#
The results of the call key: served from the scratch, or computed and sealed.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
CallKey
|
The call's cache key. |
required |
identity
|
str
|
The function's cache identity, under which the call reports itself. |
required |
label
|
str
|
The function's name, which the call's step shows. |
required |
returns
|
ReturnSpec
|
The declared return type(s). |
required |
body
|
Callable[[], object]
|
The undecorated call, run only when nothing is sealed for |
required |