CCPEM Pipeliner
Guide

Configuration

The settings file, its location on Linux and macOS, and the PIPELINER_* and RELION_* environment variables that override it


Overview

This page explains how to configure CCPEM-Pipeliner: where its settings file lives, how to read and modify it, and how environment variables let you override any setting without editing the file. Understanding configuration matters because pipeliner's defaults for MPI commands, queue submission, executable paths, and cluster templates are all drawn from one JSON file and a pair of PIPELINER_* / RELION_* environment variables — getting these right is the prerequisite for running any real processing job.


Prerequisites

Before working with pipeliner configuration you need:

  • Python ≥ 3.9 (tested on 3.10 in CI; declared compatible up to 3.14)
  • ccpem-pipeliner installed via pip install ccpem-pipeliner
  • Write access to your home directory (or the directory pointed to by XDG_CONFIG_HOME on Linux) so the settings file can be created on first run
  • Optional: a RELION installation, MPI runtime, or HPC scheduler if you intend to use those features — their paths and commands are what most settings control

Configuration

Settings file location

When pipeliner is first imported it looks for — and if absent, creates — a JSON settings file named ccpem-pipeliner-settings.json:

PlatformDefault path
Linux$XDG_CONFIG_HOME/ccpem/pipeliner/ccpem-pipeliner-settings.json (default ~/.config/ccpem/pipeliner/)
macOS~/Library/Application Support/ccpem/pipeliner/ccpem-pipeliner-settings.json

If the settings file directory is not writable, pipeliner logs:

WARNING: CCP-EM Pipeliner could not create a settings file at <path>. Settings can still be set using environment variables.

and continues with built-in defaults.

Resolution order

For each setting, pipeliner checks (highest priority first):

  1. PIPELINER_* environment variable (e.g. PIPELINER_QSUB_TEMPLATE)
  2. RELION_* environment variable fallback (e.g. RELION_QSUB_TEMPLATE)
  3. Value in ccpem-pipeliner-settings.json
  4. Built-in default

Important timing notes:

  • PIPELINER_PATH_TO_SOURCE_FILES and PIPELINER_ADDITIONAL_PROGRAM_PATHS are applied once when pipeliner is imported (via env_setup.setup_python_environment). Changes to these variables after import have no effect in the current process.
  • All other settings (queue name, qsub template, qsub command, etc.) are re-read from environment variables on every getter call. Queue and MPI settings only supply the default values of job options, so a change affects job files and jobs created after it, not a run.job or job.star file that already contains a value for that option.
  • The settings file itself is read once on first access within a process; edits to the file are not picked up until the process restarts.

Settings reference

Environment setup

Setting keyEnvironment variable(s)DefaultDescription
path_to_source_filesPIPELINER_PATH_TO_SOURCE_FILES[]PATH-separated list of shell scripts to source at import time (e.g. CCP4 setup). These are not program search paths.
additional_program_pathsPIPELINER_ADDITIONAL_PROGRAM_PATHS[]Directories prepended to PATH at import time so third-party executables are found.

External programs

Setting keyEnvironment variable(s)DefaultDescription
ctffind_executablePIPELINER_CTFFIND_EXECUTABLE, RELION_CTFFIND_EXECUTABLEctffindCTFFIND-4.1+ executable name or path.
gctf_executablePIPELINER_GCTF_EXECUTABLE, RELION_GCTF_EXECUTABLEGctfGctf executable.
motioncor2_executablePIPELINER_MOTIONCOR2_EXECUTABLE, RELION_MOTIONCOR2_EXECUTABLEMotionCor2MotionCor2 executable.
aretomo_executablePIPELINER_ARETOMO_EXECUTABLE, RELION_ARETOMO_EXECUTABLEAreTomo2AreTomo2 executable for tomography tilt-series alignment.
batchtomo_executablePIPELINER_BATCHTOMO_EXECUTABLE, RELION_BATCHTOMO_EXECUTABLEbatchruntomoIMOD batchruntomo executable.
resmap_executablePIPELINER_RESMAP_EXECUTABLE, RELION_RESMAP_EXECUTABLEResMap-1.1.4-linux64 (Linux) / ResMap-1.1.4-mac64 (macOS)ResMap local-resolution executable.
topaz_executablePIPELINER_TOPAZ_EXECUTABLE, RELION_TOPAZ_EXECUTABLErelion_python_topaz if on PATH, else topazTopaz particle-picking executable.
modelangelo_executablePIPELINER_MODELANGELO_EXECUTABLE, RELION_MODELANGELO_EXECUTABLErelion_python_modelangelo if on PATH, else modelangeloModelAngelo executable.
dynamight_executablePIPELINER_DYNAMIGHT_EXECUTABLE, RELION_DYNAMIGHT_EXECUTABLErelion_python_dynamight if on PATH, else dynamightDynaMight executable.
modelcraft_executablePIPELINER_MODELCRAFT_EXECUTABLEmodelcraftModelCraft executable. There is no RELION_MODELCRAFT_EXECUTABLE fallback.
cryocare_executables_dirPIPELINER_CRYOCARE_EXECUTABLES_DIR"" (empty)Directory containing cryoCARE executables for tomography jobs. No RELION fallback.

