CCPEM Pipeliner
Tutorial

Getting Started

From a fresh install to your first project and job


Overview

This page walks you through installing ccpem-pipeliner, verifying the installation, creating your first project, and running your first processing job. By the end you will have a working pipeliner project directory containing an import job, and you will understand the core concepts — projects, jobs, nodes, and job status — that underpin every automated workflow you build with the library.


Prerequisites

Before you begin, make sure you have the following:

  • Python 3.9 or later (the package declares support for 3.9–3.14; CI tests run on 3.10)
  • pip (any recent version that supports pyproject.toml)
  • A writable directory on a filesystem with enough space for your data
  • (Optional) RELION installed and on PATH if you want to run RELION processing jobs
  • (Optional) An MPI runtime such as OpenMPI if you intend to run MPI-parallelised jobs
  • (Optional) An HPC cluster scheduler (SLURM, SGE, etc.) for queue submission
  • (Optional) The CCP-EM Doppio GUI if you want a graphical view of your projects

No root access is required; a Python virtual environment is sufficient.


Quick start

The shortest path from a fresh system to a running job:

  1. Install the package:
    pip install ccpem-pipeliner
    
  2. Verify the installation:
    pipeliner.check_setup
    
  3. Create a project directory and initialise it:
    mkdir my_project && cd my_project
    pipeliner --new_project
    
  4. Generate a default run.job file for the movie-import job type:
    pipeliner --default_runjob relion.import.movies
    
  5. Edit the generated file (relion_import_movies_run.job) to point Raw input files: at your data, then run the job:
    pipeliner --run_job relion_import_movies_run.job
    

The job runs, writes output into Import/job001/, and creates the sentinel file PIPELINER_JOB_EXIT_SUCCESS inside that directory when it completes successfully.


Steps

Step 1 — Install ccpem-pipeliner

Install the distribution package from PyPI into your active Python environment:

pip install ccpem-pipeliner

This installs the pipeliner console script and all helper entry points (pipeliner.check_setup, pipeliner.recover_project, etc.).

Why pip? ccpem-pipeliner is a library/SDK distributed on PyPI. All console scripts are registered as entry points and become available on your PATH once the package is installed.

If you want to install from a local source checkout instead, cd into the repository root and run:

pip install -e .

Step 2 — Verify the installation

Run the built-in setup checker:

pipeliner.check_setup

This command prints four sections:

  1. Python version check
  2. Available job-types check (green Success or yellow Unavailable per job type, with the resolved executable path or the message '<command>' missing from system path for unavailable ones)
  3. Pipeliner console scripts check
  4. Final setup report

If the pipeliner and every job type are available, the final report ends with a SUCCESS message; if some job types are unavailable, it instead reports The pipeliner is correctly installed, but some jobs are unavailable. If any pipeliner console scripts are missing (shown as ERROR in section 3), reinstall with:

pip install --force-reinstall ccpem-pipeliner

If specific job types are Unavailable, install the corresponding external programs (e.g. RELION) and ensure their executables are on your PATH. Job-type unavailability does not prevent you from running other job types.


Step 3 — Create a project directory

All pipeliner work happens inside a project directory. Create a new directory and initialise a project inside it:

mkdir my_project
cd my_project
pipeliner --new_project

Using --new_project without a name creates a project called default (recommended). You can supply a name — for example pipeliner --new_project spa_run1 — but there is rarely a reason to do so.

The command writes default_pipeline.star (the pipeline graph file) and .CCPEM_pipeliner_project (the project marker) into the current directory. If a pipeline file already exists, the command raises an error: ERROR: Could not initialize a new project in this directory. A pipeline called default_pipeline.star already exists.

Working with an existing RELION project: If you have an existing RELION project, cd into that directory and use pipeliner commands directly. Do not run --new_project — pipeliner detects the existing default_pipeline.star automatically.


Step 4 — Generate a default run-job file

