Scheduler: allow concurrent fetch with --jobs > 1
authorZac Medico <zmedico@gentoo.org>
Sun, 17 Jul 2011 18:16:20 +0000 (11:16 -0700)
committerZac Medico <zmedico@gentoo.org>
Sun, 17 Jul 2011 18:16:20 +0000 (11:16 -0700)
This reverts behavior from bug #375331 (commit
f07f8386e945b48358c11c121960e4833c539752) for cases in which --jobs is
greater than 1. We can add a separate --fetch-jobs option later, but
for now, this preserves previous behavior for --jobs > 1.

pym/_emerge/Scheduler.py

index 135e37a2fa44de141ae2768fb47c447c66dda741..2574d3de4994554a13a9e56c7dc99aace02d3d6f 100644 (file)
@@ -552,10 +552,19 @@ class Scheduler(PollScheduler):
 
        def _schedule_fetch(self, fetcher):
                """
-               Schedule a fetcher on the fetch queue, in order to
-               serialize access to the fetch log.
+               Schedule a fetcher, in order to control the number of concurrent
+               fetchers. If self._max_jobs is greater than 1 then the fetch
+               queue is bypassed and the fetcher is started immediately,
+               otherwise it is added to the front of the parallel-fetch queue.
+               NOTE: The parallel-fetch queue is currently used to serialize
+               access to the parallel-fetch log, so changes in the log handling
+               would be required before it would be possible to enable
+               concurrent fetching within the parallel-fetch queue.
                """
-               self._task_queues.fetch.addFront(fetcher)
+               if self._max_jobs > 1:
+                       fetcher.start()
+               else:
+                       self._task_queues.fetch.addFront(fetcher)
 
        def _schedule_setup(self, setup_phase):
                """