CCPEM Pipeliner
Concept

Key Concepts

Glossary of the core ideas: projects, jobs, nodes, the pipeline graph, job status and plugins


Overview

This page defines the core vocabulary of CCPEM-Pipeliner: the building blocks you work with every time you design, run, or automate a cryoEM processing workflow. Understanding these concepts — projects, jobs, nodes, the pipeline graph, job status, and plugins — is essential before reading the how-to guides or the API reference, because every CLI flag and every Python method is described in terms of them.


Content

Project

A project is the top-level unit of work in the pipeliner. It is a directory on disk that pipeliner manages as a whole. When you create or open a project, pipeliner writes a marker file named .CCPEM_pipeliner_project into that directory. The pipeline graph itself is stored in a STAR-format file named default_pipeline.star (the name is derived from the pipeline name, which defaults to default). All job subdirectories, node placeholder files, and housekeeping logs live inside the same project directory.

Projects created by pipeliner are fully compatible with the RELION GUI and the CCP-EM Doppio graphical interface: both can open, display, and continue jobs in a pipeliner project without any conversion step.

You interact with a project programmatically through PipelinerProject, imported from pipeliner.api.manage_project:

from pipeliner.api.manage_project import PipelinerProject

PipelinerProject operates on the current working directory; it does not accept a path argument. Call it with make_new_project=True to initialise a fresh project, or omit that argument to open an existing one.


Pipeline (Pipeline Graph)

The pipeline — sometimes called the pipeline graph or workflow — is a directed graph that records every job in the project, the data nodes those jobs consume and produce, and the edges that connect them. This graph makes the entire processing history reproducible and queryable: you can trace any output back to its raw inputs, identify which jobs depend on a given node, and archive or re-run any subgraph.

On disk the graph is stored in default_pipeline.star, a STAR-format file with five data blocks:

BlockContents
pipeline_generalJob counter
pipeline_processesOne row per job (name, alias, type, status)
pipeline_nodesOne row per data node (file path and node type)
pipeline_input_edgesEdges from nodes to the jobs that consume them
pipeline_output_edgesEdges from jobs to the nodes they produce

The graph is managed internally by ProjectGraph (from pipeliner.project_graph). You rarely need to use ProjectGraph directly; the PipelinerProject API wraps it for all common operations.

Project-level locking is handled through a .relion_lock directory placed next to the pipeline file. Individual job directories do not have per-job locks; job state is instead communicated through sentinel files (see Job Status below).


Job

A job is a single, self-contained processing step — for example, motion correction, CTF estimation, or 2D classification. Each job:

  • Has a unique process name such as relion.motioncorr.own or relion.class2d.em.
  • Runs in its own numbered subdirectory under the project root, e.g. MotionCorr/job002/.
  • Declares input nodes it requires and output nodes it produces.
  • Stores its parameters in job.star (STAR format) and run.job (human-readable label–value format) files in its subdirectory.
  • Exposes a jobinfo attribute (a JobInfo instance) that records the job's description, required external programs, and literature references.

Job numbers are assigned project-wide by ProjectGraph.job_counter, so jobs receive sequential numbers regardless of type: Import/job001, MotionCorr/job002, CtfFind/job003, and so on.

Job Classes

Every job type is a Python class that:

  • Declares PROCESS_NAME and OUT_DIR class attributes.
  • Implements create_output_nodes() to register its expected outputs.
  • Implements get_commands() to return the shell commands pipeliner will run.
  • Stores its configurable parameters in self.joboptions (a dict of JobOption objects).

You instantiate a job by type name using new_job_of_type() from pipeliner.job_factory:

from pipeliner.job_factory import new_job_of_type
job = new_job_of_type('relion.motioncorr.own')

Job Options

Job options are the configurable parameters for a job (pixel size, number of MPI processes, output path, etc.). They are stored in job.joboptions, a dict keyed by parameter name. You read and write values through the .value property:

job.joboptions['input_star_mics'].value = 'Import/job001/movies.star'
job.joboptions['dose_per_frame'].value = 1.2

Option labels (the human-readable strings used in run.job files) must match exactly. A mismatched label raises no error: the line is ignored, the option keeps its default value, and a warning is logged.

Job Availability

When a job object is created, pipeliner checks whether its required external programs are on PATH. If a required executable is missing, job.jobinfo.is_available is False and job.jobinfo.unavailable_message explains which executable could not be found. The job class still loads normally and can be scheduled; it will fail at execution time rather than at scheduling time. An UnavailableJob placeholder is only created when the job class itself raises an exception during import or instantiation.


