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

Speed up list_available #133

Merged
merged 4 commits into from
Apr 18, 2021

Conversation

ericpre
Copy link
Contributor

@ericpre ericpre commented Apr 6, 2021

As discussed in #132 and mamba-org/mamba#835, use mamba repoquery search "*" --json in favour of mamba search --json (or conda search --json), since the later is significantly slower than mamba repoquery.

@github-actions
Copy link

github-actions bot commented Apr 6, 2021

Binder 👈 Launch a binder notebook on the branch ericpre/gator/speed_up_get_list_available

@ericpre
Copy link
Contributor Author

ericpre commented Apr 6, 2021

The test seem to be playing up, no sure if this is related to PR, because running the test suite on the master isn't working - see for example https://github.com/ericpre/gator/actions/runs/722378324.

@wolfv
Copy link
Member

wolfv commented Apr 6, 2021

Cool, thanks for working on this!

@fcollonval
Copy link
Member

fcollonval commented Apr 7, 2021

Hey @ericpre

thanks for the PR. I carried out some performance tests (absolute figures donot matter much here):

image

Your solution will definitely improve experienced for mamba users.

@wolfv I'm not familiar with the mamba details. Does mamba repoquery search update the packages cache if it is expired?

Copy link
Member

@fcollonval fcollonval left a comment

Choose a reason for hiding this comment

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

Thanks @ericpre for this PR. I left a few improvements.

Could you also add a test for it?

For that the best would be to check the call of f in

https://github.com/ericpre/gator/blob/3b9c1845f2fed9c8e2997ecba9dabcc560ad29d0/mamba_gator/tests/test_api.py#L794

You could test the call with something like:

f.assert_called_with(...)

after line 975. Note the call arguments will depend on the manager.

.github/workflows/build.yml Outdated Show resolved Hide resolved
mamba_gator/envmanager.py Outdated Show resolved Hide resolved
mamba_gator/envmanager.py Outdated Show resolved Hide resolved
@ericpre ericpre force-pushed the speed_up_get_list_available branch from 3b9c184 to 0d8f43e Compare April 10, 2021 17:20
@ericpre
Copy link
Contributor Author

ericpre commented Apr 10, 2021

Thanks @ericpre for this PR. I left a few improvements.

Could you also add a test for it?

For that the best would be to check the call of f in

https://github.com/ericpre/gator/blob/3b9c1845f2fed9c8e2997ecba9dabcc560ad29d0/mamba_gator/tests/test_api.py#L794

You could test the call with something like:

f.assert_called_with(...)

after line 975. Note the call arguments will depend on the manager.

Sorry, I am not sure that I understand, what should be tested exactly? Do you want to have the ouptut of self._execute(self.manager, "repoquery", "search", "*", "--json") tested?
list_available is already tested and the changes of this PR should be covered by these tests?

@fcollonval
Copy link
Member

Sorry, I am not sure that I understand, what should be tested exactly? Do you want to have the ouptut of self._execute(self.manager, "repoquery", "search", "*", "--json") tested?
list_available is already tested and the changes of this PR should be covered by these tests?

As you said, the output is already tested. I would like only to add a test to be sure the proper command is invoked depending on the manager; i.e. if conda, _execute should be called with ["conda", "search", "--json"] - if mamba, it should be called with [manager, "repoquery", "search", "*", "--json"].

Does it clarify the intention?

@ericpre
Copy link
Contributor Author

ericpre commented Apr 11, 2021

Yes, it makes sense, thanks!
It seems that the tests need to be adapted to pass the changes of this PR and since I don't understand how these tests works, it would take me quite a bit time to get it to work and I will able to do this here. Can you please take over the PR?

@fcollonval fcollonval self-requested a review April 18, 2021 07:57
@fcollonval fcollonval merged commit 13c61f5 into mamba-org:master Apr 18, 2021
@fcollonval
Copy link
Member

Thanks @ericpre I added the tests.

@ericpre
Copy link
Contributor Author

ericpre commented Apr 18, 2021

Thanks for sorting out the test and finishing the PR!

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.

3 participants