Cancel a run in the web interface
Cancel a run in the web interface when you watch it on the board and see it go wrong. In this guide you start a run of the example pipeline run_program that sleeps for five minutes, and cancel it from its card. At the end, the card has the mark cancelled, and codeband show prints cancelled by with your user name. If a function step fails, see Troubleshooting at the end of this page.
Before you start
Section titled “Before you start”- You did the Quickstart: you have a clone of codeband with the binary at
build/codeband, built withjust build, which builds the page into the binary. - Your terminal is in the
codebandfolder. Run each command from there unless a function step says otherwise.
How the web interface cancels a run
Section titled “How the web interface cancels a run”codeband dev serves the page, as codeband web does, and passes its calls on to the daemon, as codeband cancel does in a terminal. Every daemon client can cancel every run, so you can cancel in the web interface a run that someone started in a terminal. codeband dev makes a secret token at each start and prints its address with the token. The page takes the token from the address and sends it with each call, and codeband dev refuses a call without it. The daemon records the user who runs codeband dev as the one who cancelled.
-
Start the daemon, the code server and the web interface
If
codeband devfrom the Quickstart still runs, skip this step: it has loadedrun_programtoo and serves the web interface. Otherwise, open a second terminal, change to thecodebandfolder, set your Claude Code login as in the Quickstart, and startcodeband devin the example:Terminal window just examples/py-factory/devcodeband devprints the address of the web interface with a secret token to stdout. Then the code server logs the pipelines it loaded,run_programamong them, and the daemon logsListening. All three keep running. Your token is different:Output http://127.0.0.1:8765/?token=6EGHLUQPNTZGR2EWX2HUGA3KWQNov 25 18:56:08.687 INF Loaded pipelines comp=codeserver pipelines="[intake run_program ship_feature write_hello]" folder=…/codeband/examples/py-factoryNov 25 18:56:08.716 INF Serving pipelines comp=codeserver address=unix:~/.local/state/codeband/codeserver.sock -
Open the web interface
Open the address that
codeband devprinted in your browser. The page keeps the token, so the links of the page and a later address without the token, such ashttp://127.0.0.1:8765/?view=runs, work in this browser too. -
Start a run that goes on
Back in the first terminal, start a run of
run_programthat runssleep 300, with a title for its card.codeband devserves the example under the name of its folder,py-factory, so the pipeline ispy-factory/run_program:Terminal window build/codeband run -d py-factory/run_program --title "Sleep five minutes" --input '{"argv": ["sleep", "300"]}'-dstarts the run and returns at once.codeband runprints the run ID. Your run ID is different:Output 2zqeq4s51c -
Cancel the run from its card
In the browser, open the board of
run_program: click Board in the header, or openhttp://127.0.0.1:8765/?view=board&pipeline=py-factory/run_program. The cardSleep five minuteshas the markrunning, the running stepprogram, and a Cancel run button.Click Cancel run, and confirm the question
Cancel the run Sleep five minutes? …of the browser. The button readsCancelling…until the shell step stops. Then the card gets the markcancelledand the button goes away.The page for one run has the same button in its header. A run that has ended has no Cancel run button.
Check that it worked
Section titled “Check that it worked”Show the run in the first terminal, with the run ID that step 3 printed in place of RUN_ID:
build/codeband show RUN_IDThe status is cancelled, and the run journal names the user who runs codeband dev, here ada:
Run 2zqeq4s51cTitle Sleep five minutesPipeline py-factory/run_programStatus cancelled…
▸ program#0 shell step: sleep 300cancellation requested by ada✗ program#0 cancelled after 5.6scancelled by adaTo stop, press Ctrl-C in the terminal of codeband dev.
Troubleshooting
Section titled “Troubleshooting”For an error that this page doesn’t cover, see Run problems.
The header says This page has no token
Section titled “The header says This page has no token”You opened the page in a browser that has never opened the address with the token, for example by typing http://127.0.0.1:8765/. Open the address that codeband dev printed, with its ?token=.
The page shows the request has no token or a wrong one
Section titled “The page shows the request has no token or a wrong one”codeband dev started again since you opened the page, and each start makes a new token. Open the address that it printed last.
Related
Section titled “Related”- Web interface: the token, the board, the page for one run and what the web interface refuses.
- codeband cancel: cancel a run from a terminal and wait until it ends.
- Run: how a run ends, and what a cancellation stops.