Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

o2-qc-repo-delete-objects-in-runs filter by metadata #2490

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions Framework/script/RepoCleaner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ The configuration for ccdb-test is described [here](../../../doc/DevelopersTips.

## 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 .
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

Expand All @@ -50,6 +51,9 @@ 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`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ def parseArgs():
parser.add_argument('--one-by-one', action='store_true', help='Ask confirmation for each deletion')
parser.add_argument('--print-list', action='store_true', help='Only print the list of objects that would be deleted')
parser.add_argument('--yes', action='store_true', help='Answers yes to all. You should really not use that.')
parser.add_argument('--metadata', dest='metadata', action='store', default="",
help='Delete only versions matching these metadata. Format: "[/key=value]*"')
args = parser.parse_args()
dryable.set(args.dry_run)
logging.info(args)
Expand All @@ -47,7 +49,7 @@ def run(args):
run_number = row["runNumber"]
logging.info(f"Run : {run_number}")

versions = ccdb.getVersionsList(args.path + "/.*", "", "", run_number)
versions = ccdb.getVersionsList(args.path + "/.*", "", "", run_number, metadata=args.metadata)
logging.info("Here are the objects that are going to be deleted: ")
for v in versions:
logging.info(v)
Expand Down