Skip to content

Conversation

@DinoBektesevic
Copy link
Member

@DinoBektesevic DinoBektesevic commented Feb 3, 2026

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.

Copy link
Collaborator

@wilsonbb wilsonbb left a 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:
Copy link
Collaborator

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

Comment on lines +234 to +235
else:
butlers = butler
Copy link
Collaborator

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.
Copy link
Collaborator

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])
Copy link
Collaborator

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

  1. butler=[self.failed_butler, self.failed_butler] throws an error.
  2. For butler=[self.butler2, self.butler] we could check that std.butler is self.butler2

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.

Need ability to handle multiple Butler repository locations

3 participants