workspace
workspace
#
The ambient live directory a body runs in, and the scratch's answer to T.new().
ScratchWorkspace is the Workspace the type system asks for fresh files
and tool runs: inside a memoized call they go to the call's live directory,
outside one to a live directory the value alone holds. Importing this module
provides it.
active_workspace = ContextVar('cg_active_workspace', default=None)
module-attribute
#
The live directory of the call running in this context, if any.
ScratchWorkspace
#
Bases: Workspace
Fresh files in the running call's live directory, or in one the value alone holds.
Source code in capturegraph-lib/capturegraph/scratch/values/workspace.py
allocate(cls, suffix)
#
A cls value at a fresh path in the ambient live directory.
Outside any call, a live directory is opened for this value alone and held by it.
Source code in capturegraph-lib/capturegraph/scratch/values/workspace.py
run(owner, argv, *, cwd, env, timeout, check, capture_output)
#
run_tool with the child's output streaming into owner's exec.log.
Source code in capturegraph-lib/capturegraph/scratch/values/workspace.py
computing(scratch, identity, label)
#
A fresh live directory to compute a call in, ambient and logged as a scope named label.
The block seals the directory or loses it: on any exception it is released,
and the exception carries the tail of its exec.log as a note.
Yields:
| Type | Description |
|---|---|
LiveDir
|
The live directory the block computes in. |
Source code in capturegraph-lib/capturegraph/scratch/values/workspace.py
exec_log(value)
#
Where a tool run by value logs, or None outside every live directory.
The ambient live directory's log, else that of the one value holds.