Configuration System
Omnibenchmark uses a configuration file to store settings such as paths and environment variables. This document describes both the user-facing aspects and the programmatic interface for developers.
File Location
The configuration file is stored at:
- Linux:
~/.config/omnibenchmark/omnibenchmark.cfg - macOS:
~/Library/Application Support/omnibenchmark/omnibenchmark.cfg
Format
The configuration file uses the INI format with sections and key-value pairs:
[section1]
key1 = value1
key2 = value2
[section2]
key3 = value3
Common Sections and Keys
Omnibenchmark uses the following standard configuration sections:
easybuild: Contains settings for Easybuild integrationMODULEPATH: Path to module installations-
ROBOTPATH: Path to easyconfigs repository -
dirs: Contains paths for dataset storage and git module caching datasets: Path to store benchmark datasets-
git_modules: Path to cache cloned git repositories (default:.omnibenchmark/git) -
conda: Applies to runs with the conda software backend (ob run,ob validate outputs) -
cache: Directory where Snakemake builds conda environments, passed asSNAKEMAKE_CONDA_PREFIX. Point several benchmarks (or users, on a shared filesystem) at the same directory and each environment is built once, keyed by the hash of its YAML. The directory must exist; if it is not writable, only environments already built there can be used. Default:out/.snakemake/conda, one per benchmark.Off by default. To share environments across your own benchmarks:
mkdir -p ~/.cache/omnibenchmark/conda ob config conda.cache ~/.cache/omnibenchmark/condaThe cache only grows; remove environment directories by hand to reclaim space. Do not pass
--conda-cleanup-envsto Snakemake with a shared cache: it deletes environments from the shared directory (in Snakemake 9.6, the ones the current workflow uses), including ones other benchmarks still need. -
channel_alias: Base URL of a conda channel mirror, set asCONDA_CHANNEL_ALIAS. Channels named in env files (conda-forge,bioconda) are then fetched from<channel_alias>/<channel>; channels given as full URLs bypass it. proxy: Anhttp(s)://host:portforward proxy, set asHTTP_PROXY/HTTPS_PROXYfor the Snakemake process — for compute nodes without direct internet access. Module jobs inherit it too.
Variables already exported in the shell take precedence over these keys.
[conda]
cache = /shared/conda-envs
# caching mirror of conda.anaconda.org
channel_alias = https://mirror.example.org/conda
# or, behind a forward proxy:
# proxy = http://proxy.example.org:3128
user: Default author forob create benchmark/ob create module; falls back to git'suser.name/user.emailnameemail
Values can be read and written from the command line with ob config section.key [value], listed with ob config --list, and removed with ob config --unset section.key.
Programmatic Access
The configuration system provides a Python API for reading and writing configuration values.
Reading Configuration Values
from omnibenchmark.config import config
# Get a value with a default if key doesn't exist
value = config.get('section', 'key', default='default_value')
Writing Configuration Values
from omnibenchmark.config import config
# Set a value
config.set('section', 'key', 'new_value')
# Save changes to disk
config.save()
Accessing Configuration Options
from omnibenchmark.config import config
# Get all sections
sections = config.sections()
# Get all keys in a section
keys = config.options('section')
Creating a Custom Configuration Accessor
In most cases, you should use the global config instance. However, you can create a custom accessor if needed:
from omnibenchmark.config import ConfigAccessor
from pathlib import Path
# Create a custom config accessor with a specific path
custom_config = ConfigAccessor(Path('/path/to/custom/omnibenchmark.cfg'))
# Use it the same way as the global config
value = custom_config.get('section', 'key', default='default_value')
Implementation Details
The configuration system is implemented in omnibenchmark/config.py. It provides:
- Platform-specific paths for configuration files
- A
ConfigAccessorclass that provides dict-like access to the configuration - Initialization of necessary directories
- Graceful handling of missing sections or keys
When adding new configuration options to Omnibenchmark, be sure to update this documentation with the new sections and keys.