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-27147: rework collection names and add levels of indirection for long-lived repos #327

Merged
merged 15 commits into from Nov 26, 2020

Conversation

TallJimbo
Copy link
Member

No description provided.

them with the standard collection name delimeter. If provided,
these are appended to the names of the `~CollectionType.RUN`
these are inserted into to the names of the `~CollectionType.RUN`
Copy link
Member

Choose a reason for hiding this comment

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

extra "to" here


Returns
-------
name : `str`
Run collection name.
"""
return cls.makeCollectionName("calib", "unbounded", *suffixes)
tail = labels + ("unbounded",)
return cls.makeCollectionName("calib", *tail)
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure that:

return cls.makeCollectionName("calib", *labels, "unbounded")

works fine, so here and below there should be no need to make the temporary list.

if os.path.isabs(self.path):
if not os.path.isabs(root):
root = os.path.abspath(root)
chainName = os.path.relpath(self.path, root)
Copy link
Member

Choose a reason for hiding this comment

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

Part of me feels that pathlib.Path.relative_to is what you are really wanting to use here which should tell you if the two don't overlap but this would all be simpler as ButlerURI:

path_uri = ButlerURI(self.path)
root_uri = ButlerURI(root)
if path_uri.relative_to(root_uri) is None:
    raise ValueError(...)

Copy link
Member Author

Choose a reason for hiding this comment

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

The ButlerURI approach sounds perfect; I'll go with that.

# the original exception indicating that we can't hard-link
# on this filesystem to be turned into a nonzero exit code, which
# then trips the test assertion.
except AssertionError as err:
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could list both errors here then so we don't need to worry about it again?

return
if self.chainName is None:
if os.path.isabs(self.path):
if not os.path.isabs(root):
Copy link
Member

Choose a reason for hiding this comment

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

This if can be removed. The ButlerURI constructor will do it anyhow.

Instead of these extra strings being appended to the end of collection
names, they're now inserted directly after "<instrument>/calib", so
when we name a set of related collections after a ticket branch, all
of those collections will start with a common prefix.
This changes the interface for ConvertRepoTask, but not its default
behavior or the 'butler convert' command-line interface.
We no longer rely on per-instrument overrides to point each specific
refcat at the right RUN collection, and add a level of indirection to
make it easier to add new refcats later.
Ideally this label would be something intrinsic to the version of the
curated calibs, but that's not avalable, and we need something here to
make room for multiple curated calibration writes over the lifetime of
the data repo.
@TallJimbo TallJimbo merged commit 0218c7a into master Nov 26, 2020
@TallJimbo TallJimbo deleted the tickets/DM-27147 branch November 26, 2020 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants