diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-07-07 17:31:57 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-07-07 17:31:57 -0700 |
commit | a38c4e082649051cd6823bd8ab96c67130e94a82 (patch) | |
tree | 84e65295d2e8d873a355b32f22285668b54e2655 | |
parent | e89da47d4ef51fba3d5a03f1b379d9ad02190d22 (diff) | |
download | portage-a38c4e082649051cd6823bd8ab96c67130e94a82.tar.gz portage-a38c4e082649051cd6823bd8ab96c67130e94a82.tar.bz2 portage-a38c4e082649051cd6823bd8ab96c67130e94a82.zip |
Add a Scheduler._is_work_scheduled() method, to handle the logic involved
in bug #326787.
-rw-r--r-- | pym/_emerge/Scheduler.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 8f025f5e6..a6368fcb4 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -1331,15 +1331,14 @@ class Scheduler(PollScheduler): return None if self._digraph is None: - if (self._jobs or self._task_queues.merge) and \ + if self._is_work_scheduled() and \ not ("--nodeps" in self.myopts and \ (self._max_jobs is True or self._max_jobs > 1)): self._choose_pkg_return_early = True return None return self._pkg_queue.pop(0) - if not (self._jobs or \ - self._task_queues.merge or self._merge_wait_queue): + if not self._is_work_scheduled(): return self._pkg_queue.pop(0) self._prune_digraph() @@ -1439,15 +1438,13 @@ class Scheduler(PollScheduler): self._opts_no_background.intersection(self.myopts): self._set_max_jobs(1) - merge_queue = self._task_queues.merge - while self._schedule(): if self._poll_event_handlers: self._poll_loop() while True: self._schedule() - if not (self._jobs or merge_queue): + if not self._is_work_scheduled(): break if self._poll_event_handlers: self._poll_loop() @@ -1456,6 +1453,10 @@ class Scheduler(PollScheduler): return bool(self._pkg_queue and \ not (self._failed_pkgs and not self._build_opts.fetchonly)) + def _is_work_scheduled(self): + return bool(self._jobs or \ + self._task_queues.merge or self._merge_wait_queue) + def _schedule_tasks(self): # When the number of jobs drops to zero, process all waiting merges. @@ -1478,7 +1479,7 @@ class Scheduler(PollScheduler): # Cancel prefetchers if they're the only reason # the main poll loop is still running. if self._failed_pkgs and not self._build_opts.fetchonly and \ - not (self._jobs or self._task_queues.merge) and \ + not self._is_work_scheduled() and \ self._task_queues.fetch: self._task_queues.fetch.clear() state_change += 1 |