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

daf_persistence remove butler object cache #58

Merged
merged 1 commit into from May 19, 2017
Merged

Conversation

n8pease
Copy link
Contributor

@n8pease n8pease commented May 19, 2017

No description provided.

Copy link
Contributor

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

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

Couple of minor comments

@@ -1094,37 +1088,12 @@ def _read(self, location):
Returns
-------
object - an instance of the object specified by the butlerLoction.
Copy link
Contributor

Choose a reason for hiding this comment

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

butlerLoction -> butlerLocation (or should it be just location)

self.log.debug("Starting read from %s", location)
results = location.repository.read(location)
if len(results) == 1:
results = results[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

I remember reviewing piece of code where you did something like:

if isinstance(results, (list, tuple)) and len(results) == 1:
    results = results[0]

to protect against cases when user type is a sequence-like object. Should not this logic apply here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it's a good idea. but, in this case the the code is moved out one indent level but is otherwise the same as it ever has been, and I don't want to get into the implications of reading from a maybe-list.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safer to try the indexing in a try block, and make results a list if it throws?

@n8pease n8pease merged commit 2792df8 into master May 19, 2017
@ktlim ktlim deleted the tickets/DM-10558 branch August 25, 2018 06:14
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