lager python script mid-run, inspect the bench, then resume where the
script left off. You can inspect it with ad-hoc lager commands or with a live
Python prompt. This helps on a long test that reaches a known trouble spot. It
also helps when you must check 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).
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. It is the script’s total runtime
limit, and the box caps it at 300 s. It terminates the whole run when it elapses,
whether the script is paused or not. Leave it at its default (0, unlimited) when
you use 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. Changes that you make in the console do not carry back into the
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
cannot both be open at once in a single script. Examples are the two channels of
one Rigol DP821,
supply2/supply3, and 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. Every pause() and breakpoint() call
then becomes a no-op, which gives a clean, non-interactive run of a script that
still has breakpoints in it:
off, 0, false, or no (case-insensitive).
Full example
test.py:
lager python --continue 7f3a…e9 --box mybox) and the
script finishes:

