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-36312: Deprecate support for component datasets in Registry #736
Conversation
7eca6a0
to
8bcef48
Compare
53972f3
to
dcde14f
Compare
Codecov ReportBase: 84.75% // Head: 84.74% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #736 +/- ##
==========================================
- Coverage 84.75% 84.74% -0.01%
==========================================
Files 254 254
Lines 32946 32960 +14
Branches 5632 5639 +7
==========================================
+ Hits 27922 27933 +11
- Misses 3801 3802 +1
- Partials 1223 1225 +2
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
8bcef48
to
5ce6f85
Compare
791db09
to
3335bb4
Compare
f306dac
to
82fa9c0
Compare
3335bb4
to
fed4cbf
Compare
fc9f3f2
to
c88edb3
Compare
fed4cbf
to
8d11b0a
Compare
c88edb3
to
25e98e3
Compare
8d11b0a
to
b5a46c2
Compare
66f318f
to
82d223c
Compare
b5a46c2
to
cfa5554
Compare
82d223c
to
ddbd069
Compare
cfa5554
to
f930c44
Compare
ddbd069
to
0c0d61b
Compare
f930c44
to
0553371
Compare
fda91db
to
2b8dce8
Compare
4b57dd7
to
41ae776
Compare
a54b40e
to
4dec5da
Compare
41ae776
to
9577197
Compare
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.
Looks good.
else: | ||
storage = self._managers.datasets[datasetType] | ||
parent_name, component = DatasetType.splitDatasetTypeName(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.
It's a shame this logic is duplicated from getDatasetType
but it looks like you need storage.find
to work. How about:
if not isinstance(datasetType, DatasetType): # or is a str
registryDatasetType = self.getDatasetType(datasetType)
else:
registryDatasetType = datasetType
parent_name, component = registryDatasetType.nameAndComponent()
storage = self._managers.datasets[parent_name]
?
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.
See next comment; thanks to that, duplication is much reduced.
storage = self._managers.datasets[parent_name] | ||
datasetType = storage.datasetType | ||
if component is not None: | ||
datasetType.makeComponentDatasetType(component) |
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.
This line seems like we should be capturing the return value.
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.
Aha! We don't actually use datasetType
after this, just storage.datasetType
and component
. So I can remove this check, and the line above it, and I can move the storage =
line outside the if
. And then there's actually very little duplicated between this method and getDatasetType
, addressing your other comment.
That does mean that findDataset
does not respect a storage class override that's passed to it, but that seems to have been the behavior before (that's handled in Butler
instead). As it turns out, the Registry.query
methods do respect storage class overrides, but that was largely an accident. I'm formalizing that on DM-31725, and it'll be easier to make findDataset
respect overrides then, too.
deprecation_message = ( | ||
"Querying for component datasets via Registry query methods is deprecated in favor of using " | ||
"DatasetRef and DatasetType methods on parent datasets. Only components=False will be supported " | ||
"after v26." |
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.
Maybe clarify that the parameter will be removed completely after v27 (which is a long time from now). We will need a jira ticket linked to a release somehow.
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've created DM-36457 for the post-v27 removals, but haven't tried to create release tickets for v26 or v27 (neither exist yet).
tests/test_simpleButler.py
Outdated
This test exports component datasets and then checks via the parent | ||
dataset type, since this is the only valid way to handle component | ||
exports (since Registry cannot record just a component without a | ||
parent, even if Datastore can). |
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'm effectively disabling the ability of datastore to store a bare component in #737.
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.
Where does that leave this test? It seems to still be working.
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 removed the test in datastore, although I didn't make datastore.put reject a component dataset type. Maybe that was a mistake, I hadn't realized we had other tests that did disassembly outside datastore.
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.
Sounds like I should probably keep it around for now, then, until you get a chance to figure out the code paths involved and disable them more fully?
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'm a bit confused what is happening in this test since registry doesn't do composite disassembly.
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.
Ah, it looks like the doctring had just gotten out of date, and I took it at face-value when I updated it. It just exports the composite and checks that the components are accessible after import. But this ticket makes that check for components impossible to do directly, and doing it indirectly via the parent datasets just makes this test the same as some others, so I'll delete it.
@timj , I've addressed all review comments (in fixup commits for now), and added a new commit for the problem @kfindeisen reported on Slack. Can you take a look at that? |
findDataset and getDatasetType are now the only registry methods that support components; removing support from those would cause a lot of inconvenience downstream, and the complexity cost in Registry for keeping it there is quite low. But we want to get it out of the manager classes to get rid of that unpleasant copy.copy on the storage object, and to keep component support from accidentally spreading to other places where we don't want to maintain it. At the same time, I've changed the exception raised for missing dataset types in the manager to be MissingDatasetTypeError for consistency with the query methods, but adding KeyError as a base class of that exception to maintain backwards compatibility.
Unlike queryDataIds and queryDimensionRecords, one missing dataset type here should not doom the entire query.
Originally this test appeared to test that component datasets could be exported directly; that's what the docstring still said prior to this commit, though it was actually just exporting the parent datasets and querying for the component datasets on import. Now querying for the components is deprecated, so this test is redundant with a few others that already check basic export-import round-trip.
e94e76b
to
c7f82e6
Compare
@@ -2666,6 +2666,16 @@ def testQueryResultSummaries(self): | |||
self.assertEqual(query5.count(exact=True), 0) | |||
messages = list(query5.explain_no_results()) | |||
self.assertFalse(messages) | |||
# This query should yield results from one dataset type but not the | |||
# other, which is not registered. | |||
query5 = registry.queryDatasets(["bias", "nonexistent"], collections=["biases"]) |
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.
Perfect, thanks!
Checklist
doc/changes