MPI and parallelism

Setting keyEnvironment variable(s)DefaultDescription
mpirun_commandPIPELINER_MPIRUN_COMMANDmpirun -n XXXmpinodesXXXCommand prepended to MPI jobs. XXXmpinodesXXX is substituted with the job's MPI count. Sets the default mpi_command job option; it is not a global MPI override.
default_nrmpiPIPELINER_DEFAULT_NRMPI, RELION_QSUB_NRMPI1Default number of MPI processes.
default_nrthreadsPIPELINER_DEFAULT_NRTHREADS, RELION_QSUB_NRTHREADS1Default number of threads per process.
mpi_maxPIPELINER_MPI_MAX, RELION_MPI_MAXNoneMaximum MPI processes shown in GUI spinners.
thread_maxPIPELINER_THREAD_MAX, RELION_THREAD_MAXNoneMaximum threads per process shown in GUI spinners.
minimum_dedicatedPIPELINER_MINIMUM_DEDICATED, RELION_MINIMUM_DEDICATEDNoneMinimum dedicated cores per node.
warning_local_mpiPIPELINER_WARNING_LOCAL_MPI, RELION_WARNING_LOCAL_MPINoneWarn when local jobs request more than this many MPI processes.

Queue / cluster submission

Queue submission is controlled by one primary boolean setting plus three related settings. Whether a specific job is actually submitted to the queue is determined per-job by that job's do_queue option, not globally.

Setting keyEnvironment variable(s)DefaultDescription
queue_usePIPELINER_QUEUE_USE, RELION_QUEUE_USEfalseSets the default value of each new job's do_queue option at job-creation time. Accepted true values (case-insensitive): yes, true, y, 1. All other values are false.
qsub_commandPIPELINER_QSUB_COMMAND, RELION_QSUB_COMMANDqsubThe command used to submit jobs to the cluster scheduler.
queue_namePIPELINER_QUEUE_NAME, RELION_QUEUE_NAMEopenmpiDefault queue name substituted into XXXqueueXXX in qsub templates.
qsub_templatePIPELINER_QSUB_TEMPLATE, RELION_QSUB_TEMPLATE"" (empty string)Path to the submission script template. Sets the default of each new job's Standard submission script: (qsubscript) option. If a job with queue submission enabled has an empty or missing template, run_job raises ValueError('Job cannot be run because: ...') and no job is created; RuntimeError('Error starting job <dir>') only occurs when an already-scheduled job is started and its template can no longer be read.
qsub_extra_countPIPELINER_QSUB_EXTRA_COUNT, RELION_QSUB_EXTRA_COUNT0Number of extra XXXextraNXXX placeholders in the qsub template.
scratch_dirRELION_SCRATCH_DIR""Scratch directory for temporary files. This is the only setting with no PIPELINER_-prefixed variable.

qsub template placeholders

The template supports these fixed substitution tokens:

PlaceholderSubstituted value
XXXnameXXXJob output directory
XXXmpinodesXXXNumber of MPI processes
XXXcoresXXXMPI processes × threads
XXXdedicatedXXXMinimum dedicated cores
XXXthreadsXXXThreads per process
XXXqueueXXXQueue name
XXXcommandXXXJob runner command
XXXerrfileXXXStandard error file
XXXoutfileXXXStandard output file
XXXextra1XXX … XXXextraNXXXPer-job qsub_extra_1 … qsub_extra_N values

Unrecognised placeholders (including misspelt known ones) trigger a RuntimeWarning. The template must not contain an mpirun or mpiexec command; MPI is controlled per-job via the mpi_command job option.

qsub extra variables

