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-41062: Add topic finding to efdUtils #64

Merged
merged 4 commits into from Oct 10, 2023
Merged

Conversation

hsinfang
Copy link
Contributor

@hsinfang hsinfang commented Oct 5, 2023

Opening the PR so it's easier to review

@@ -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)])

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

So I do think that we still need both - here is how I imagine using them:

image

Copy link
Contributor

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! 😄

Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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)

Copy link
Contributor

Choose a reason for hiding this comment

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

Those exact examples now work 🙂

image

@hsinfang
Copy link
Contributor Author

hsinfang commented Oct 5, 2023

(silly me... Because I opened the PR I can't approve my own PR... You can consider this approved)

@mfisherlevine mfisherlevine force-pushed the tickets/DM-41062 branch 5 times, most recently from b999f75 to f300141 Compare October 6, 2023 14:16
Copy link
Contributor Author

@hsinfang hsinfang left a 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!

@@ -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
Copy link
Contributor

@TallJimbo TallJimbo Oct 10, 2023

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Done, thanks.

@mfisherlevine mfisherlevine merged commit dddff91 into main Oct 10, 2023
1 check passed
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

3 participants