After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 784938 - Parallelize package search with apt-file
Parallelize package search with apt-file
Status: RESOLVED FIXED
Product: jhbuild
Classification: Infrastructure
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Jhbuild maintainers
Jhbuild QA
Depends on:
Blocks:
 
 
Reported: 2017-07-14 09:13 UTC by Kalle Richter
Modified: 2020-11-12 08:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch (5.96 KB, patch)
2017-07-14 09:14 UTC, Kalle Richter
none Details | Review
patch (8.60 KB, patch)
2017-09-26 22:46 UTC, Kalle Richter
none Details | Review
patch (9.02 KB, patch)
2017-09-26 22:56 UTC, Kalle Richter
none Details | Review
patch (9.24 KB, patch)
2017-09-26 23:15 UTC, Kalle Richter
none Details | Review
patch (10.88 KB, patch)
2017-09-27 00:07 UTC, Kalle Richter
none Details | Review

Description Kalle Richter 2017-07-14 09:13:19 UTC
Searching packages with apt-file is painfully slow while the search in conducted in one thread only in `jhbuild/utils/systeminstall.py`. I'd be nice if it was parallelized.
Comment 1 Kalle Richter 2017-07-14 09:14:39 UTC
Created attachment 355570 [details] [review]
patch
Comment 2 Michael Catanzaro 2017-07-14 15:10:37 UTC
Review of attachment 355570 [details] [review]:

Thanks! I have two questions about this patch:

 * It looks like self.parallel is always True. Why do you add this variable? Why do you retain the code in the non-parallel paths? How would these ever be reached? It looks like it could all be removed.
 * It looks like you define some functions inside other functions with no line breaks. I don't know enough about Python to know if this is idiomatic, but I suspect not? It would be nicer to add some line breaks. It would probably be nicest to move them outside of their parent functions.
Comment 3 Kalle Richter 2017-07-14 18:18:08 UTC
> It looks like self.parallel is always True. Why do you add this variable? Why do you retain the code in the non-parallel paths? How would these ever be reached? It looks like it could all be removed.

I figured that I wanted to allow this to be passed down as an option, but that's overkill and requires a test (afaik systeminstall isn't covered so far - not that it's easy to test). I'll remove it

> It looks like you define some functions inside other functions with no line breaks. I don't know enough about Python to know if this is idiomatic, but I suspect not? It would be nicer to add some line breaks. It would probably be nicest to move them outside of their parent functions.

Python only cares about indentation, not empty lines, I'll add them.
Comment 4 Kalle Richter 2017-09-26 22:46:19 UTC
Created attachment 360502 [details] [review]
patch
Comment 5 Kalle Richter 2017-09-26 22:56:26 UTC
Created attachment 360503 [details] [review]
patch

I figured it might be worth to keep `parallel` as an option because it's a severe change to the API and users might not want it, so I added a `--no-parallel` flag to the CLI.

Regarding the function position, I figured that keeping them at the level inside the function increases readability (that's always controversial, of course) because they only serve to share code between parallel and non-parallel execution right after they're declared. I added this info as a comment. I added empty lines around those functions.
Comment 6 Kalle Richter 2017-09-26 23:15:30 UTC
Created attachment 360505 [details] [review]
patch

Sorry for the many updates, this is my first patch...
Comment 7 Kalle Richter 2017-09-27 00:07:07 UTC
Created attachment 360506 [details] [review]
patch

Need to take into account calls to `SystemInstall.install` of other `SystemInstall` implementations.
Comment 8 Christoph Reiter (lazka) 2020-11-12 08:07:07 UTC
I assume this was fixed by https://gitlab.gnome.org/GNOME/jhbuild/-/merge_requests/5 and related MRs