Upgrade¶
Use nextpyp upgrade to move a running install to a new version. Upgrades are staged, checked, and only then swapped in.
Warning
Do not run ./install again to upgrade. After installed.toml exists it stops with nextPYP is already installed. Nothing to do. and names nextpyp upgrade. That is on purpose: it keeps the install script from overwriting a live container.
How to check downloads and signatures is on Security. Database copies are on Backup and restore.
Tip
If you want a safety net before a big jump, make a database copy first with nextpyp backup-db. The upgrade makes its own copy too, but one you made yourself is easy to find.
Upgrade to a new version¶
On an administrator install use sudo; on a regular-account install run ./nextpyp from the install folder.
nextpyp version
nextpyp latest
nextpyp upgrade 0.7.6
nextpyp latest prints the newest published version. Pass that version to nextpyp upgrade.
Here is what you’ll see, in order:
The release is downloaded while the website stays up. Progress lines are numbered, for example
[1/9] Check release 0.7.6,[2/9] Download the release,[3/9] Compute container. The signed manifest is checked first, then every file against it, and only a complete, verified release gets its directory underreleases/. A release with no manifest is refused. The compute container gets its name (pyp-<version>-<start of its SHA-256>.sif) only after its hash was checked, so one that is already there under that name is not downloaded or hashed again.Release notes for versions after the one installed are printed. A note marked breaking must be accepted (
--yeswhen there is no terminal).If jobs may be running, you choose how to handle them (see below).
The website is stopped, the database is copied, and only then are the new files swapped in.
The website is started again and the upgrade waits for it to answer. It ends with
nextPYP <version> is installed (previous: <old version>)., the path of the database snapshot, and the command that goes back.
A failed upgrade leaves the running version in place. Everything that can refuse is checked while the website is still running: the release signature and checksums, free space for the database snapshot, and a test run of both new containers. If the new version starts and does not answer, the upgrade puts the previous version back by itself, together with the database from before the upgrade; what the new version wrote is kept aside as local/db.failed-<version>-<time>. If the new version works and you want the old one anyway, run nextpyp rollback.
Note
Since the release that ships lib/nextpyp-core, each release is kept whole in releases/<version>-<id> inside the install directory, and current is a link to the one in use. The names you know (nextPYP.sif, nextpyp, lib) resolve into it. An upgrade or rollback changes that one link; the files of the other release stay in place. The first upgrade converts an existing install: its files become a release of their own, so you can roll back to them. workflows/ and templates/ stay real directories: a file you edited is kept and the release’s copy is written beside it as <name>.new.
Tip
Want to look before you leap? These forms change nothing live until you are ready. --prefetch is handy for getting the big download out of the way ahead of a maintenance window.
nextpyp upgrade 0.7.6 --check # report only
nextpyp upgrade 0.7.6 --prefetch # download and verify, change nothing live
Running jobs¶
If jobs may be running, the upgrade won’t surprise you. On a terminal it offers three choices:
Pause new jobs and wait for running ones to finish (recommended)Wait without pausingUpgrade now; running jobs finish on the old version
The recommended choice depends on the jobs. When a running job is pinned to a container that does not retry website calls, or when the job has no pinned container, drain is suggested. When every running job is pinned to a container that does retry, upgrading immediately is suggested. When drain is recommended, upgrading now asks you to type the version.
Flags for the same choices:
--drain— pause new jobs and wait (same as the recommended option when drain is suggested).--wait-for-jobs— wait without pausing.--no-wait— upgrade immediately.--timeout 30m— required with a wait when there is no terminal.
Note
Without a terminal, one of those is required when jobs may be running (a script or a cron job, for example). A wait also needs --timeout.
On a terminal, a wait asks every 10 minutes, says how many jobs are left, and offers Keep waiting or upgrade now. The same question is asked when --timeout is reached. The jobs themselves are listed once, before the choice is made.
To see what the upgrade sees, run nextpyp activejobs. It lists jobs the database has not finished, and the container each one is pinned to. The first line is the count and how many jobs are in each status. Each row shows the status changes and when they were recorded. When none are recent it prints No nextPYP jobs are running.
Note
activejobs does not ask SLURM. Only the last 30 days are listed as running. Older unfinished records are counted in one line and are not listed.
If you’d rather pause new jobs by hand, nextpyp maintenance on "upgrade" does that, and nextpyp maintenance off clears it.
Rollback¶
nextpyp rollback # program files only
nextpyp rollback --with-db # also restore the database snapshot
--with-db puts back the database copy the upgrade made. The rollback stops the website, switches back, and starts it again for you. An install that has never been upgraded by this program has no previous release, and the rollback says so.
Warning
Without a snapshot, rollback refuses unless you pass --accept-migrated-db. The refusal is there because the newer version may already have migrated the database, and rolling back the program files alone would not undo that.
A downgrade to an older release is refused unless you set PYP_ALLOW_DOWNGRADE=true.
Note
./install --replace replaces the program files of an existing install the same way an upgrade does: the release is verified, the database is snapshotted while the website is down, and the files that were there are kept as a release of their own, so nextpyp rollback returns to them. It also writes the systemd unit, the nextpyp command and the sudo rule again. It is how an install from before installed.toml existed is brought up to date. See Installer settings.
Disk space and the previous container¶
The compute container is stored as containers/pyp-<version>-<hash>.sif, where <hash> is the start of its SHA-256, with pyp.sif as a symlink, so a job that already has the file open keeps it. The previous container stays until you remove it, so an upgrade needs room for the new one beside it. The download checks the free space first and stops with There is not enough disk space for the compute container. before it fetches anything; nextpyp prune --when-idle frees it, and any other old container, once no job is running. With PYP_KEEP_PREVIOUS=false a successful upgrade removes the previous container by itself when no job is running.
PYP’s own code ships beside the container, as pyp-code.tar.gz in the release. The upgrade unpacks it read-only into containers/pyp-code-<release>/ and points the containers/pyp-code link at it, at the same moment pyp.sif switches; a rollback points it back. Jobs bind that code over the container’s, and a job keeps the code it started with, as it keeps its container. A release that changes only PYP’s code downloads a few MB and reuses the installed container.
nextpyp prune --when-idle deletes the old containers only when no job is running: every pyp-*.sif in containers/ but the one pyp.sif points at, an unfinished download left in containers/.staging (not while a download runs), and the pyp-code-* folders of releases that were removed. A container you put in containers/ by hand under a pyp-*.sif name goes too; keep such files elsewhere. When the last job pinned to an older container finishes, the website asks the host-processor to run that same command (using NEXTPYP_BIN, which nextpyp start exports). On an administrator install the shared programs folder is often not writable by the service account; in that case run prune as the administrator, or set PYP_PRUNE_TIMER=true before installing so an hourly timer does it as the administrator. PYP_KEEP_PREVIOUS=false removes the previous container at the end of a successful upgrade when no job is using it.
An install from v0.6.5 or earlier¶
An install from v0.7.3 or earlier has no installed.toml, so nextpyp upgrade cannot take it over. Download ./install of the new release into the install directory and run ./install --replace (with sudo for a system install). It verifies the new release, snapshots the database, keeps the old program files as a release that nextpyp rollback returns to, and leaves config.toml and the data alone. Plain ./install in such a directory stops with This folder already has an older nextPYP installation. After that run, the next upgrade is nextpyp upgrade.
Details¶
Interrupted downloads and swaps
If a download is interrupted (Ctrl-C, a closed window, a dropped connection), the partial file is kept and nothing that is in use has changed. Run the same command again: it prints Resuming from <size> and continues. A dropped connection is retried by itself, 10 times, 15 seconds apart, and each retry says why (<reason>; trying again in 15s). A download that makes no progress for several minutes is treated as dropped.
From the moment the website is stopped until the new version answers, Ctrl-C and a closed window do not interrupt the upgrade: it finishes on its own, and the transcript in logs/ has the output. If the machine itself goes down in that window, the upgrade is recorded as unfinished in .np/txn/active. nextpyp start and nextpyp upgrade then refuse and name the command that resolves it:
nextpyp recover
It reads the record and puts the install on one release: the previous one when the new version never answered (with the database from before the upgrade, when a snapshot was taken), the new one when it did. When the new version had started and no snapshot exists, nothing automatic touches the database; recover shows three commands and you choose: nextpyp recover --forward keeps the new version, nextpyp recover --back --accept-migrated-db goes back and keeps the database as it is, and nextpyp recover --back --db-from <directory> goes back with a database copy you name. nextpyp doctor and nextpyp upgrade --check only report an unfinished upgrade; they never change it.
An install without lib/nextpyp-core still uses the older swap: if the window closes during it, run the upgrade again. An interrupted swap is finished when the staged release matches SHA256SUMS. The message is The interrupted swap was completed. When the staged release is not verified, the previous version is restored.
A second install or upgrade is refused with Another install or upgrade is in progress (pid N on <host>). The lock is the directory .install.lock.d (flock is unreliable on NFS) together with a lock on .install.lock. A lock whose process is gone is taken over, and so is one left from before the machine was last restarted; a lock held from another host never is.
What can block the swap
nextpyp upgrade stops the website itself, and checks that it really stopped (the unit, the Apptainer instance named nextPYP, the processor sockets) before it touches the database. If the new version does not start or does not answer, the upgrade puts the previous release back, with the database from before, and starts it again. While releases are being switched the systemd unit is held off, so a start asked for in that moment is skipped, not half-done.
Before it stops the website, the upgrade runs each new container once (website java -version, compute pyp --version with --pwd /tmp). When a container does not run, the upgrade stops there and nothing was changed. PYP_SMOKE=false skips that test run. An install without lib/nextpyp-core runs nextpyp doctor --smoke after the swap instead, and restores the previous version if a database snapshot exists; otherwise it leaves the new files in place and tells you to run nextpyp rollback --accept-migrated-db.
Note
A database larger than 50 GiB stops an unattended upgrade before anything is changed, because it would not be copied. Set PYP_BACKUP_DB_MAX_GB above its size, run nextpyp backup-db first, or set PYP_BACKUP_DB=false to upgrade with no snapshot. See Backup and restore.
Before the copy, the upgrade writes a small probe file in the database directory. If that write fails, it says a disk quota is a likely cause, because df can still show free space when a quota is full. A download that cannot write says could not write the file on this machine with the system’s reason.
A certificate error from the release server is printed as curl or wget gave it. One that says the certificate is not yet valid, or has expired, usually means this machine’s clock is wrong.
Containers, installed.toml, and customized files
containers/fetch-status.json records a container download (downloading, verifying, verified, or failed). nextpyp fetch-status prints it, and the website reads it. The file is read-only (mode 0444) and is replaced whole each time, never edited.
Warning
Do not replace the compute container by hand with wget -O containers/pyp.sif. That follows the symlink and truncates the live pyp-<version>-<hash>.sif while jobs still have the file open. The file is mode 0444, but an account that can write the shared executables directory can still replace it that way.
If that happens by accident, nextpyp doctor reports that the compute container is missing or does not resolve, and nextpyp fetch-containers downloads and verifies it again. The container folder comes from pyp.container when that path is set.
An installed.toml that cannot be parsed is treated as an unknown install, and nextpyp doctor says installed.toml could not be read or parsed. Each release keeps its own pristine copy of workflows/, templates/ and cli/. A file you edited is left in place by an upgrade, and the release’s copy is written next to it as <name>.new; a file you did not edit follows the release; a file of your own is never touched.
After the new files are in place, the upgrade copies user-processor onto each setuid helper in shared/user-processors. One account that cannot be refreshed is reported and does not undo the upgrade. Rollback does the same with the restored user-processor. With web.userSwitch = "sudo" there are no per-user copies and nothing to refresh.
Environment variables
PYP_YES=1Accepts a breaking release note the way
--yesdoes.PYP_KEEP_PREVIOUS=falseDo not keep the previous compute container when disk is tight, or remove it at the end of a successful upgrade when no job is using it.
PYP_BACKUP_DB=false/PYP_BACKUP_DB_MAX_GBSkip the database copy, or raise the unattended size limit (default 50 GiB).
PYP_NO_RETRY_CONTAINERSComma-separated list of container file names; a job pinned to one of them makes drain the suggested choice.
PYP_NOTES_URLAddress of
releases.tomlwhen it is not the usual file on the release server.PYP_PRUNE_TIMER=trueInstall an hourly
nextPYP-prune.timer(set before installing).PYP_ALLOW_DOWNGRADE=trueAllow
nextpyp upgradeto a version older than the one installed.
Getting help
nextpyp support-bundle writes support-<timestamp>.tar.gz in the install directory and does not upload it. Passwords, mail settings, and proxy credentials are replaced with (redacted). Database backups are named in the archive and are not included. Review the file before you send it. See Operate and Troubleshooting.