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-32883: Support StorageClass conversion on get. #615

Merged
merged 12 commits into from Dec 15, 2021
Merged

Conversation

timj
Copy link
Member

@timj timj commented Dec 10, 2021

This allows a converter to be registered with a storage class that will be run if the dataset read from the datastore has an incorrect type that can be converted to the expected one.

Checklist

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

@codecov
Copy link

codecov bot commented Dec 10, 2021

Codecov Report

Merging #615 (c911d2e) into main (ed178b1) will increase coverage by 0.08%.
The diff coverage is 92.94%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #615      +/-   ##
==========================================
+ Coverage   83.96%   84.05%   +0.08%     
==========================================
  Files         234      234              
  Lines       30036    30166     +130     
  Branches     4976     4995      +19     
==========================================
+ Hits        25221    25356     +135     
+ Misses       3669     3666       -3     
+ Partials     1146     1144       -2     
Impacted Files Coverage Δ
...hon/lsst/daf/butler/datastores/genericDatastore.py 81.35% <0.00%> (ø)
python/lsst/daf/butler/formatters/yaml.py 62.74% <36.36%> (-1.84%) ⬇️
python/lsst/daf/butler/formatters/file.py 74.54% <77.77%> (+4.17%) ⬆️
python/lsst/daf/butler/formatters/json.py 78.57% <87.50%> (+7.83%) ⬆️
python/lsst/daf/butler/core/storageClass.py 94.53% <100.00%> (+1.27%) ⬆️
...ython/lsst/daf/butler/tests/_examplePythonTypes.py 87.91% <100.00%> (+1.32%) ⬆️
tests/test_butler.py 97.62% <100.00%> (+0.05%) ⬆️
tests/test_storageClass.py 98.83% <100.00%> (+0.25%) ⬆️
python/lsst/daf/butler/datastores/fileDatastore.py 80.11% <0.00%> (+0.23%) ⬆️
... and 1 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 ed178b1...c911d2e. Read the comment docs.

@timj timj force-pushed the tickets/DM-32883 branch 3 times, most recently from 937657f to 91edc42 Compare December 10, 2021 18:19
Copy link
Contributor

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

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

Looks good, couple of minor comments.

python/lsst/daf/butler/core/storageClass.py Show resolved Hide resolved
python/lsst/daf/butler/core/storageClass.py Outdated Show resolved Hide resolved
python/lsst/daf/butler/formatters/json.py Show resolved Hide resolved
This allows a storage class to declare that it can convert
some python types into the python type of that storage class.
If an incorrect python type is returned from the formatter it
is possible to make a last ditch attempt to morph it to the
required python type.
With storage class conversion now supported the code
can no longer assume that the write storage class is going
to match the read storage class. Change _coerceType to
understand by storage classes and to allow python type
coercion to the read storage class after coercion to
the write storage class.
@timj timj merged commit 7c00fc8 into main Dec 15, 2021
@timj timj deleted the tickets/DM-32883 branch December 15, 2021 20:48
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