Node

A node (also called a data node or pipeline node) is a named data file or directory that acts as the input or output of a job. Nodes are the edges of the pipeline graph — they connect jobs to one another.

Every node has:

  • A name: the file path relative to the project root (e.g. MotionCorr/job002/corrected_micrographs.star).
  • A top-level type: a string constant such as MicrographGroupMetadata, ParticleGroupMetadata, or DensityMap that categorises the kind of data the node holds. These constants are defined in pipeliner.data_structure (e.g. NODE_MICROGRAPHGROUPMETADATA).
  • Optional keywords that further describe the node's role.

When a job is scheduled, pipeliner creates empty placeholder files under .Nodes/<TopLevelType>/<node_path> to mark expected output nodes. The actual output data files are not written until the job runs successfully.

Node-type constants should always be imported from pipeliner.data_structure, not from pipeliner.nodes:

from pipeliner.data_structure import NODE_MICROGRAPHGROUPMETADATA, NODE_PARTICLEGROUPMETADATA

Job Status

Every job in the pipeline has a status that reflects its current state. Status is stored both in default_pipeline.star and as sentinel files in the job directory.

Status Values

StatusSentinel fileMeaning
Scheduled(none)Job is queued but not yet running
Running(none)Job is currently executing
SucceededPIPELINER_JOB_EXIT_SUCCESSJob completed successfully
FailedPIPELINER_JOB_EXIT_FAILEDJob exited with an error
AbortedPIPELINER_JOB_EXIT_ABORTEDJob was aborted by the user

A separate trigger file PIPELINER_JOB_ABORT_NOW is written to request that a running job stop; it is not itself a status.

Pipeliner's status values (Succeeded, Failed, Aborted, Running, Scheduled) are distinct from RELION's equivalent sentinel files (RELION_JOB_EXIT_SUCCESS, RELION_JOB_EXIT_FAILURE, RELION_JOB_EXIT_ABORTED, RELION_JOB_ABORT_NOW); note that RELION uses FAILURE while pipeliner uses FAILED.

Changing Status

Use pipeliner --set_status <job_name> <status> on the CLI (accepted status substrings: success, failed, aborted, scheduled, running) or PipelinerProject.update_job_status(job, new_status) in Python (accepted values: 'Succeeded', 'Failed', 'Aborted', 'Running', 'Scheduled'). The ProjectGraph.update_status method automatically manages the sentinel files; you should not manipulate them manually.

Key constraints on status transitions:

  • A Running job cannot be set to Aborted via --set_status or update_job_status (this raises ValueError); use abort_job / --abort_job to stop a running job. Jobs in any other status can be set to Aborted.
  • Setting a job to the status it already has raises ValueError.

Pipeline STAR File

The pipeline STAR file (default_pipeline.star) is the authoritative record of the pipeline graph. It is written by pipeliner in a format compatible with both RELION 4 and the CCP-EM pipeliner. Opening a RELION 3 pipeline file in write mode converts it in place, moving the original to a .old backup. Opening a RELION 3 file in read-only mode raises RuntimeError. RELION 4 files are read as-is, with node-type names mapped in memory during reading; opening one does not convert it, but any operation that opens the pipeline for writing (such as scheduling a job or changing a status) saves it back in pipeliner format, without a .old backup. The explicit pipeliner --convert_pipeline_file command converts it and keeps a .old copy.

Each job directory also contains:

  • job.star — the job's parameters in STAR format.
  • run.job — the same parameters in a human-readable <label> == <value> format.
  • job_pipeline.star — the job's own sub-graph (input/output nodes only, not parameters).
  • A backup copy of default_pipeline.star written at scheduling time, used by pipeliner.recover_project for crash recovery.
  • continue_job.star — a STAR job file pre-written at scheduling time, edited before calling --continue_job to resume with modified parameters.

Queue Submission

Queue submission is the ability to dispatch a job to an HPC cluster scheduler (SLURM, SGE, or any scheduler that accepts a qsub-style command) rather than running it locally.

The key settings are:

SettingEnvironment variable(s)Default
queue_usePIPELINER_QUEUE_USE, RELION_QUEUE_USEfalse
qsub_commandPIPELINER_QSUB_COMMAND, RELION_QSUB_COMMANDqsub
qsub_templatePIPELINER_QSUB_TEMPLATE, RELION_QSUB_TEMPLATE(empty string)
queue_namePIPELINER_QUEUE_NAME, RELION_QUEUE_NAMEopenmpi

queue_use sets the default value of each job's do_queue option at job creation time. Whether a specific job is actually submitted to the queue is determined per-job by that job's own do_queue value, not globally. Values treated as true for boolean settings: yes, true, y, 1 (case-insensitive).

The qsub template supports nine fixed placeholders (XXXnameXXX, XXXmpinodesXXX, XXXcoresXXX, XXXdedicatedXXX, XXXthreadsXXX, XXXqueueXXX, XXXcommandXXX, XXXerrfileXXX, XXXoutfileXXX) plus XXXextra1XXX through XXXextraNXXX (one per qsub_extra_count). Unrecognised placeholders trigger a RuntimeWarning. The template must not contain an mpirun or mpiexec command; MPI is controlled per-job via the mpi_command job option.

With queuing enabled (do_queue is Yes) and an empty or missing submission script (the job's qsubscript option, which defaults to qsub_template), run_job raises ValueError before the job is created (Job cannot be run because: File <path> not found), and schedule_job rejects an empty script as an invalid job option. Only if the script cannot be read when an already-scheduled job is launched is the job marked Failed, with RuntimeError('Error starting job <dir>') raised and ValueError('Error reading template submission script in: <path>') as its cause.


MPI

MPI (Message Passing Interface) is the parallelism mechanism used by RELION and other pipeliner job types to distribute work across multiple CPU cores or nodes. Pipeliner does not set a global MPI command; instead, the mpirun_command setting (default: mpirun -n XXXmpinodesXXX) provides the default value for each job's per-job mpi_command option. Override it with PIPELINER_MPIRUN_COMMAND.

When you call get_runtab_options(mpi=True) in a job class, both nr_mpi and mpi_command job options are added. The job must then explicitly prepend self.get_mpi_command() to its command list to actually run under MPI.


Settings File

The settings file is a JSON configuration file named ccpem-pipeliner-settings.json, stored in a platform-specific location:

  • Linux: $XDG_CONFIG_HOME/ccpem/pipeliner/ (default ~/.config/ccpem/pipeliner/)
  • macOS: ~/Library/Application Support/ccpem/pipeliner/

Environment variables override file values and are re-read on every getter call. PIPELINER_* variables take precedence over RELION_* fallbacks. The file is read once on first access; edits made after first access in a running process require a restart to take effect. PIPELINER_PATH_TO_SOURCE_FILES and PIPELINER_ADDITIONAL_PROGRAM_PATHS take effect only at import time.

If the settings directory is not writable, pipeliner logs a warning and continues with built-in defaults.


Plugin / Job Plugin

A plugin (or job plugin) is a custom job type written as a Python class that subclasses PipelinerJob and is registered with pipeliner so it appears alongside built-in jobs without modifying the core package.

Plugins are discovered via Python's entry-point mechanism under the group ccpem_pipeliner.jobs. Discovery occurs every time get_job_types() or new_job_of_type() is called — there is no persistent startup registry.

To register a plugin, add an entry to your package's pyproject.toml:

[project.entry-points."ccpem_pipeliner.jobs"]
"mypkg.myjob" = "mypkg.jobs.myjob:MyJobClass"

The entry-point key must equal the class's PROCESS_NAME attribute. After editing pyproject.toml, reinstall the package (pip install -e .) for the entry point to take effect.

Job classes must:

  • Declare PROCESS_NAME and OUT_DIR class attributes.
  • Implement create_output_nodes() and get_commands() methods.

Doppio

Doppio (the CCP-EM Doppio GUI) is the optional graphical interface for the CCP-EM software suite. You can open any pipeliner project in Doppio to inspect job results, view the pipeline graph, and continue jobs interactively — without using the command line. Projects are fully compatible: anything you run headlessly through the pipeliner API or CLI can be viewed and continued in Doppio, and vice versa.

Note that merged sub-project directories (created by pipeliner.merge_projects) can be viewed in Doppio but must not be modified from within Doppio — no new jobs and no recalculating results displays.


Job Number Assignment

Job numbers are assigned project-wide through ProjectGraph.job_counter. Each new job scheduled in the project receives the next sequential integer, regardless of job type. This means the job directories in a project always increase monotonically: Import/job001, MotionCorr/job002, CtfFind/job003, and so on — not per-type numbering like MotionCorr/job001, CtfFind/job001.


Examples

Inspect all registered job types

from pipeliner.job_factory import get_job_types

for job in get_job_types():
    print(job.PROCESS_NAME, '|', job.jobinfo.short_desc, '| available:', job.jobinfo.is_available)

Open a project and run a motion-correction job

import os
from pipeliner.api.manage_project import PipelinerProject

os.chdir('/path/to/my_project')
proj = PipelinerProject()

# The input must already exist (here from a finished Import job);
# run_job raises ValueError if Import/job001/movies.star is missing
job_params = {
    '_rlnJobTypeLabel': 'relion.motioncorr.own',
    'input_star_mics': 'Import/job001/movies.star',
    'dose_per_frame': '1.2',
    'nr_mpi': '4',
}
# run_in_foreground=True blocks until the job finishes
result_job = proj.run_job(job_params, run_in_foreground=True)
print(result_job.output_dir)

Open an existing project and check job status

import os
from pipeliner.api.manage_project import PipelinerProject

os.chdir('/path/to/my_project')
proj = PipelinerProject()

from pipeliner.project_graph import ProjectGraph
with ProjectGraph(read_only=True) as pipeline:
    for proc in pipeline.process_list:
        print(proc.name, proc.type, proc.status)

Schedule a job without running it immediately

from pipeliner.api.manage_project import PipelinerProject
from pipeliner.job_factory import job_from_dict
import os

os.chdir('/path/to/my_project')
proj = PipelinerProject()

params = {
    '_rlnJobTypeLabel': 'relion.ctffind.ctffind4',
    'input_star_mics': 'MotionCorr/job002/corrected_micrographs.star',
    # relion.motioncorr.own writes float16 micrographs by default, so CTFFIND
    # must use the power spectra saved by the MotionCorr job
    'use_given_ps': 'Yes',
}
scheduled_job = proj.schedule_job(params)
print(scheduled_job.output_dir)  # e.g. CtfFind/job003/

Check node-type constants

from pipeliner.data_structure import (
    NODE_MICROGRAPHGROUPMETADATA,
    NODE_PARTICLEGROUPMETADATA,
    NODE_DENSITYMAP,
)
print(NODE_MICROGRAPHGROUPMETADATA)  # MicrographGroupMetadata
print(NODE_PARTICLEGROUPMETADATA)    # ParticleGroupMetadata
print(NODE_DENSITYMAP)               # DensityMap

Generate a default run.job file for a job type

pipeliner --default_runjob relion.motioncorr.own
# Produces: relion_motioncorr_own_run.job

List available job types from the CLI

pipeliner --available_jobs
# Filter by search string
pipeliner --available_jobs class2d

Check installation and program availability

pipeliner.check_setup

Register a custom job plugin (pyproject.toml excerpt)

[project.entry-points."ccpem_pipeliner.jobs"]
"myfacility.autopick" = "myfacility.jobs.autopick:FacilityAutopickJob"

After editing, reinstall:

pip install -e .

Update a job option value via the API

from pipeliner.job_factory import new_job_of_type

job = new_job_of_type('relion.motioncorr.own')
# Set a value using the .value property on the JobOption
job.joboptions['dose_per_frame'].value = '1.5'
job.joboptions['nr_mpi'].value = '8'

Related concepts
  • Install and verify pipeliner — how to install ccpem-pipeliner with pip and confirm that pipeliner.check_setup reports a successful installation.
  • Create a project — using pipeliner --new_project or PipelinerProject(make_new_project=True) to initialise a project directory and default_pipeline.star.
  • Run a processing job — using pipeliner --run_job or PipelinerProject.run_job() to schedule and execute a job, including how input validation and the sentinel file mechanism work.
  • Build an automated workflow script — chaining jobs into a schedule with PipelinerProject.run_schedule() and writing headless automation scripts.
  • Write and register a custom job plugin — subclassing PipelinerJob, implementing PROCESS_NAME, OUT_DIR, create_output_nodes(), and get_commands(), and registering under the ccpem_pipeliner.jobs entry-point group.
  • Queue submission and HPC configuration — configuring qsub_template, qsub_command, and the PIPELINER_QUEUE_USE environment variable for cluster environments.
  • View results in Doppio or RELION GUI — how the default_pipeline.star format ensures compatibility with both graphical interfaces.
  • Archive or clean up a project — using pipeliner --full_archive, pipeliner --simple_archive, and pipeliner --cleanup to manage disk usage after processing is complete.