-
Notifications
You must be signed in to change notification settings - Fork 19
Add butler chaining to ButlerStandardizer #1130
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
base: main
Are you sure you want to change the base?
Conversation
wilsonbb
left a comment
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.
This looks right to me, some small suggestions about slight code re-organizing to consider. Will follow-up with an explicit test on USDF
| else: | ||
| butlers = butler | ||
|
|
||
| for b in butlers: |
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.
I would consider instead something like
for b in butlers:
self.ref = self.__query_butler(tgt, b)
if self.ref is not None:
# Use the first butler we find our reference in
self.butler = b
break
if self.ref is None:
raise ValueError(f"Unable to resolve target {tgt} for any butler.")
This helps us get rid of the butler local varible
| else: | ||
| butlers = butler |
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.
By renaming the argument from butler to butlers, we can get rid of this else branch.
| """Given a target and a butler, which might not contain the target | ||
| queries the butler to resolve it. Butler failures are silenced. | ||
|
|
||
| Has to be called after deffered_import. |
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.
Nit: deferred_import
| self.compare_to_expected(7, standardized) | ||
|
|
||
| # Test chained resolution works. | ||
| std = Standardizer.get(DatasetId(7, fill_metadata=True), butler=[self.failed_butler, self.butler]) |
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.
Maybe we could add some small tests that
butler=[self.failed_butler, self.failed_butler]throws an error.- For
butler=[self.butler2, self.butler]we could check thatstd.butler is self.butler2
Resolves #872
Adds a test for chained butlers when the first butler resolves to
None, but this needs to be tested in-vivo over multiple repos on SLAC because I don't know what the failure modes actually are. I can't login to s3df.