Before running a job you need a parameter file that describes it. The easiest way is to generate a default one:

pipeliner --default_runjob relion.import.movies

This writes relion_import_movies_run.job in the current directory. The file uses the format <option label> == <value> — for example:

job_type == relion.import.movies
is_continue == false
is_tomo == false
Raw input files: == Movies/*.tif
Are these multi-frame movies? == Yes
Optics group name: == opticsGroup1
MTF of the detector: == 
Pixel size (Angstrom): == 1.4
Voltage (kV): == 300
Spherical aberration (mm): == 2.7
Amplitude contrast: == 0.1
...

Open this file in any text editor and update at minimum:

  • Raw input files: — the glob pattern pointing to your movies or micrographs relative to the project root
  • Pixel size (Angstrom): — the physical pixel size for your dataset
  • Voltage (kV): — the microscope operating voltage

Important: Option labels must match exactly what pipeliner --default_runjob produces. Editing a label (even adding or removing a colon) does not raise an error: the line is ignored when the file is read, the option keeps its default value, and only a warning <file>; no value for `<label>` using default value: <default> is logged.

Alternatively, generate a STAR-format template (for programmatic editing with edit_jobstar()):

pipeliner --default_jobstar relion.import.movies

This writes relion_import_movies_job.star. The two file formats are incompatible: .run.job is for direct CLI use; .job.star is for use with the Python API function edit_jobstar(). Either file can be passed to pipeliner --run_job.


Step 5 — Run the job

With the parameter file edited, create and run the job:

pipeliner --run_job relion_import_movies_run.job

This always creates a new job with the next sequential number in the project (e.g. Import/job001/). The job directory is created, expected output nodes are registered in default_pipeline.star, and the job runs immediately.

You know the job succeeded when:

  • The directory Import/job001/ exists and contains movies.star (or micrographs.star for single-frame data)
  • The file Import/job001/PIPELINER_JOB_EXIT_SUCCESS is present

If the job fails, Import/job001/PIPELINER_JOB_EXIT_FAILED is written instead. Check Import/job001/run.out for standard output and Import/job001/run.err for errors.


Step 6 — Inspect available job types and check status

To see all registered job types (optionally filtered):

pipeliner --available_jobs
pipeliner --available_jobs relion.motioncorr

To see detailed availability information including program paths:

pipeliner --check_jobs

To check a job's status, look for the PIPELINER_JOB_EXIT_SUCCESS, PIPELINER_JOB_EXIT_FAILED or PIPELINER_JOB_EXIT_ABORTED file in its job directory. There is no pipeliner flag that reports a status.

To change the status recorded in the pipeline for a specific job (this sets the status; it does not report it):

pipeliner --set_status Import/job001/ success

(Use success, failed, aborted, scheduled, or running as the status value. Setting a job to the status it already has raises ValueError, and a Running job cannot be set to aborted.)


Step 7 — Continue or overwrite a job

To overwrite an existing job with new parameters (deletes and replaces it):

pipeliner --run_job relion_import_movies_run.job --overwrite Import/job001/

To continue a job that supports continuation and has finished successfully (e.g. to pick up newly acquired movies; continuing a job without a PIPELINER_JOB_EXIT_SUCCESS file fails with FileNotFoundError):

  1. Edit the job's Import/job001/continue_job.star file — this STAR file was written when the job was first scheduled.
  2. Run:
    pipeliner --continue_job Import/job001/
    

Note that pipeliner --run_job always creates a new job; it never continues an existing one. Use --continue_job for continuations.


Examples

Example 1 — Install and verify in a virtual environment

python3 -m venv venv/
source venv/bin/activate
pip install ccpem-pipeliner
pipeliner.check_setup

The pipeliner.check_setup command prints a report. The final section reads either SUCCESS: The pipeliner and all job types appear to be correctly installed and ready to use or, if any job types are unavailable, The pipeliner is correctly installed, but some jobs are unavailable; the unavailable job types, and the reason for each, are listed earlier in the report.


Example 2 — Initialise a project and import movies

mkdir spa_project
cd spa_project
pipeliner --new_project
pipeliner --default_runjob relion.import.movies

Edit relion_import_movies_run.job:

job_type == relion.import.movies
is_continue == false
is_tomo == false
Raw input files: == Movies/*.tif
Are these multi-frame movies? == Yes
Optics group name: == opticsGroup1
Pixel size (Angstrom): == 1.06
Voltage (kV): == 300
Spherical aberration (mm): == 2.7
Amplitude contrast: == 0.1

Then run:

pipeliner --run_job relion_import_movies_run.job

The job creates Import/job001/movies.star (for multi-frame input) and writes Import/job001/PIPELINER_JOB_EXIT_SUCCESS on completion.


Example 3 — Run a job from the Python API

import os
from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import job_default_parameters_dict

os.makedirs('spa_project', exist_ok=True)
os.chdir('spa_project')

# Create a new project in the current directory
proj = PipelinerProject(make_new_project=True)

# Get default parameters for the import job type
params = job_default_parameters_dict('relion.import.movies')

# Override values for your dataset
params['fn_in_raw'] = 'Movies/*.tif'
params['angpix'] = '1.06'
params['kV'] = '300'
params['Cs'] = '2.7'
params['Q0'] = '0.1'

# Run the job (creates Import/job001/ and runs immediately)
job = proj.run_job(params, run_in_foreground=True)
print(job.output_dir)  # Import/job001/

run_in_foreground=True blocks until the job finishes. After it returns, Import/job001/movies.star and Import/job001/PIPELINER_JOB_EXIT_SUCCESS exist.


Example 4 — Schedule a job without running it

from pipeliner.api.manage_project import PipelinerProject
from pipeliner.api.api_utils import job_default_parameters_dict

proj = PipelinerProject()

params = job_default_parameters_dict('relion.import.movies')
params['fn_in_raw'] = 'Movies/*.tif'
params['angpix'] = '1.06'
params['kV'] = '300'
params['Cs'] = '2.7'
params['Q0'] = '0.1'

job = proj.schedule_job(params, comment='initial import')
print(job.output_dir)  # Import/job001/  (scheduled, not yet run)

The job is registered in default_pipeline.star with status Scheduled. Run it later with:

proj.run_scheduled_job(job)

Example 5 — Generate and edit a STAR job file programmatically

from pipeliner.api.api_utils import write_default_jobstar, edit_jobstar
from pipeliner.api.manage_project import PipelinerProject

# Write the default template
template = write_default_jobstar('relion.import.movies')
# template == 'relion_import_movies_job.star'

# Edit specific parameters (keys are option names, not labels)
out_file = edit_jobstar(
    template,
    {
        'fn_in_raw': 'Movies/*.tif',
        'angpix': '1.06',
        'kV': '300',
        'Cs': '2.7',
        'Q0': '0.1',
    },
    'my_import_job.star'
)

proj = PipelinerProject()
job = proj.run_job(out_file, run_in_foreground=True)

Note: edit_jobstar() requires a job.star STAR-format file as its template. Passing a run.job file raises ValueError: File <name> is not a valid STAR file. ..., because a run.job file can't be parsed as STAR.


Troubleshooting

Console scripts not found after installation

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

Cause: The entry-point scripts were not installed, or the virtual environment's bin/ directory is not on PATH.

Fix:

pip install --force-reinstall ccpem-pipeliner

Ensure you have activated the virtual environment (source venv/bin/activate) or that the environment's bin/ directory is on your PATH.


Job types appear as Unavailable in pipeliner.check_setup

Symptom: The check prints Unavailable next to job types such as relion.motioncorr.own, with 'relion_run_motioncorr' missing from system path.

Cause: The external program (e.g. RELION) is not installed or not on PATH.

Fix: Install the required program and ensure its executables are on PATH before running pipeliner. You can still use all other available job types. Unavailable jobs can still be scheduled; they will fail at execution time.


--new_project fails with "A pipeline called default_pipeline.star already exists"

Symptom: pipeliner --new_project raises an error about an existing pipeline file.

Cause: You are running --new_project in a directory that already contains a pipeline file, either from a previous pipeliner session or from RELION.

Fix: To work with an existing project, simply cd into the project directory and run pipeliner commands directly — --new_project is not needed. To start fresh, use an empty directory.


A value in a .run.job file is ignored when running a job

Symptom: Running pipeliner --run_job <file> logs a warning such as <file>; no value for `<label>` using default value: <default>, and the job runs with the default value instead of the one you set.

Cause: You edited an option label in the .run.job file. Lines are matched to job options by label, and a line whose label doesn't match is ignored. Labels in run.job files must match exactly what pipeliner --default_runjob produces — including capitalisation, spacing, and trailing colons or question marks.

Fix: Regenerate the template with pipeliner --default_runjob <jobtype> and compare it with your edited file. Only change the values (right-hand side of ==), never the labels.


Queued job is rejected with "Job cannot be run because: File ... not found"

Symptom: pipeliner --run_job <file> stops with ValueError: Job cannot be run because: followed by File <path> not found (the path is blank when no template is set), and no job is created. If the template disappears after a job was scheduled, starting that job instead fails with RuntimeError: Error starting job <dir>, caused by Error reading template submission script in: <path>, and the job is marked Failed.

Cause: Queue submission is enabled (PIPELINER_QUEUE_USE=yes or the job's Submit to queue? == Yes) but no qsub_template is configured, so the template path is empty or missing.

Fix: Either disable queue submission by setting Submit to queue? == No in the run.job file, or set Standard submission script: in the run.job file to a valid template. Configuring qsub_template in ~/.config/ccpem/pipeliner/ccpem-pipeliner-settings.json or via the PIPELINER_QSUB_TEMPLATE environment variable only sets the default for job files generated afterwards, so regenerate the file with pipeliner --default_runjob <jobtype> after configuring it.


pipeliner.recover_project prints "No pipeline file found"

Symptom: Running pipeliner.recover_project from the project directory exits immediately with No pipeline file found. Are you sure you are in a pipeliner project directory?

Cause: default_pipeline.star is completely absent. pipeliner.recover_project requires this file to exist; it restores its contents from per-job backups, but it cannot create the file from scratch.

Fix: If per-job backups exist (each job directory contains a copy of default_pipeline.star), copy one manually:

cp Import/job001/default_pipeline.star ./default_pipeline.star
pipeliner.recover_project --assume-yes

Then verify that default_pipeline.star was restored and .relion_lock was removed.


ValueError: Parameter <name> is not found in jobtype <type> when using the Python API

Symptom: Calling proj.run_job(params_dict) raises ValueError: Parameter <name> is not found in jobtype <type>.

Cause: The dictionary contains a key that does not correspond to a registered job option for that job type. Common mistakes include using human-readable labels (e.g. 'Pixel size (Angstrom):') instead of option names (e.g. 'angpix'), or using incorrect key names (e.g. 'voltage' instead of 'kV').

Fix: Use job_default_parameters_dict('relion.import.movies') to obtain the correct key names, then copy and modify those keys in your parameters dictionary.


Settings file warning at startup

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

Cause: The settings directory (~/.config/ccpem/pipeliner/ on Linux, ~/Library/Application Support/ccpem/pipeliner/ on macOS) is not writable.

Fix: Either fix the directory permissions, or set all required settings using environment variables (e.g. PIPELINER_QUEUE_USE, PIPELINER_QSUB_TEMPLATE, PIPELINER_MOTIONCOR2_EXECUTABLE). The pipeliner continues to function normally using environment-variable overrides.