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-35391: Improve query-data-ids command #704

Merged
merged 5 commits into from Jul 15, 2022
Merged

DM-35391: Improve query-data-ids command #704

merged 5 commits into from Jul 15, 2022

Conversation

timj
Copy link
Member

@timj timj commented Jul 1, 2022

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

@codecov
Copy link

codecov bot commented Jul 1, 2022

Codecov Report

Merging #704 (7be1bd7) into main (9693f7f) will decrease coverage by 0.00%.
The diff coverage is 94.23%.

❗ Current head 7be1bd7 differs from pull request most recent head 8993c3a. Consider uploading reports for the commit 8993c3a to get more accurate results

@@            Coverage Diff             @@
##             main     #704      +/-   ##
==========================================
- Coverage   84.58%   84.57%   -0.01%     
==========================================
  Files         243      243              
  Lines       31875    31876       +1     
  Branches     5982     5977       -5     
==========================================
- Hits        26961    26959       -2     
- Misses       3744     3745       +1     
- Partials     1170     1172       +2     
Impacted Files Coverage Δ
python/lsst/daf/butler/cli/cmd/commands.py 90.72% <0.00%> (-0.64%) ⬇️
python/lsst/daf/butler/script/queryDataIds.py 82.00% <100.00%> (+9.27%) ⬆️
tests/test_cliCmdQueryDataIds.py 96.82% <100.00%> (+1.70%) ⬆️
...ython/lsst/daf/butler/registry/databases/sqlite.py 84.39% <0.00%> (-1.42%) ⬇️
...ython/lsst/daf/butler/core/dimensions/_universe.py 86.00% <0.00%> (-0.71%) ⬇️
python/lsst/daf/butler/_butler.py 79.57% <0.00%> (-0.57%) ⬇️
...ython/lsst/daf/butler/registry/dimensions/table.py 85.89% <0.00%> (-0.12%) ⬇️
tests/test_dimensions.py 95.95% <0.00%> (-0.12%) ⬇️
tests/test_butler.py 97.60% <0.00%> (-0.01%) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1150d9f...8993c3a. Read the comment docs.

@timj timj marked this pull request as ready for review July 1, 2022 22:48
Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

Some suggestions on clarifying the logic, and I'd rather it raised an exception than returned a tuple that always had one element be None.

python/lsst/daf/butler/script/queryDataIds.py Outdated Show resolved Hide resolved
else:
return None
return None, "\n".join(results.explain_no_results())
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this tuple the convention for returning no results explanations elsewhere in the butler? I feel like raising NoResults (or some other custom exception) with the explanation in the payload would be more pythonic. Looking at the tests, it certainly would simplify this interface.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is not a butler convention -- it's trying to bridge the click to script implementation boundary. A specialist exception for this one function seems overkill to me.

tests/test_cliCmdQueryDataIds.py Outdated Show resolved Hide resolved
tests/test_cliCmdQueryDataIds.py Show resolved Hide resolved
python/lsst/daf/butler/script/queryDataIds.py Show resolved Hide resolved
python/lsst/daf/butler/script/queryDataIds.py Show resolved Hide resolved

if not graph:
names = [d.name for d in dataset_types]
return None, f"No dimensions in common for specified dataset types ({names})"
Copy link
Contributor

Choose a reason for hiding this comment

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

As I comment below on the other return statements, I think this makes more sense raising a custom exception or NoResults.

@timj timj force-pushed the tickets/DM-35391 branch 2 times, most recently from fc38b16 to 6ac7068 Compare July 8, 2022 23:35
@timj timj requested a review from parejkoj July 11, 2022 16:59
Copy link
Contributor

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

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

Thanks, those added comments help a lot with understanding the logic.

I'd still prefer a custom exception to a "one is always None" return tuple, but this works.

@timj timj merged commit 1dd4775 into main Jul 15, 2022
@timj timj deleted the tickets/DM-35391 branch July 15, 2022 15:08
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.

None yet

2 participants