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-41062: Add topic finding to efdUtils #64
Conversation
@@ -553,3 +553,29 @@ def getSubTopics(client, topic): | |||
loop = asyncio.get_event_loop() | |||
topics = loop.run_until_complete(client.get_topics()) | |||
return sorted([t for t in topics if t.startswith(topic)]) | |||
|
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.
Now that with this new findTopic
function, do you still want the getSubTopics
function above?
If yes, do you consider changing their names? Just by their names it's confusing what is for what. Might be even better just to have one function taking a regular expression.
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.
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.
And I thought that the naming made the usage pretty clear, but maybe I am wrong. I don't like the idea of the regex, mainly because I wrote these to be easy, and as a self-declared regex-phobe, not only would I not be confident in how to best write that, I wouldn't even know how to use my own tools! 😄
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.
Given that, what do you think is best here?
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.
Naively I would be tempted to use a utility this way:
getTopics(client, "*airflow*") # for finding whatever containing the airflow
getTopics(client, "lsst.sal.ESS.*") # to see what lives inside ESS
But I'm not a user of this and won't be in the short term, so I'd leave the judgement to you.
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.
(Actually that wasn't really regexp.. But you get my idea on wildcarding)
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.
(silly me... Because I opened the PR I can't approve my own PR... You can consider this approved) |
b999f75
to
f300141
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.
The first two commits can be squashed into one (so tests pass at every commit). Otherwise looks good to me!
f300141
to
fcdad76
Compare
fcdad76
to
ef8ab02
Compare
tests/test_butlerUtils.py
Outdated
@@ -110,7 +111,7 @@ def setUp(self): | |||
self.assertIsInstance(self.dataCoordMinimal, dafButler.dimensions.DataCoordinate) | |||
# NB the type check below is currently using a non-public API, but | |||
# at present there isn't a good alternative | |||
viewType = dafButler.core.dimensions._coordinate._DataCoordinateFullView | |||
viewType = dafButler.dimensions._coordinate._DataCoordinateFullView |
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.
Better to drop this assertIsInstance
check or replace it with a check on something that is public, like lsst.daf.butler.NamedKeyMapping
. Leaving this dependency on a private symbol is just asking for your code to break unexpectedly in the future, and it's just a test, not a production use case.
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.
Done, thanks.
Opening the PR so it's easier to review