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-23275: Add back makeRepo support for outfile #227

Merged
merged 2 commits into from Feb 4, 2020
Merged

Conversation

timj
Copy link
Member

@timj timj commented Jan 31, 2020

No description provided.

@timj timj requested a review from kfindeisen January 31, 2020 22:54
Copy link
Member

@kfindeisen kfindeisen left a comment

Choose a reason for hiding this comment

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

I have some minor quibbles, but I'm happy to see this merged once you clarify what the _config.py changes are for. Thanks for taking care of this so quickly!

# the root of the butler repo in the config else it won't know
# where to look.
config["root"] = uri.geturl()
uri = outfile
Copy link
Member

Choose a reason for hiding this comment

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

Oops, I didn't realize that config["root"] needed to be updated.

I'm a little nervous about reusing uri to mean first a normalized repository root, and then the config location. Why not have a separate config.dumpToUri(outfile) on this branch? It would be more robust to future code changes, especially ones below this point.

An alternative would be assigning outfile = uri if the argument is None, as this would keep the meaning of both variables unchanged.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok.

Yes, if root is not in the config file it no longer knows how to find it's registry/datastore.

python/lsst/daf/butler/registry/_config.py Outdated Show resolved Hide resolved
outfile=self.tmpConfigFile)
print(f"YAML written to {self.tmpConfigFile}")
c = Config(self.tmpConfigFile)
print(c)
Copy link
Member

Choose a reason for hiding this comment

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

Printing the config isn't really a test. Can you replace this with an assertion (e.g., that the recovered config is equal aside from the root field)?

Copy link
Member

@kfindeisen kfindeisen Feb 3, 2020

Choose a reason for hiding this comment

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

It seems that there are two more cases that could be tested: making outfile a directory (if this is not allowed, please say so in the documentation) and making it a URI. I can't think of any obvious failure modes besides invalid/nonwritable location...

Copy link
Member Author

Choose a reason for hiding this comment

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

Those print statements are some debugs that should not have been committed.

Copy link
Member Author

Choose a reason for hiding this comment

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

Those two options (URI and directory only) do work but now I'm wondering about testing them since one put/get should be a sufficient test whereas at the moment I'm rerunning every butler test (because it's simpler that way). I may have to stop inheriting from the posix datastore test and do a one of test just for makeRepo outfile.

Rather than subclassing all the Butler tests, for the makeRepo
test subclass just the main put/get test since we don't need
to ensure that all of butler works when tweaking the config
location.
@timj
Copy link
Member Author

timj commented Feb 3, 2020

@kfindeisen I rewrote the tests to add your suggested changes and that made it clear that there was also a bug in posix datastore not working with file URIs. Fixing that meant I no longer needed special case code in registry.

@timj timj merged commit 81d7f98 into master Feb 4, 2020
@timj timj deleted the tickets/DM-23275 branch February 4, 2020 04:35
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