For each n from 1 to qsub_extra_count, three environment variables are recognised:

  • PIPELINER_QSUB_EXTRA<N> / RELION_QSUB_EXTRA<N> — label for the extra option
  • PIPELINER_QSUB_EXTRA<N>_DEFAULT / RELION_QSUB_EXTRA<N>_DEFAULT — default value
  • PIPELINER_QSUB_EXTRA<N>_HELP / RELION_QSUB_EXTRA<N>_HELP — help text

Each extra maps to a job option named qsub_extra_<N> whose value is substituted into XXXextraNXXX at submission time.

OneDep / EMPIAR deposition

Setting keyEnvironment variable(s)DefaultDescription
onedep_config_pathPIPELINER_ONEDEP_CONFIG_PATH<settings_dir>/onedep/config.tomlPath to the OneDep credential config TOML file. Linux default: ~/.config/ccpem/pipeliner/onedep/config.toml; macOS default: ~/Library/Application Support/ccpem/pipeliner/onedep/config.toml.
onedep_session_dirPIPELINER_ONEDEP_SESSION_DIR.onedep_sessionsDirectory (relative to the working directory) used to store OneDep deposition session state.

CCP-EM GUI integration

Setting keyEnvironment variable(s)DefaultDescription
ccpem_share_dirPIPELINER_CCPEM_SHARE_DIRauto-detected from ccpem-python pathPath to the CCP-EM share directory for rvapi display objects.

Usage

Checking your configuration

After installation, run the setup checker to verify that pipeliner finds all required executables and console scripts:

pipeliner.check_setup

The output has four sections: Python version, available job types, pipeliner console scripts, and a final report. A clean install on a workstation without RELION will report "The pipeliner is correctly installed, but some jobs are unavailable" — that is normal. "The pipeliner is not installed correctly" means a console script is missing; fix it with:

pip install --force-reinstall ccpem-pipeliner

Editing the settings file

Open ~/.config/ccpem/pipeliner/ccpem-pipeliner-settings.json (Linux) or ~/Library/Application Support/ccpem/pipeliner/ccpem-pipeliner-settings.json (macOS) in any text editor. The file is plain JSON. For example, to point pipeliner at a specific MotionCor2 build:

{
  "motioncor2_executable": "/software/motioncor2/2.1.0/MotionCor2",
  "default_nrmpi": 4,
  "default_nrthreads": 8
}

Settings file changes take effect the next time you start a new Python process; they are not re-read mid-session.


Overriding settings with environment variables

Environment variables take precedence over the settings file and are checked on every getter call. Set them in your shell profile, in a module file (on HPC), or inline before a command:

# Use a site-wide MotionCor2 binary
export PIPELINER_MOTIONCOR2_EXECUTABLE=/opt/motioncor2/MotionCor2

# Use a SLURM submission command instead of the default qsub
export PIPELINER_QSUB_COMMAND=sbatch

# Point at your facility's qsub template
export PIPELINER_QSUB_TEMPLATE=/etc/pipeliner/slurm_template.sh

# Enable queue submission by default for all new jobs
export PIPELINER_QUEUE_USE=yes

# Set the queue/partition name
export PIPELINER_QUEUE_NAME=gpu

# Use 4 MPI processes by default
export PIPELINER_DEFAULT_NRMPI=4

# Add site software to PATH for pipeliner to find executables
export PIPELINER_ADDITIONAL_PROGRAM_PATHS=/opt/relion/bin:/opt/ctffind/bin

PIPELINER_ADDITIONAL_PROGRAM_PATHS and PIPELINER_PATH_TO_SOURCE_FILES must be set before importing pipeliner (i.e. before any pipeliner command runs); all other variables can be set at any time.


Sourcing environment setup scripts

If your site packages (e.g. CCP4) require sourcing a shell script to populate environment variables, list the scripts in PIPELINER_PATH_TO_SOURCE_FILES:

export PIPELINER_PATH_TO_SOURCE_FILES=/opt/ccp4-9/bin/ccp4.setup-sh

Multiple scripts are separated by :. These scripts are sourced before job execution so their environment is inherited by the job process. This is not a search path for executables — use PIPELINER_ADDITIONAL_PROGRAM_PATHS for that.


Accessing settings programmatically

Use the getter functions in pipeliner.user_settings:

from pipeliner import user_settings

print(user_settings.get_mpirun_command())      # 'mpirun -n XXXmpinodesXXX'
print(user_settings.get_qsub_command())        # 'qsub'
print(user_settings.get_queue_name())          # 'openmpi'
print(user_settings.get_queue_use())           # False
print(user_settings.get_ctffind_executable())  # 'ctffind'
print(user_settings.get_default_nrmpi())       # 1
print(user_settings.get_qsub_extra_count())    # 0

These functions always reflect the current environment variables, so you can change a variable mid-script and the next call will pick it up (except for path and source-file settings, which are applied at import time).


Configuring OneDep credentials

Create the OneDep credential file from your refresh token using:

pipeliner.setup_onedep_credentials

By default the credential file is written to ~/.config/ccpem/pipeliner/onedep/config.toml (Linux) or ~/Library/Application Support/ccpem/pipeliner/onedep/config.toml (macOS). Override the path with PIPELINER_ONEDEP_CONFIG_PATH.


Examples

Example 1 — Read the current MPI command from the Python API

from pipeliner import user_settings

mpi_cmd = user_settings.get_mpirun_command()
print(mpi_cmd)

Example 2 — Override the CTFFIND executable via environment variable, then read it back

import os
os.environ["PIPELINER_CTFFIND_EXECUTABLE"] = "/opt/ctffind/4.1.14/ctffind"

from pipeliner import user_settings
print(user_settings.get_ctffind_executable())
# /opt/ctffind/4.1.14/ctffind

Example 3 — Minimal settings file for an HPC cluster with SLURM

Create or edit ~/.config/ccpem/pipeliner/ccpem-pipeliner-settings.json:

{
  "qsub_command": "sbatch",
  "qsub_template": "/etc/pipeliner/slurm_template.sh",
  "queue_name": "em_queue",
  "queue_use": false,
  "default_nrmpi": 4,
  "default_nrthreads": 8,
  "mpirun_command": "mpirun -n XXXmpinodesXXX",
  "motioncor2_executable": "/opt/motioncor2/MotionCor2",
  "ctffind_executable": "/opt/ctffind/bin/ctffind",
  "additional_program_paths": ["/opt/relion/bin", "/opt/ctffind/bin"]
}

queue_use is left false so jobs run locally by default; individual jobs can still be submitted to the queue by setting their do_queue option to Yes.


Example 4 — qsub template with extra variables

Set qsub_extra_count to 1 and define the extra variable:

export PIPELINER_QSUB_EXTRA_COUNT=1
export PIPELINER_QSUB_EXTRA1="Account name"
export PIPELINER_QSUB_EXTRA1_DEFAULT="em_project"
export PIPELINER_QSUB_EXTRA1_HELP="Your HPC project account name"

Then reference XXXextra1XXX in your template:

#!/bin/bash
#SBATCH --job-name=XXXnameXXX
#SBATCH --ntasks=XXXmpinodesXXX
#SBATCH --cpus-per-task=XXXthreadsXXX
#SBATCH --partition=XXXqueueXXX
#SBATCH --account=XXXextra1XXX
#SBATCH --output=XXXoutfileXXX
#SBATCH --error=XXXerrfileXXX

XXXcommandXXX

Do not include mpirun or mpiexec in the template; MPI is handled per-job via the mpi_command job option.


Example 5 — Verify the installation and configuration

pipeliner.check_setup

A correctly installed system with some unavailable jobs (expected on a workstation without RELION) ends with:

===========================
The pipeliner is correctly installed, but some jobs are unavailable
===========================

If a console script is missing the final line reads The pipeliner is not installed correctly. Reinstall to fix:

pip install --force-reinstall ccpem-pipeliner

Example 6 — Read qsub extra settings programmatically

from pipeliner import user_settings

count = user_settings.get_qsub_extra_count()
for n in range(1, count + 1):
    extras = user_settings.get_qsub_extras(n)
    print(extras)
# {'name': '...', 'default': '...', 'help': '...'}

Troubleshooting

Settings file not created

Symptom: No ccpem-pipeliner-settings.json file appears after first use; log shows CCP-EM Pipeliner could not create a settings file at <path>.

Cause: The settings directory (~/.config/ccpem/pipeliner/ on Linux) is not writable.

Fix: Create the directory manually and ensure it is writable, then re-run:

mkdir -p ~/.config/ccpem/pipeliner
chmod u+rwx ~/.config/ccpem/pipeliner

Alternatively, use environment variables instead of the file; they work even when no file can be written.


RuntimeError on first settings access

Symptom: Importing pipeliner succeeds, but RuntimeError is raised the first time any setting is read.

Cause: pipeliner is running on an unsupported platform (not Linux or macOS).

Fix: pipeliner logs Unable to set up pipeliner python environment at import and raises RuntimeError lazily on first setting access. Use a supported OS. If you are on a supported OS, check that platform.system() returns 'Linux' or 'Darwin'.


Environment variable changes have no effect on path/source settings

Symptom: Changing PIPELINER_ADDITIONAL_PROGRAM_PATHS or PIPELINER_PATH_TO_SOURCE_FILES after pipeliner is already imported does not update PATH.

Cause: These settings are applied once during pipeliner.__init__ via env_setup.setup_python_environment(). Later changes to the environment variables are ignored for the current process.

Fix: Export the variables before starting the Python process:

export PIPELINER_ADDITIONAL_PROGRAM_PATHS=/software/relion/bin
python my_script.py

External program marked unavailable despite being installed

Symptom: pipeliner.check_setup shows '<command>' missing from system path for a program that is installed.

Cause: The executable is not on the PATH that pipeliner sees at import time. PIPELINER_ADDITIONAL_PROGRAM_PATHS may not have been set, or the wrong directory was listed.

Fix:

  1. Confirm the binary path: which MotionCor2 (or the relevant executable).
  2. Add the containing directory to PIPELINER_ADDITIONAL_PROGRAM_PATHS before importing pipeliner:
    export PIPELINER_ADDITIONAL_PROGRAM_PATHS=/path/to/bin
    
  3. Or set the specific executable environment variable (e.g. PIPELINER_MOTIONCOR2_EXECUTABLE=/full/path/MotionCor2).
  4. Re-run pipeliner.check_setup.

Queue submission fails with Error reading template submission script

Symptom: A previously scheduled job (for example one started by a schedule or by PipelinerProject.run_scheduled_job()) is marked Failed immediately with RuntimeError('Error starting job <dir>') and the underlying cause is ValueError('Error reading template submission script in: <path>').

Cause: The job's do_queue option (Submit to queue?) is Yes but its qsubscript option (Standard submission script:) points to a file that does not exist when the job is started. New jobs take the defaults for these options from queue_use (via PIPELINER_QUEUE_USE or the settings file) and qsub_template. pipeliner --run_job checks the template before creating the job, so there a missing template fails up front with ValueError: Job cannot be run because: File <path> not found and no job is added. An empty template path is likewise rejected before the job is created.

Fix: Either provide a valid template path:

export PIPELINER_QSUB_TEMPLATE=/path/to/your/slurm_template.sh

Or disable queue submission:

export PIPELINER_QUEUE_USE=no

Note that these variables only change the defaults for new jobs: existing jobs whose do_queue option is already set to Yes in their run.job or job.star files will still be submitted, using their own qsubscript value; edit those files to set Submit to queue? == No to run them locally, or to point Standard submission script: at a valid template.


Console scripts (pipeliner, pipeliner.check_setup, etc.) not found

Symptom: Running pipeliner or pipeliner.check_setup gives command not found.

Cause: Entry points were not installed correctly (e.g. after editing pyproject.toml without reinstalling).

Fix:

pip install --force-reinstall ccpem-pipeliner

RELION environment variables not picked up

Symptom: Setting RELION_QSUB_TEMPLATE has no effect.

Cause: A PIPELINER_QSUB_TEMPLATE environment variable is set (even to an empty string) and has higher priority than the RELION fallback. A value in the settings file cannot cause this: environment variables (PIPELINER_* first, then RELION_*) are checked before the settings file. Also check that the setting has a RELION_* fallback at all; some, such as mpirun_command, only accept the PIPELINER_* variable.

Fix: Check for competing settings:

printenv | grep -E 'PIPELINER_QSUB|RELION_QSUB'

Remove or unset the higher-priority variable, or switch to the PIPELINER_* form to be explicit:

unset PIPELINER_QSUB_TEMPLATE
export RELION_QSUB_TEMPLATE=/path/to/template.sh

Settings file edits not reflected in running process

Symptom: You edited ccpem-pipeliner-settings.json but the old values are still being used.

Cause: The settings file is read once per process on first access. Subsequent reads within the same process use the cached values.

Fix: Restart the Python process (or pipeliner CLI command). Alternatively, use environment variables, which are re-checked on every getter call:

export PIPELINER_QUEUE_NAME=new-queue