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-35671: Remove gen2 reference loaders. #286

Merged
merged 3 commits into from Aug 5, 2022
Merged

DM-35671: Remove gen2 reference loaders. #286

merged 3 commits into from Aug 5, 2022

Conversation

erykoff
Copy link
Contributor

@erykoff erykoff commented Aug 2, 2022

This also consolidates code from the no-longer-necessary ReferenceObjectLoaderBase base class. It does not currently update naming conventions.

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.

Don't remove the LoadReferenceObjectsTask rst file: it contains useful information about the catalog schema. We do still have DM-11044 about finding a better permanent home for these. It's no longer a Task, so I think it would go into the generic module topic type, just renamed to match the new class name:

https://developer.lsst.io/stack/generic-guide-topic-type.html

The way loadReferenceObjects.py was refactored makes it look like you added a bunch of code, but I think it was just shuffled around in the file. Is this just git doing a wonky diff?

I'd like to move all of loadReferenceObjects.py into referenceObjectLoader.py (and similarly for the config class) to try to get the names consistent. Maybe that can't be done on this ticket, but it'd be nice to try to start moving that direction.

@@ -777,14 +776,515 @@ class ReferenceObjectLoader(ReferenceObjectLoaderBase):
Logger object used to write out messages. If `None` a default
logger will be used.
"""
ConfigClass = LoadReferenceObjectsConfig

def __init__(self, dataIds, refCats, log=None, config=None, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we get rid of the **kwargs, since they're not used?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm worried that could break some existing code (if somebody was erroneously passing a butler= for example). The problem was that usage was incorrect but never warned. So what I'm going to do is check if **kwargs is non-empty and throw up a deprecation warning.

class LoadIndexedReferenceObjectsConfig(LoadReferenceObjectsConfig):
ref_dataset_name = pexConfig.Field(
dtype=str,
default='cal_ref_cat',
doc='Name of the ingested reference dataset'
doc='Name of the ingested reference dataset',
deprecated='This field is no longer used. It will be removed after v24.',
Copy link
Contributor

Choose a reason for hiding this comment

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

How did I miss that deprecation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't answer that one!

tests/test_loadReferenceObjects.py Outdated Show resolved Hide resolved
@erykoff
Copy link
Contributor Author

erykoff commented Aug 3, 2022

Oh wow, me moving the code around seems to have really confused the github change display. Sorry about that, but I think that's beyond the scope of this ticket.
Re: moving code into the same file, I'll see what more cleanup I can do. But in terms of rectifying names I think that's better to leave for a separate ticket (and a separate diff! 😂 ).

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.

Two more small comments

I think you can rename tests/nopytest_ingestIndexRef... and the related ingestIndexTestBase to convert. Or we could save that for DM-31698 (if so, please note as such on that ticket). And test_referenceObjectLoader and it's class could be renamed to match?

def __init__(self, dataIds, refCats, log=None, config=None, **kwargs):
if kwargs:
warnings.warn("Instantiating ReferenceObjectLoader with additional kwargs is deprecated "
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, please file a ticket about that removal.

class ReferenceObjectLoaderBaseTestCase(lsst.utils.tests.TestCase):
"""Test case for ReferenceObjectLoaderBase abstract base class.
class ReferenceObjectLoaderTestCase(lsst.utils.tests.TestCase):
"""Test case for ReferenceObjectLoader.
Copy link
Contributor

Choose a reason for hiding this comment

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

This line isn't necessary: that's obvious from the name. The sentence below probably could go too, since there's no more ABC. Maybe rename or put in a sentence about how this tests the more generic parts of it, not the actual catalog loading.

def __init__(self, dataIds, refCats, log=None, config=None, **kwargs):
if kwargs:
warnings.warn("Instantiating ReferenceObjectLoader with additional kwargs is deprecated "
"and will be removed after v25.0", FutureWarning)
Copy link
Member

Choose a reason for hiding this comment

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

Please use stacklevel=2 here so that the warning appears to come from the caller code -- it makes it easier to find which of their lines had the errant kwarg. Generally stacklevel is always going to be useful.

@erykoff erykoff force-pushed the tickets/DM-35671 branch 2 times, most recently from ba55491 to 438cef5 Compare August 4, 2022 16:07
@erykoff erykoff merged commit 7f9667d into main Aug 5, 2022
@erykoff erykoff deleted the tickets/DM-35671 branch August 5, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants