Installation and setup
How to install the biomero library, what your Slurm and OMERO servers need, and how to connect them. For a complete ready-made deployment use NL-BIOMERO instead (see the README Quickstart).
The package includes the SlurmClient class, which provides SSH-based connectivity and interaction with a Slurm (high-performance compute) cluster. The package enables users to submit jobs, monitor job status, retrieve job output, and perform other Slurm-related tasks. Additionally, the package offers functionality for configuring and managing paths to Slurm data and Singularity images (think Docker containers…), as well as specific FAIR image analysis workflows and their associated repositories.
Overall, the biomero package simplifies the integration of HPC functionality within the OMERO platform for admins and provides an efficient and end-user-friendly interface towards both the HPC and FAIR workflows.
Installation
Using pip (Cross-platform)
BIOMERO can be installed via pip with different dependency sets:
# Basic library only (core BIOMERO functionality)
python3 -m pip install biomero
# With BIOMERO.scripts requirements (includes BIOMERO.scripts dependencies)
python3 -m pip install biomero[full]
# Latest development version with BIOMERO.scripts requirements
python3 -m pip install 'git+https://github.com/NL-BioImaging/biomero[full]'
# With test dependencies (for local testing/development)
python3 -m pip install biomero[test]
# With both test and BIOMERO.scripts requirements
python3 -m pip install biomero[test,full]
Dependency sets explained:
Default (no extras): Core BIOMERO library for basic functionality
[test]: Adds pytest, coverage tools for local testing and development[full]: Adds BIOMERO.scripts requirements (ezomero,tifffile,omero-metadata,omero-cli-zarr, and the Zarr tooling) which require complex dependencies likezeroc-iceandomero-py
Note: The [full] dependencies require complex packages like zeroc-ice and omero-py that need system libraries. For OMERO integration, you may need to install these separately or use conda.
Optional remote shallowing
Installing the Python package does not install the helper image on Slurm. For a deployment using shallow Zarr:
Enable the importer integration and
BIOMERO_SHALLOW_ZARR=true. Remote shallowing is enabled withBIOMERO_REMOTE_SHALLOW_ZARR=true; without it, shallowing runs locally in the importer.Run Slurm Init to install the helper image, then Slurm Check Setup to verify it before submitting an analysis. The image is not configured: Slurm Init takes it from the installed
biomero-shallowerpackage and passes it to core. Workflow execution does not download a missing image; the workflow keeps its full results and logs a warning to run Slurm Init.
For deployment settings and resource configuration, see the remote shallower installation guide.
Long-running workflows
New in BIOMERO 2.9 — opt-in detached-workflow feature: The
BIOMERO_DETACHED_WORKFLOWSfeature flag is disabled when absent or false. Installing or upgrading BIOMERO therefore preserves inline execution in existing and custom deployments. Administrators can opt in after deploying a compatible background worker supervisor.
⚠️ Warning: Default settings are intended for short/medium jobs. For long workflows (>45min), review these limits and choose inline or detached execution deliberately:
Slurm jobs will timeout after 45 minutes — see Time Limit on Slurm
In inline mode, the top-level OMERO script and requesting OMERO session must remain available for the whole workflow. Long runs may therefore require increasing the OMERO script timeout and OMERO session timeout, and the user must follow the UI warning to keep the session active.
With
BIOMERO_DETACHED_WORKFLOWS=trueand a compatible worker supervisor, an accepted request continues in the background. The Slurm run, monitoring, and result import no longer depend on the browser or requesting session, so their total duration does not require long-lived OMERO sessions or an unusually large OMERO.web cookie. Normal timeouts must still cover request validation and each OMERO-side subprocess. See the NL-BIOMERO detached-workflow guide.
Slurm Requirements
This library is tested on Slurm 21.08.6 (NL-BIOMERO-Local-Slurm) and is used in
production on Slurm 22.05.09, 23.11.6 and 25.05.2 (SURF Spider). Other versions
are not tested systematically; the code avoids newer-only options (for example
it cancels jobs with scancel --user instead of --me).
Your Slurm cluster/login node needs to have:
SSH access w/ public key (headless), as the account that runs the jobs
SCP/SFTP access (generally comes with SSH), used for data transfer
Slurm with job arrays (container image pulls run as an array job) and Slurm accounting enabled (
sacct), which BIOMERO uses to find a job whose submission reply was lost and to track final job statesflock(util-linux) for the lock that makes job submission, input extraction and result archive creation safe to repeat after a lost connection. If your system has noflock, setslurm_lock_cmdto an equivalent toolCompatible ZIP tooling for result archiving:
7z/7za, or the Info-ZIPzipandunzippair (which also needsmktempand GNUfindwith-cnewer)Apptainer or Singularity on the compute nodes, to pull and run the workflow containers, and network access from the compute nodes to the container registry (for example Docker Hub). Apptainer 1.4 or newer builds images faster; older Apptainer and SingularityCE work too
A
bashon the compute nodes. The image pull worker is tested on bash 4.2 (CentOS 7)Standard shell tools that BIOMERO runs over SSH: GNU
grepwith-P(listing installed workflow versions and data),perl(reading job parameters from the job log),strings(binutils, tailing logs),awkandsed(Optional) Git installed, only if you intentionally use an external
slurm_script_repo(not recommended)(Optional) For remote shallowing of Zarr results: the same cluster, plus the helper image that Slurm Init installs (see above)
If your cluster uses Info-ZIP, set slurm_zip_cmd=zip. If it exposes only one
7-Zip binary or auto-detection is unreliable, configure that executable
explicitly. If it has no flock, set slurm_lock_cmd / BIOMERO_SLURM_LOCK_CMD.
When the client is set up with SlurmClient.from_config(init_slurm=True)
(core setup_slurm()), BIOMERO logs a WARNING for a missing lock command or
sacct, and carries on. The Slurm Init and Slurm Check Setup OMERO scripts
do not report missing commands. See the configuration docs linked below.
OMERO Requirements
Your OMERO processing node needs to have:
SSH client and access to the Slurm cluster (w/ private key / headless)
SCP access to the Slurm cluster
A Python version supported by the
biomeropackage (seerequires-pythonand the classifiers in pyproject.toml)This library installed
With BIOMERO.scripts dependencies:
python3 -m pip install biomero[full]Latest development:
python3 -m pip install 'git+https://github.com/NL-BioImaging/biomero[full]'
Configuration setup at
/etc/slurm-config.iniA PostgreSQL database for the workflow event store and its view tables (
sqlalchemy_urlin[ANALYTICS], or theSQLALCHEMY_URLenvironment variable); see slurm-configuration.rst for the lightweight deployment without it
For shared-storage result import and Zarr workflows, the processing node also needs
BIOMERO.importer (installed with biomero[full]).
For detached workflows, it needs a compatible background worker supervisor such as NL-BIOMERO’s
biomeroworker (see Long-running workflows).
Your OMERO server node needs to have:
Some OMERO example scripts installed to interact with this library:
My examples on github:
https://github.com/NL-BioImaging/biomero-scriptsInstall those at
/opt/omero/server/OMERO.server/lib/scripts/biomero/, e.g.git clone https://github.com/NL-BioImaging/biomero-scripts.git <path>/biomero
!!NOTE: Do not install Example Minimal Slurm Script if you do not trust your users with your Slurm cluster. It has literal Command Injection for the SSH user as a FEATURE.
Getting Started
To connect an OMERO processor to a Slurm cluster using the biomero library, users can follow these steps:
Setup passwordless public key authentication between your OMERO
processorserver and your HPC server. E.g. follow a SSH tutorial or this one.You could use 1 Slurm account for all
processorservers, and share the same private key to all of them.Or you could use unique accounts, but give them all the same alias in step 2.
Create a SSH config file named
configin the.sshdirectory of (all) the OMEROprocessorservers, within theomerouser’s home directory (~/.ssh/config). This file should specify the hostname, username, port, and private key path for the Slurm cluster, under some alias. This alias we will provide to the library. We provide an example in the resources directory.This will allow a uniform SSH naming, and makes the connection headless; making it easy for the library.
Test the SSH connection manually!
ssh slurm(as the omero user) should connect you to the Slurm server (given that you named itslurmin theconfig).Congratulations! Now the servers are connected. Next, we make sure to setup the connection between OMERO and Slurm.
At this point, ensure that the
slurm-config.inifile is correctly configured with the necessary SSH and Slurm settings, including the host, data path, images path, and model details. Customize the configuration according to the specific Slurm cluster setup. We provide an example in the resources section. To read it automatically, place thisinifile in one of the following locations (on the OMEROprocessorserver):/etc/slurm-config.ini~/slurm-config.ini
For an admin-managed deployment, set
BIOMERO_SLURM_CONFIG_FILEto the mounted configuration path. BIOMERO will then treat that file as authoritative instead of merging the default locations.For the BIOMERO Python client configuration details, including environment-variable overrides, precedence rules, and the runtime impact of newer options such as
env_file_submission,inject_gpu_flag,gpu_partition,gpu_gres,sacct_days_ago, andslurm_zip_cmd, see:In most installations, leave
slurm_script_repoempty and use BIOMERO’s generated job scripts. External script repositories are an advanced option and can drift out of sync with newer BIOMERO releases.If your cluster does not reliably propagate SSH session environment variables into
sbatchjobs, reviewinline_ssh_envand the optionalenv_file_submissionmode in the configuration docs before deployment.The configuration is read whenever
SlurmClient.from_config()is called, so a configuration file may be mounted at runtime. Ensure the mount exists before starting services that construct a client.Install OMERO scripts from OMERO Slurm Scripts, e.g.
cd /opt/omero/server/OMERO.server/lib/scriptsgit clone https://github.com/NL-BioImaging/biomero-scripts.git biomero
Install BIOMERO.scripts requirements:
If you installed
biomero[full]: All required dependencies (ezomero,tifffile,omero-metadata,omero-cli-zarr) are already includedManual installation (if using basic
biomerowithout[full]extras):install the packages listed under the
fullextra in pyproject.toml, at the pinned versionsAdditional system dependencies may be required:
yum install -y blosc-develInstall bioformats2raw (used by
omero-cli-zarrto export to Zarr) and put it on thePATH, e.g.unzip -d /opt bioformats2raw-<version>.zip && export PATH="$PATH:/opt/bioformats2raw-<version>/bin". Use the version that NL-BIOMERO’s biomeroworker Dockerfile installs.
To finish setting up your
SlurmClientand Slurm server, run it once withinit_slurm=True. This is provided in an OMERO script form at init/Slurm Init environment , which you just installed in previous step.You could provide the configfile location explicitly if it is not a default one defined earlier, but very likely you can omit that field.
Please note the requirements for your Slurm cluster. We do not install Singularity/Apptainer or the required archive tooling (
7z/7za, or Info-ZIPzipplusunzip) on your cluster for you.This operation will create the directories you configured in
slurm-config.ini, pull any described Singularity images to the server (note: might take a while), and by default generate job scripts for your configured workflows. It will only clone scripts from Git if you explicitly configureslurm_script_repo:
with SlurmClient.from_config(configfile=configfile,
init_slurm=True) as slurmClient:
slurmClient.validate(validate_slurm_setup=True)
With the configuration files in place, you can utilize the SlurmClient class from the biomero library to connect to the Slurm cluster over SSH, enabling the submission and management of Slurm jobs from an OMERO processor.
For more information about the new Admin interfaces, see NL-BIOMERO documentation
(Docker) containers
We host BIOMERO container dockerfiles at NL-BIOMERO, which publishes container images to our public dockerhub cellularimagingcf. Specifically the cellularimagingcf/biomero image is an OMERO processor container with BIOMERO library installed. When we release a new version of BIOMERO, we will also release a new version of these containers (because we deploy these locally at our Core Facility - Cellular Imaging in Amsterdam).
You can mount your specific configurations over those in the container, for example:
# Run the biomero container
echo "Starting BIOMERO..."
podman run -d --rm --name ${CONTAINER_BIOMERO} \
-e CONFIG_omero_master_host="${CONFIG_OMERO_MASTER_HOST}" \
-e OMERO_WORKER_NAME="${CONTAINER_BIOMERO}" \
-e CONFIG_omero_logging_level="${CONFIG_OMERO_LOGGING_LEVEL}" \
-e CONFIG_omero_upgrades_url="${CONFIG_OMERO_UPGRADES_URL}" \
-e CONFIG_omero_scripts_timeout="${CONFIG_OMERO_SCRIPTS_TIMEOUT}" \
-e PERSISTENCE_MODULE="${PERSISTENCE_MODULE}" \
-e SQLALCHEMY_URL="${BIOMERO_SQLALCHEMY_URL}" \
--network ${OMERO_NETWORK_NAME} \
--volume "${OMERO_DATA_PATH}":/OMERO:z \
--volume "${IMPORT_DATA_PATH}":/data \
--volume /opt/omero/slurm-config.ini:/etc/slurm-config.ini:Z \
--volume "${BIOMERO_SHARED_CONFIG_FILE}":/opt/omero/server/slurm-config.ini:z \
--volume "$(pwd)/logs/${CONTAINER_BIOMERO}:/opt/omero/server/OMERO.server/var/log:Z" \
--secret ssh-config,target=/tmp/.ssh/config --secret ssh-key,target=/tmp/.ssh/id_rsa --secret ssh-pubkey,target=/tmp/.ssh/id_rsa.pub --secret ssh-known_hosts,target=/tmp/.ssh/known_hosts \
--userns=keep-id:uid=${OMERO_SERVER_UID},gid=${OMERO_SERVER_GID} \
cellularimagingcf/biomero:"$NL_BIOMERO_VERSION"
This will spin up the docker container (in Podman) with omero config (-e CONFIG_omero_..), mounting the required data drives (--volume /mnt/...) and adding a new slurm config (--volume /my/slurm-config.ini:/etc/slurm-config.ini) and the required SSH settings (--secret ...,target=/tmp/.ssh/...) to access the remote HPC.
Note: the BIOMERO.scripts are installed on the main server, not on the BIOMERO processor.
Note2: We will also update these containers with our own desired changes, so they will likely not be 1:1 copy with basic omero containers. Especially when we start making a nicer UI for BIOMERO. We will keep up-to-date with the OMERO releases when possible.
SSH
Note: this library is built for SSH-based connections. If you could, it would be a lot easier to just have the OMERO processor server and the slurm client server be (on) the same machine: then you can just directly call sbatch and other slurm commands from OMERO scripts and Slurm would have better access to your data.
This is mainly for those cases where you already have an external HPC cluster and want to connect your OMERO instance.
Theoretically, you could extend the SlurmClient class and change the run commands to not use SSH, but just a subprocess. We might implement this if we need it in the future.
But then you could also look at other Python libraries like submitit.
SlurmClient class
The SlurmClient class is the main entrypoint in using this library. It is a Python class that extends the Connection class from the Fabric library. It allows connecting to and interacting with a Slurm cluster over SSH.
It includes attributes for specifying paths to directories for Slurm data and Singularity images, as well as specific paths, repositories, and Dockerhub information for different Singularity image models.
The class provides methods for running commands on the remote Slurm host, submitting jobs, checking job status, retrieving job output, and tailing log files.
It also offers a from_config class method to create a SlurmClient object by reading configuration parameters from a file. Overall, the class provides a convenient way to work with Slurm clusters and manage job execution and monitoring.