Skip to content

feat: weights implementation for atom#78

Merged
zlmarshall merged 8 commits into
mainfrom
gguerrie-weights
Mar 20, 2026
Merged

feat: weights implementation for atom#78
zlmarshall merged 8 commits into
mainfrom
gguerrie-weights

Conversation

@Soap2G
Copy link
Copy Markdown
Contributor

@Soap2G Soap2G commented Mar 17, 2026

This PR introduces the capability to query and map "weights" and systematic variations (PMG weights) directly through atom.
To support this without choking the API, a new bulk query mechanism was implemented on the backend.

Changes

  1. PMG Weights API Extensions

Implemented a new GET /weights/dsids/{dsids_str} endpoint that processes multiple DSIDs.

  1. Python Client Additions
  • get_weights: fetches weight arrays mapped to a specific dataset ID and explicitly resolves its e_tag if not provided.
  • get_weight_names(key, e_tag): wrapper that returns a list of the weight name strings.
  • get_all_weights_for_release(release): grabs all the weights in a release. Progress bar implemented to match the caching mechanims in place for datasets. I didn't include it in fetch_release because it's not always necessary.

Added relevant tests. A lot of them.

New functions:
- get_weights(key): Retrieve complete weight metadata for a dataset
- get_weight_names(key): Get just the list of weight names
- get_all_weights_for_release(release_name): Get weights for all datasets in a release
- Added a new `GET /weights/dsids/{dsids_str}` endpoint to the PMG Weights API to allow retrieving weights in bulk for multiple datasets at once.
- Refactored `get_all_weights_for_release` in `metadata.py` to batch-process datasets (in chunks of 500) using the new bulk endpoint, significantly reducing API round-trips.
- Updated dataset extraction to correctly poll the `/datasets` API directly instead of strictly relying on local cache, ensuring offline/non-current releases load correctly.
- Added a `tqdm` progress bar to provide visual feedback during bulk weight fetching.
- Expanded the `pytest` mock API handling and added new unit test cases (handling mismatched tag fallbacks, 404 errors, missing e_tags, and malformed datasets) to achieve 100% test coverage for `metadata.py`.

See:
https://gitlab.cern.ch/atlas-outreach-data-tools/pmg-weights-db-api/-/commit/3d66dfb3631c01d1468276983caa53c49c009900
@Soap2G Soap2G requested review from marianaiv and zlmarshall March 17, 2026 10:57
@Soap2G Soap2G changed the title Weights implementation for atom feat: weights implementation for atom Mar 17, 2026
@Soap2G Soap2G force-pushed the gguerrie-weights branch from a527656 to de703be Compare March 17, 2026 11:12
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (db82362) to head (820d533).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main       #78    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files            3         4     +1     
  Lines          354       478   +124     
==========================================
+ Hits           354       478   +124     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Soap2G Soap2G force-pushed the gguerrie-weights branch from de703be to 94500e4 Compare March 17, 2026 11:14
Copy link
Copy Markdown
Contributor

@zlmarshall zlmarshall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Just a handful of questions; this looks really good.

Comment thread src/atlasopenmagic/metadata.py Outdated
Comment thread src/atlasopenmagic/metadata.py
Comment thread src/atlasopenmagic/metadata.py Outdated
Comment thread src/atlasopenmagic/metadata.py Outdated
Comment thread src/atlasopenmagic/utils.py Outdated
Comment thread src/atlasopenmagic/metadata.py Outdated
Soap2G added 4 commits March 18, 2026 10:24
Better management of modules, less confusion and shorter files.
In addition, Zach's cosmetic comments
@zlmarshall zlmarshall merged commit 8486a42 into main Mar 20, 2026
7 checks passed
@Soap2G Soap2G deleted the gguerrie-weights branch March 20, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants