Skip to main content

Tool to locally run tests for AnalysisProductions

Project description

LbAPLocal

LbAPLocal is the Python library and CLI for running offline tests for the LHCb AnalysisProductions framework.

Installation

LbAPLocal is installed by default with the LHCb environment on lxplus. For users on external clusters, source the LHCb environment from CVMFS:

source /cvmfs/lhcb.cern.ch/lib/LbEnv

Usage

Usage: lb-ap [OPTIONS] COMMAND [ARGS]...

  CLI for LHCb AnalysisProductions

Options:
  -C, --change-dir PATH  Change to this directory before running
  -b, --branch TEXT      Branch or tag to use
  -v, --verbose          Enable verbose output
  --version              Show version and exit
  --help                 Show this message and exit

Commands:
  versions        List available tags of the Analysis Productions repository
  clone           Clone the AnalysisProductions repository
  checkout        Check out a branch or tag
  list            List available productions and jobs
  test            Test a job using CWL workflow
  parse-log       Analyse a Gaudi log file and show a summary with advice
  make-reproducer Create a minimal reproducer from a failed grid job
  cwl             CWL-based workflow commands (generate, run, validate, test)

Testing a job

The primary command. Generates a CWL workflow from the production configuration and executes it locally:

lb-ap test MyAnalysis My2016MagDownJob

Key options:

lb-ap test MyAnalysis MyJob -i /path/to/input.dst   # Use a specific input file
lb-ap test MyAnalysis MyJob -n 100                   # Slice input to 100 events
lb-ap test MyAnalysis MyJob --n-lfns 5               # Test with 5 input LFNs
lb-ap test MyAnalysis MyJob --pick-smallest-lfn      # Use smallest LFN for speed
lb-ap test MyAnalysis MyJob --download               # Download input files locally
lb-ap test MyAnalysis MyJob --pretty                 # Real-time TUI monitoring
lb-ap test MyAnalysis MyJob --dry-run                # Validate without executing
lb-ap test MyAnalysis MyJob -o ./output              # Custom output directory

If arguments are omitted, an interactive wizard guides you through the setup.

The -n <N> flag slices the input file to N events using GaudiConf.mergeDST:dst (remote read, local write). After slicing, a reuse hint is printed so subsequent runs can skip the slicing step by passing the sliced file with -i.

Custom input files

When testing a job that depends on another job, pass the upstream output with -i:

lb-ap test MyAnalysis MyDownstreamJob -i /path/to/upstream_output.dst

The input can be a local file path or an LFN (LFN:/lhcb/...).

Analysing log files

Parse a Gaudi log file for FATAL, ERROR, and WARNING messages with contextual advice:

lb-ap parse-log DaVinci_00012345_00006789_1.log

Log analysis is also integrated into lb-ap test — after a test completes (success or failure), any Gaudi log files in the output are automatically analysed and a summary is displayed.

Listing productions and jobs

lb-ap list                    # List available productions
lb-ap list MyAnalysis         # List jobs in a production
lb-ap list --tree             # Tree view of all productions and jobs

Repository management

lb-ap clone --protocol ssh    # Clone AnalysisProductions
lb-ap checkout v1r4315        # Check out a version
lb-ap versions MyAnalysis     # List available versions

Creating a minimal reproducer

From a failed grid job, create a self-contained reproducer package:

lb-ap make-reproducer 12345678                        # From DIRAC job ID
lb-ap make-reproducer --job-dir ./downloaded_job_dir   # From local job directory

Development

Platform: pixi targets linux-64 only (requires CERN CVMFS and DIRAC).

# On linux-64 (lxplus or CI):
pixi install
pixi run pytest              # Run tests
pixi run lb-ap               # Run the CLI

# Linting (any platform):
ruff check src/ tests/       # Lint
ruff check --fix src/        # Auto-fix
ruff format src/ tests/      # Format

Legacy CLI

The original Click-based CLI is still available as lb-ap-legacy for backward compatibility but is deprecated.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lbaplocal-0.10.0.tar.gz (407.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lbaplocal-0.10.0-py3-none-any.whl (118.5 kB view details)

Uploaded Python 3

File details

Details for the file lbaplocal-0.10.0.tar.gz.

File metadata

  • Download URL: lbaplocal-0.10.0.tar.gz
  • Upload date:
  • Size: 407.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for lbaplocal-0.10.0.tar.gz
Algorithm Hash digest
SHA256 d686fb38f1d993ec6fc8f7abc35717e0cb61b4e5c4d36f680314b3ad3fbfb605
MD5 4ab3fb3524d252ac35ae75d2d06bbadf
BLAKE2b-256 4028f0693266aefbd12089203837f46912377adc6b6fdd56e839182c453d35d8

See more details on using hashes here.

File details

Details for the file lbaplocal-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: lbaplocal-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 118.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for lbaplocal-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 201b280fe4149e073c1198296b7e50d3ff65e4dcf3e6fc1d73f092cca470784b
MD5 bec4a08df9d7bdc5c295aa623050a97c
BLAKE2b-256 1f8f87e4e47445864aec1d497f4ccc4abe3f44277f451c642a79e707d15991f5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page