Skip to main content

Here are the tools to clean up the CCDB of the QC.

Entry point

It is o2-qc-repo-cleaner. See the long comment at the beginning.

Usage

usage: o2-qc-repo-cleaner [-h] [--config CONFIG] [--config-git] [--config-consul CONFIG_CONSUL] [--log-level LOG_LEVEL] 
                          [--dry-run] [--only-path ONLY_PATH] [--workers WORKERS]

Configuration

The file config.yaml contains the CCDB URL and the rules to be followed to clean up the database. An example is provided along this README (config.yaml). A typical rule in the config file looks like:

  - object_path: qc/ITS/.*
    delay: 240
    policy: 1_per_hour

There can be any number of these rules. The order is important as we use the first matching rule for each element in the QCDB (caveat the use of the flag continue_with_next_rule, see below).

  • object_path: a pattern to be matched to know if the rule applies
  • delay: the duration in minutes of the grace period during which an object is not removed, even if it matches the above path.
  • policy: the name of a policy to apply on the matching objects. Here are the currently available policies (full description in the corresponding files):
    • 1_per_hour: keep the first and extend its validity to 1 hour, remove everything in the next hour, repeat.
    • 1_per_run: requires the "Run" or "RunNumber" metadata to be set. Keep only the most recent version of an object for a given run.
    • last_only: keep only the last version, remove everything else.
    • none_kept: keep none, remove everything
    • skip: keep everything
  • from_timestamp: the rule only applies to versions whose valid_from is older than this timestamp
  • to_timestamp: the rule only applies to versions whose valid_from is younger than this timestamp
  • continue_with_next_rule: if True, the next matching rule is also applied.
  • xyz: any extra argument necessary for a given policy. This is the case of the argument delete_when_no_run required by the policy 1_per_run.

The configuration for ccdb-test is described here.

Setup virtual environment for development and test (venv)

  1. cd Framework/script/RepoCleaner
  2. python3 -m venv env
  3. source env/bin/activate
  4. python -m pip install -r requirements.txt
  5. python3 -m pip install .
  6. You can execute and work. Next time just do "activate" and then you are good to go
  7. If you modify the code, then rerun python3 -m pip install .

Unit Tests

cd Framework/script/RepoCleaner
source env/bin/activate  

# Run a test: 
python -m unittest tests.test_Ccdb.TestCcdb.test_getObjectsList

# Run all tests:
python3 -m unittest discover

cd QualityControl/Framework/script/RepoCleaner ; python3 -m unittest discover

In particular there is a test for the production rule that is pretty extensive. It hits the ccdb though and it needs the following path to be truncated: qc/TST/MO/repo/test*

Other tests

Most of the classes and Rules have a main to help test them. To run do e.g. python3 1_per_run.py.

Installation

CMake will install the python scripts in bin and the config file in etc.

Example

PYTHONPATH=./rules:$PYTHONPATH ./o2-qc-repo-cleaner --dry-run --config config-test.yaml --dry-run --only-path qc/DAQ --log-level 10

Development

To install locally

cd Framework/script/RepoCleaner
python3 -m pip install . 

Upload new version

Prerequisite

  1. Create an account on https://pypi.org

Create new version

  1. Update version number in setup.py
  2. python3 setup.py sdist bdist_wheel
  3. python3 -m twine upload --repository pypi dist/*

Metadata

Release files for qcrepocleaner 1.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for qcrepocleaner 1.10
File Size Uploaded Provenance Actions
qcrepocleaner-1.10.tar.gz 30.2 kB Without provenance Details for qcrepocleaner-1.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for qcrepocleaner 1.10
File Interpreter ABI Platform Actions
qcrepocleaner-1.10-py3-none-any.whl Python 3 none any Details for qcrepocleaner-1.10-py3-none-any.whl

Total release size: 98.0 kB

Release files / qcrepocleaner-1.10.tar.gz

Download URL qcrepocleaner-1.10.tar.gz
Size 30.2 kB
Tags Source
SHA-256 checksum
How to use checksums
fc569dad7e10873ca807248080193482f76fc64a3c1cc6e05e5c0fc7fa8548b3
BLAKE2b-256 checksum
How to use checksums
f2e3f9b785b89a2c19e9cabfb7320ab173fd19f54b9c08da7f7c73d275529c71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Release files / qcrepocleaner-1.10-py3-none-any.whl

Download URL qcrepocleaner-1.10-py3-none-any.whl
Size 67.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
193fc742f5cfdfe7ebb185aa708f17c25a17aa259365c9944b1a12699e5741fc
BLAKE2b-256 checksum
How to use checksums
7d44faf25b6b4d6fb287e22972952ca12a6c522aae1b5ba8728a8de7f122429d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.9

Security for qcrepocleaner 1.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page