Pause aDocumentation Index
Fetch the complete documentation index at: https://docs.lagerdata.com/llms.txt
Use this file to discover all available pages before exploring further.
lager python script mid-run so you can inspect the bench with ad-hoc lager
commands (or a live Python prompt), then resume where it left off. Useful for a long test
that reaches a known trouble spot, or for checking on a device in an unknown state without
killing and restarting the run.
Introduced in lager 0.21.0.
Import
pause(label=None, *, timeout=None, interactive=False)
Blocks the script at the call site until it is resumed (or the timeout elapses).
| Argument | Default | Description |
|---|---|---|
label | None | A short note shown in the pause banner and console — e.g. the reason for the breakpoint. |
timeout | None | Seconds to wait before auto-resuming. None uses the LAGER_BREAKPOINT_TIMEOUT env var, or 300 s if unset. 0 waits indefinitely (until you resume). |
interactive | False | When True, also exposes a Python console attached to the paused script (see Interactive console). |
pause() is a safe no-op when it can’t pause — when the script isn’t running under
lager python (no breakpoint context), or when breakpoints are disabled.
It never raises.
Resuming
A paused script can be resumed three ways:- Press Enter in the terminal running the script (the foreground
lager pythonsession). lager python --continue <id> --box <box>— from any terminal, anywhere. Use theidfrom the banner. Handy when the script is detached or you’re already in another terminal.- Auto-resume — after the timeout (default 300 s) the script continues on its own and logs that it did. This keeps an unattended or forgotten breakpoint from hanging a run.
Controlling the auto-resume timeout
The default is 300 seconds. Override it per breakpoint, per run, or disable it entirely:timeout= argument → LAGER_BREAKPOINT_TIMEOUT env → 300 s default, so an
explicit timeout= in the script wins over the env var.
lager python --timeout is a different setting — the script’s total runtime limit, capped at
300 s on the box — and it will terminate the whole run when it elapses, paused or not. Leave it
at its default (0, unlimited) when using long breakpoint pauses.Interactive console
Withpause(interactive=True), the breakpoint also opens a Python console running inside the
paused script’s process, seeded with the variables in scope at the pause:
Ctrl+D disconnects (the script stays paused).
The console is for inspection: it operates on a snapshot of the script’s namespace, so
changes you make in the console do not carry back into the running script when it resumes.
Inspecting hardware while paused
Because a paused script holds no box-wide lock, you can run normallager commands against the
bench from another terminal while it waits:
- A device the script itself has open is claimed by the paused process. Reading it from a
second terminal returns a “device busy / claimed by another process” error. Read it through the
--consoleinstead — that runs in the same process and shares the open handle. - One net per physical instrument per process. Two nets on the same instrument can’t both be
open at once in a single script (e.g. the two channels of one Rigol DP821,
supply2/supply3, or the dual-role Keithley 2281S,supply1/battery1). Read them from separate terminals, or one at a time.
Built-in breakpoint()
Calling Python’s built-in breakpoint() in a lager python script triggers the same interactive
pause as lager.pause():
Disabling breakpoints
SetLAGER_BREAKPOINTS to an off value to turn every pause() (and breakpoint()) into a no-op
— useful for a clean, non-interactive run of a script that has breakpoints left in it:
off, 0, false, or no (case-insensitive).
Full example
test.py:
lager python --continue 7f3a…e9 --box mybox) and the
script finishes:

