-
Notifications
You must be signed in to change notification settings - Fork 13
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-46129: Make collections.query_info a single HTTP call #1074
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bcf3cd2
Make collections.query_info a single HTTP call
dhirving 063d572
Make get_info use the same endpoint as query_info
dhirving 694d360
Break RegistryDefaults circular dependency
dhirving a7ea9f2
Forward RemoteButlerRegistry to ButlerCollections
dhirving 56d6a27
Mark deprecated REST endpoints
dhirving 8c3ca9c
Handle collection query optimization parameters
dhirving 701bd48
Fix summary_datasets being ignored
dhirving af34091
Fix minor review comments
dhirving File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -796,3 +796,25 @@ | |
arguments as well as positional arguments. | ||
""" | ||
return factory(*args, **kwargs) | ||
|
||
|
||
def get_dataset_type_name(datasetTypeOrName: DatasetType | str) -> str: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe make it a classmethod of |
||
"""Given a `DatasetType` object or a dataset type name, return a dataset | ||
type name. | ||
|
||
Parameters | ||
---------- | ||
datasetTypeOrName : `DatasetType` | `str` | ||
A DatasetType, or the name of a DatasetType. | ||
|
||
Returns | ||
------- | ||
name | ||
The name associated with the given DatasetType, or the given string. | ||
""" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Docstring also needs |
||
if isinstance(datasetTypeOrName, DatasetType): | ||
return datasetTypeOrName.name | ||
elif isinstance(datasetTypeOrName, str): | ||
return datasetTypeOrName | ||
else: | ||
raise TypeError(f"Expected DatasetType or str, got unexpected object: {datasetTypeOrName}") | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# This file is part of daf_butler. | ||
# | ||
# Developed for the LSST Data Management System. | ||
# This product includes software developed by the LSST Project | ||
# (http://www.lsst.org). | ||
# See the COPYRIGHT file at the top-level directory of this distribution | ||
# for details of code ownership. | ||
# | ||
# This software is dual licensed under the GNU General Public License and also | ||
# under a 3-clause BSD license. Recipients may choose which of these licenses | ||
# to use; please see the files gpl-3.0.txt and/or bsd_license.txt, | ||
# respectively. If you choose the GPL option then the following text applies | ||
# (but note that there is still no warranty even if you opt for BSD instead): | ||
# | ||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from ..registry import RegistryDefaults | ||
|
||
|
||
class DefaultsHolder: | ||
"""Holds a `RegistryDefaults` object and allows it to be set. | ||
|
||
Parameters | ||
---------- | ||
defaults : `RegistryDefaults` | ||
Initial value for the defaults object. | ||
|
||
Notes | ||
----- | ||
This exists to work around circular dependency issues (RemoteButler, | ||
ButlerCollections, and Registry all need to know/modify the defaults.) | ||
""" | ||
|
||
def __init__(self, defaults: RegistryDefaults) -> None: | ||
self._defaults = defaults | ||
|
||
def get(self) -> RegistryDefaults: | ||
"""Retrieve the current registry defaults.""" | ||
return self._defaults | ||
|
||
def set(self, defaults: RegistryDefaults) -> None: | ||
"""Set a new value for the registry defaults. | ||
|
||
Parameters | ||
---------- | ||
defaults : `RegistryDefaults` | ||
New value for defaults object. | ||
""" | ||
self._defaults = defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we allow
Iterable[str]
only to avoid all complications? I think that clients of this method that actually passsummary_datasets
should already have a list of names for other purposes. I guess this also means that datasets manager has to acceptIterable[str]
instead ofIterable[DatasetType]
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking the same thing, but the convention in the rest of the new query system is that dataset types can be specified as either the name or
DatasetType
instance so it makes sense to follow that. It's also common for this parameter to come from the result of a queryDatasetTypes call.