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

DM-45993: Optimize DirectButlerCollections.query_info to avoid too many queries #1075

Merged
merged 5 commits into from
Sep 10, 2024

Conversation

andy-slac
Copy link
Contributor

Direct butler reimplements query_info method to avoid multiple queries, which makes it significantly faster. This patch also adds two optional parameters to query_info to allow further optimizations. There is still an inefficiency in fetch_summaries method when the number of potential collections is very large (when collections are *). Further optimization would probably need more work (and I think that we'll have to optimize it as the number of collections grows every day).

@dhirving, I added the same parameters to remote butler interface, but they are not used for now. I know you are working on DM-46129, maybe you can add forwarding of those parameters to remote server?

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes
  • (if changing dimensions.yaml) make a copy of dimensions.yaml in configs/old_dimensions

@dhirving
Copy link
Contributor

dhirving commented Sep 9, 2024

Sounds good. I'll rebase #1074 after this merges and add the new parameters.

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 87.83784% with 9 lines in your changes missing coverage. Please review.

Project coverage is 89.66%. Comparing base (1d1bf7b) to head (76d34d6).
Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
python/lsst/daf/butler/script/queryDatasets.py 60.00% 2 Missing and 2 partials ⚠️
python/lsst/daf/butler/_butler_collections.py 81.81% 1 Missing and 1 partial ⚠️
...butler/direct_butler/_direct_butler_collections.py 91.66% 1 Missing and 1 partial ⚠️
...on/lsst/daf/butler/script/queryDimensionRecords.py 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1075   +/-   ##
=======================================
  Coverage   89.65%   89.66%           
=======================================
  Files         359      359           
  Lines       46885    46925   +40     
  Branches     9637     9650   +13     
=======================================
+ Hits        42036    42073   +37     
- Misses       3482     3485    +3     
  Partials     1367     1367           

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

@andy-slac
Copy link
Contributor Author

@timj, I have added a new private method to Butler.collections and changed query-data-ids, query-datasets, and query-dimension-records to use it.

Copy link
Member

@timj timj left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks for unifying the logic in query-dimension-record and data-ids as well.
It makes sense not to include the doc strings in queries by default.

python/lsst/daf/butler/_butler_collections.py Outdated Show resolved Hide resolved
andy-slac and others added 5 commits September 9, 2024 21:54
… (DM-45993)

This reduces drastically the number of queries that query_info needs to
run.
Filter both dataset types and collections to query from collection summaries.
`query_info` nw receives optional `include_doc` parameter to allow
explicit loading of doc strings.
This allows more efficient filtering with per-dataset type list
of collection names returned.
Co-authored-by: Tim Jenness <tjenness@lsst.org>
@andy-slac andy-slac merged commit 5c4a71f into main Sep 10, 2024
17 of 18 checks passed
@andy-slac andy-slac deleted the tickets/DM-45993 branch September 10, 2024 05: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.

3 participants