For cluster administrators
Quachem Workbench submits a researcher’s calculations to a Slurm cluster over SSH, from a service that runs on the researcher’s own computer. This page lists every command the workbench sends to the login node, the schedule it polls on, how it logs in and what its Apptainer image build does. Each statement links to the source file that sets it, at commit fe8094d of the app repository.
The numbers
Section titled “The numbers”| Setting | Value | Source |
|---|---|---|
| Shortest interval between two polls of a target | 120 s, the default and the lowest value the settings accept | jobs/targets.py, lines 25 and 183 |
| Back-off while nothing changes | the interval doubles after each poll that finds no change | remote/polling.py, lines 126 to 130 |
| Longest interval | 600 s by default, settable from 120 s to 7200 s | jobs/targets.py, line 186 |
| Scheduler commands in one poll | one squeue, then one sacct for the jobs that left the queue (details below) |
executors/slurm.py, lines 365 to 402 |
| SSH connections per target | one interactive login, plus one to an automation host if the researcher configures one | remote/hub.py, lines 1 to 16 |
| SSH keepalive | every 30 s, connection treated as dead after 4 missed replies | remote/session.py, lines 43 and 44 |
| Jobs held by Slurm at once | 4 by default for a cluster target (--max-concurrent), one sbatch per job |
cli/admin_cmds.py, line 549 |
| Automatic reconnection after a drop | off by default | jobs/targets.py, line 182 |
| Image build job | 4 CPUs, 8 GB, 2 hours, in the target’s partition and account | remote/images.py, line 84 |
The 600 s maximum, the keepalive values and the build job’s resources are the project’s own provisional choices, recorded in the decision record.
Commands on the login node
Section titled “Commands on the login node”Every command is a fixed list of plain words with no shell syntax, built in remote/commands.py. <root> is the folder the researcher chose on the cluster, and <job folder> is <root>/jobs/<job id>.
| When | Command | How often |
|---|---|---|
| After each login | one bash -lc script that loads the target’s modules and reports id -un, nproc, which of sbatch squeue sacct scancel scontrol tar apptainer docker setsid nvidia-smi are on PATH, nvidia-smi --query-gpu=index and the SIF file’s size and digest file (remote/commands.py, lines 206 to 228) |
once per login, and once after an image build |
| Submission | mkdir -p <job folder>, tar -xf - -C <job folder> (the input and the batch script), then sbatch --parsable [--begin=now+<seconds>] <job folder>/job.sh (executors/slurm.py, lines 232 to 241) |
once per job |
| Poll | squeue -u <user> -h -o %i:%j:%T:%r (line 372) |
at most once per interval, for all of the target’s tracked jobs |
Poll, for jobs no longer in squeue |
sacct -j <id>,<id>,... -X -n -P -o JobID,JobName,State,ExitCode,Reason (line 405) |
in the same poll, only when some jobs left the queue |
Poll, when sacct reports that accounting is disabled |
scontrol -o show job <id> (lines 411 to 419) |
in the same poll, once per job that left the queue |
| Poll, for each running job | tail -c +<byte> <job folder>/output/progress.jsonl, a file read (executors/remote_common.py, lines 124 to 163) |
at most once per poll |
| A job has finished | tar -cf - -C <job folder> output qcw-state, which copies the results back (executors/remote_common.py, lines 78 to 122) |
once per job, again only if the copy is cut off |
| Neither Slurm nor accounting knows a job | the same tar copy, to read the exit code the job script wrote (executors/slurm.py, lines 421 to 429) |
once per such job |
| The researcher cancels a job | scancel <id> (lines 490 to 500) |
once per cancel |
| The researcher moves the start time or lowers the priority of a pending job | scontrol update JobId=<id> StartTime=now+<seconds> or Nice=<0 to 10000> (lines 502 to 546) |
once per change |
| The researcher builds the engine image | see The Apptainer image build | once per build |
The workbench sends no srun or salloc, starts no long-running process on the login node, and refuses --array and --requeue in a target’s extra #SBATCH lines (jobs/targets.py, lines 50 to 59).
The polling schedule
Section titled “The polling schedule”- The workbench keeps one poll gate per target (
remote/hub.py, lines 176 to 190). A poll sends onesqueue -ufor every tracked job of that target, so ten queued jobs cost the samesqueueas one. - Polls start at least
poll_secondsapart, 120 s by default. The settings refuse a lower value (jobs/targets.py, line 183). - After a poll that finds no change, the workbench doubles the interval, up to
max_poll_seconds(600 s by default). It returns to the minimum after a change, a submission, a cancel or a failed poll (remote/polling.py, lines 126 to 137). Even then, the next poll waits the minimum interval from the last one. - The workbench records the start of a poll before it sends any command, so a poll that fails still counts. It saves the time of the last poll to disk, so a restart of the service does not poll early (
remote/polling.py, lines 1 to 19). - A job whose state is final (completed, failed, cancelled or missing) is not polled again. When a target has no unfinished jobs, the workbench sends no poll at all (
executors/slurm.py, lines 315 to 319). - A newly submitted job counts as pending from
sbatch’s answer until the minimum interval has passed, so a submission does not trigger an immediatesqueue(lines 325 to 335). - While an image build runs, its checks (
sacct -j <build job>) go through the same gate and take turns with the job poll, so the target still receives at most one check per interval (remote/images.py, lines 826 to 856). - The invariant tests
test_polling_never_runs_more_often_than_every_two_minutesandtest_polling_never_runs_more_often_than_every_two_minutes_while_an_image_buildscheck the gate (tests/invariants/test_invariants.py).
Two cases send more than one accounting command in a poll. When both jobs labelled as an AI agent’s and unlabelled jobs leave the queue in the same poll, the workbench sends one sacct for each group, because the two groups may use different connections (executors/slurm.py, lines 386 to 401). On a cluster with accounting disabled, the workbench sends one scontrol -o show job per job that left the queue.
Three things happen outside the gate, each started by the researcher: a submission, a cancel or edit, and the Check the automation host button, which logs in to the automation host and runs one squeue (remote/hub.py, lines 564 to 620).
Raising the interval
Section titled “Raising the interval”The workbench reads both intervals from the researcher’s own target settings, so an administrator cannot set them from the cluster side. You can ask your users to raise them. A researcher sets the minimum when adding the target with qcw targets add-slurm --poll-seconds 300, which also sets the maximum to the larger of that value and 600 s (cli/admin_cmds.py, lines 521 to 528). For an existing target, qcw targets set --remote-file takes the remote settings as JSON, including poll_seconds (120 to 3600) and max_poll_seconds (120 to 7200, and at least poll_seconds).
The command line and AI agents
Section titled “The command line and AI agents”The qcw command line sends HTTP requests to the workbench service on 127.0.0.1 (cli/client.py, lines 316 to 359; service/host.py, line 431). The command-line package imports no SSH code, and the service alone holds the connections and the poll gates. Apart from the researcher’s own actions listed above (connecting, submitting, cancelling, the automation-host check and the image build), the API’s endpoints read the state of the last poll and send no command to the cluster. AI agents use the same command line, so the number of agents, scripts, terminals or browser windows does not change how often the service polls the cluster. qcw jobs wait follows jobs through the service’s event stream.
One service runs per data folder, enforced by a file lock (service/lock.py). A researcher who sets up two separate data folders, or two targets that name the same cluster, gets a separate gate and connection for each.
A job that carries an agent’s label never uses an automation host. It is submitted and checked only over the researcher’s own interactive login (remote/hub.py, lines 682 to 708).
SSH connections and logins
Section titled “SSH connections and logins”The workbench uses asyncssh 2.24.1 and keeps one authenticated connection per target. Each command runs on its own exec channel of that connection, so the cluster sees one login per connection and not one per command (remote/session.py). The test test_the_workbench_holds_one_authenticated_interactive_connection_per_target checks this (tests/invariants/test_remote_links.py).
- Keys. The workbench uses the key file named in the target’s settings and asks for its passphrase in the workbench window. Without one, asyncssh loads the
IdentityFileentries of~/.ssh/configor the default~/.ssh/id_*files (remote/session.py, lines 386 to 409). - SSH agent. The workbench offers the agent’s keys unless the researcher turns this off (
use_agent), and it reads~/.ssh/config, for example forProxyJump, unlessuse_ssh_configis off (lines 272 to 280). - Order of methods. Public key, then keyboard-interactive, then password. The workbench shows keyboard-interactive and password prompts, including Duo and device-code sign-ins, in the workbench window, and tries each prompted method once per login, so a wrong answer ends the login without repeated attempts (lines 123 to 173). A prompt expires after 300 s.
- Host keys. The workbench fetches and checks the host key before it logs in, and the login accepts only that key. It shows an unknown key’s SHA-256 fingerprint to the researcher, refuses a changed key or one marked
@revokedwithout asking, and keeps its ownknown_hostsfile beside reading~/.ssh/known_hosts(lines 349 to 384;remote/hostkeys.py). - Unattended logins. An automatic reconnect or an automation-host login never answers a prompt, and it stops at the first one. Automatic reconnection is off by default. When a researcher turns it on, the workbench waits 30 s, 60 s, 120 s, 300 s and then 600 s between attempts, and it retries only when the host could not be reached. After a refused login, a prompt or a host-key problem, it waits for the researcher (
remote/hub.py, line 51 and lines 430 to 446).
SSH certificates
Section titled “SSH certificates”User certificates are untested. From the code and asyncssh 2.24.1’s own source, the workbench should accept them in three cases:
- When the target names no key file, asyncssh loads
~/.ssh/id_*or theIdentityFileentries of~/.ssh/config, and with each it loads the<key>-cert.pubfile beside it. - When the target names a key file, the workbench reads the private key itself and passes it to asyncssh, which then does not look for
<key>-cert.pubbeside it. asyncssh still pairs the key with a certificate that aCertificateFileline in~/.ssh/confignames, whileuse_ssh_configis on. - When the SSH agent holds a certificate, asyncssh offers the keys the agent lists.
Host certificates are not used. The workbench passes asyncssh only the one host key it has checked, and it ignores @cert-authority lines (remote/hostkeys.py, line 94), so a researcher checks the host’s plain key fingerprint once.
The Apptainer image build
Section titled “The Apptainer image build”qcw targets image build puts the workbench’s engine container on the cluster as a SIF file. All of its steps use the researcher’s interactive login and never an automation host (remote/images.py, lines 681 to 748).
-
On the researcher’s computer,
docker savewrites the image to a file. -
On the login node, the workbench runs
mkdir -p <root>/imagesanddf -Pk <root>/images. It refuses the build unless the disk has about twice the archive’s size plus 1 GB free. -
The workbench streams the archive to
<root>/images/qcw-engine-<12 hex>.tar.partialwithsh -c 'cat > ...'. -
On the login node,
sha256sumreads the whole uploaded archive, and the workbench compares the result with the SHA-256 of the bytes it sent. The command may run for up to 600 s (line 201). -
The workbench renames the archive with
mv -f, writes a build script to<root>/images/build-<token>.shand submits it withsbatch --parsable. -
The build job runs on a compute node with 4 CPUs, 8 GB and a 2-hour limit, in the target’s partition and account. It loads the target’s modules and runs this one command (lines 330 to 365):
Terminal window apptainer build --force <root>/images/qcw-engine-<12 hex>.sif.partial docker-archive://<root>/images/qcw-engine-<12 hex>.tarAfter a successful build, the script renames the SIF into place, writes
<sif>.digest, deletes the archive and writes its exit code tobuild-<token>.exit. Slurm writes the job’s output tobuild-<token>.out. -
Each check of the running build is one
sacct -j <build job>(orscontrol -o show jobwithout accounting), through the target’s poll gate. Once Slurm reports the job as ended, the workbench reads the exit file withcat. -
After the build, the workbench runs the login probe again and
sha256sumon the SIF file, on the login node, to record the file’s checksum.
The command uses no definition file, no --fakeroot, no sudo and no --sandbox, and it runs under the researcher’s own account. The build script sets neither APPTAINER_TMPDIR nor APPTAINER_CACHEDIR, so Apptainer uses the site’s and the user’s defaults for temporary space. The Apptainer User Guide 1.5 does not say whether a docker-archive build without a definition file needs user namespaces, fakeroot or a setuid installation (Build a container, Docker and OCI, read 28 November 2026), and the workbench has not yet run this build against a real Apptainer installation, so the privileges your site needs for it are unknown. A researcher can skip the build and name an existing SIF file in the target’s settings (--image).
Disk use under <root>/images is about twice the archive’s size while the build runs, and about the size of the SIF afterwards, because the script deletes the archive. The workbench deletes no files on the cluster beyond its own partial files and the archive, and it never deletes job folders, so your scratch purge rules apply.
The batch job
Section titled “The batch job”Each calculation is one batch script in its job folder, with #SBATCH lines for the job name qcw-<job id>, one node, one task, --no-requeue, the CPUs, time limit and memory the researcher set, and --gres=gpu:<n> only for GPU jobs (remote/jobscript.py, lines 135 to 172). The script runs apptainer run --containall --cleanenv --net --network none, with --nv for GPU jobs and binds for the job folder and <root>/cache (lines 76 to 93). The engine makes no network calls.
- On the cluster, the workbench produces one SSH authentication per connection, and it reconnects by itself only if the researcher turned that on. It produces one
squeueper poll at most, at least 120 s apart, and nothing at all while a target has no unfinished jobs. - Command timeouts close only the command’s channel, so a slow
squeuedoes not cause a new login (remote/session.py, lines 446 to 468). The default timeout is 60 s (jobs/targets.py, line 190). - Slurm writes each job’s output to
<job folder>/qcw-state/slurm-<id>.outand the build’s output to<root>/images/build-<token>.out.
Open OnDemand and the Slurm REST API
Section titled “Open OnDemand and the Slurm REST API”The workbench reaches clusters only over SSH today. It does not support Open OnDemand or the Slurm REST API (slurmrestd), and the project is considering both for clusters that offer them. See the roadmap.
What has been tested
Section titled “What has been tested”- A containerised Slurm 23.11.4 cluster, built from Ubuntu 24.04’s packages, runs in continuous integration on every push to
main(.github/workflows/slurm-cluster.yml). The tests drive the real executor over asyncssh through submission, polling,sacctreconciliation, cancels, time limits, dropped connections and the job-folder fallback. Its nodes have a stand-in forapptainerthat accepts onlyrun, so these tests do not cover Apptainer itself or the image build (decision record, “The containerised Slurm test cluster”). - One university Slurm cluster (Slurm 26.05.6). Its real
squeue,sacctandscontroloutput was recorded on 27 November 2026 and parses unchanged (evidence). The recording ran over OpenSSH from a script, and the workbench has not yet submitted jobs there. That cluster runs containers with Pyxis and enroot and has no Apptainer, so the workbench’s real engine cannot run on it today. - The scontrol fallback for clusters without accounting, keyboard-interactive and Duo logins, and automation hosts are tested against an in-process fake cluster (
tests/remote_fakes.py).
Contact the project
Section titled “Contact the project”If your site has a rule the workbench breaks, or you want a different default, please open an issue on GitHub with the bug report form.
An open-source project on GitHub. Built by Graham Morley.