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

StorageFrontend remoteness attribute and test #617

Merged

Conversation

JoranAngevaare
Copy link
Member

What is the problem / what does the code in this PR do
The issue is described here:
#566

Can you briefly describe how it works?
Rather than looping over the frontends in the order they were specified by the user, loop over the frontends in order of StorageType

Can you give a minimal working example (or illustrate with a figure)?
See some examples in the test

Copy link
Contributor

@jmosbacher jmosbacher left a comment

Choose a reason for hiding this comment

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

Very nice! I think this is a great idea. just two small comments.

strax/context.py Outdated
order in mind. Return the fastest first and try loading from it
"""
storage_sfs = self.storage
storage_sfs.sort(key=lambda x: x.storage_type)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
storage_sfs.sort(key=lambda x: x.storage_type)
storage_sfs = sorted(self.storage, key=lambda x: x.storage_type)

I think you want to keep original list since order is used in copy_to_frontend right? I think the way it is would sort in place the original list no?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice!

strax/context.py Outdated
:return: partial object
"""
for sb_i, sf in enumerate(self.storage):
for _, sf in enumerate(self._sorted_storage):
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for _, sf in enumerate(self._sorted_storage):
for sf in self._sorted_storage:

double jeopardy!

Copy link
Member Author

Choose a reason for hiding this comment

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

you are absolutely right!

@JoranAngevaare
Copy link
Member Author

Thanks a lot Yossi for the super quick and good review! I've implemented them both 👍

@JoranAngevaare JoranAngevaare marked this pull request as ready for review December 23, 2021 16:50
@JoranAngevaare JoranAngevaare changed the title add database remoteness and test StorageFrontend remoteness attribute and test Dec 23, 2021
@JoranAngevaare JoranAngevaare added enhancement New feature or request Testing Works on testing code labels Dec 23, 2021
@JoranAngevaare JoranAngevaare merged commit 72377fc into AxFoundation:master Jan 10, 2022
@JoranAngevaare JoranAngevaare deleted the frontend_remoteness branch January 10, 2022 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Testing Works on testing code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants