Repository navigation
Headless and HPC
golgi runs without a browser for scripting, CI, and cluster work. The golgi.Study API
is the headless surface; compute stages are dispatched through a pluggable JobRunner abstraction
that can run in-process, in a subprocess, or on a SLURM cluster.
Source: golgi/api.py (headless Study), golgi/jobs/ (protocol.py, schemas.py,
in_process.py, local_subprocess.py, slurm_runner.py, cancel.py),
golgi/cli.py (compute-worker).
golgi.Study drives the identical pipeline drivers the GUI uses, with no Trame/VTK. It synthesises a
local headless user so the auth-gated drivers run unchanged, and the
audit writer still records every action. See Python API for
the full method reference and examples/recruitment_sweep.py
for an end-to-end script.
import golgi
s = golgi.Study.create("/scratch/study_42")
s.import_nerve("nerve.stl"); s.run_mesh(); s.run_fem(); s.run_fibers()
...Studies are independent on disk, so the simplest way to parallelize a parameter study is to fan out
one process per Study (each in its own project directory).
Compute requests are typed dataclass schemas (golgi/jobs/schemas.py) with serialize() /
deserialize() — e.g. MeshConfig, ElectrodeConfig/ElectrodePatch, FiberSeedConfig,
SweepRequest/SweepResult, TetGenPayload. A JobRunner takes a request, streams stdout lines to
a callback, honours a CancelToken, and returns JobOutputs(return_code, outputs):
| Runner | Where it runs | Use |
|---|---|---|
| InProcessRunner | same process | tests, small jobs |
| LocalSubprocessRunner | child python process |
isolates the solver; streams its log; cancellable |
| SlurmJobRunner | a SLURM cluster | large meshes / big sweeps |
Cancellation (cancel.py) sends SIGTERM with a hard-kill fallback (and scancel on SLURM), so the
GUI's Cancel button and headless cancellation both work cleanly.
SlurmJobRunner serializes the request to a payload, renders an sbatch wrapper, submits with
sbatch --parsable, polls squeue, tails the job's .out file into the log callback, and (optionally)
rsyncs results back. The remote side is golgi compute-worker <payload.json> (see
Command-Line Interface), which dispatches on the payload's kind.
It is configurable (partition, account, cpus, memory, time limit, scratch root, poll interval, module loads, sync mode). Select it via environment:
export GOLGI_FEM_RUNNER=slurm
export GOLGI_SLURM_PARTITION=cpu-long
export GOLGI_SLURM_CPUS=8 GOLGI_SLURM_MEM_GB=32 GOLGI_SLURM_TIME=04:00:00A bundled shim fakes sbatch/squeue/scancel so the SLURM path can be exercised on a workstation:
export GOLGI_SBATCH="$PWD/tests/fake_sbatch.py" # run the wrapped command locally
python tests/fake_sbatch.py cleanup # wipe shim stateStatus. The SLURM runner, worker entry point, env dispatch, and fake-
sbatchshim are in place; the per-pipeline remote integration (and FEM checkpoint-resume) is staged work — see the feature roadmap (F4.2). For most users, fan-out overStudyprocesses (or the local subprocess runner) is the path today.
Python API · Command-Line Interface · Configuration Reference · Architecture
golgi · open image-to-recruitment modeling of peripheral nerve stimulation · repository · issues · AGPL-3.0-or-later · data CC-BY-4.0
Get started
Tutorial
Build a model
Simulate & analyze
- Finite-Element Solver
- Fiber Populations & Trajectories
- Fiber Models & Activation
- Recruitment Sweeps & Selectivity
- Recording & CNAP
Share & reproduce
Scripting & scale
Reference
Research & project