From: Zac Medico Date: Sat, 11 Feb 2012 20:05:17 +0000 (-0800) Subject: PollScheduler: return None from _schedule_tasks X-Git-Tag: v2.2.0_alpha86~10 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=0f55a5a75c410d73779f7090784d06e40e03a1c9;p=portage.git PollScheduler: return None from _schedule_tasks The _keep_scheduling() template method is used instead. --- diff --git a/pym/_emerge/MetadataRegen.py b/pym/_emerge/MetadataRegen.py index 340400119..efe300421 100644 --- a/pym/_emerge/MetadataRegen.py +++ b/pym/_emerge/MetadataRegen.py @@ -139,27 +139,21 @@ class MetadataRegen(PollScheduler): pass def _schedule_tasks(self): - """ - @rtype: bool - @returns: True if there may be remaining tasks to schedule, - False otherwise. - """ if self._terminated_tasks: - return False + return while self._can_add_job(): try: metadata_process = next(self._process_iter) except StopIteration: self._remaining_tasks = False - return False + return self._jobs += 1 self._running_tasks.add(metadata_process) metadata_process.scheduler = self.sched_iface metadata_process.addExitListener(self._metadata_exit) metadata_process.start() - return True def _metadata_exit(self, metadata_process): self._jobs -= 1 diff --git a/pym/_emerge/PollScheduler.py b/pym/_emerge/PollScheduler.py index 3b3ef67df..e270e6ad0 100644 --- a/pym/_emerge/PollScheduler.py +++ b/pym/_emerge/PollScheduler.py @@ -70,6 +70,14 @@ class PollScheduler(object): """ raise NotImplementedError() + def _keep_scheduling(self): + """ + @rtype: bool + @returns: True if there may be remaining tasks to schedule, + False otherwise. + """ + return False + def _schedule_tasks(self): """ This is called from inside the _schedule() method, which @@ -83,7 +91,7 @@ class PollScheduler(object): Unless this method is used to perform user interface updates, or something like that, the first thing it should do is check the state of _terminated_tasks and if that is True then it - should return False immediately (since there's no need to + should return immediately (since there's no need to schedule anything after _terminate_tasks() has been called). """ pass @@ -105,7 +113,7 @@ class PollScheduler(object): self._terminated_tasks = True self._terminate_tasks() - return self._schedule_tasks() + self._schedule_tasks() finally: self._scheduling = False @@ -125,9 +133,6 @@ class PollScheduler(object): while self._is_work_scheduled(): self.sched_iface.iteration() - def _keep_scheduling(self): - return False - def _is_work_scheduled(self): return bool(self._running_job_count()) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 66d76b1e0..5bb4fe83a 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -1542,8 +1542,6 @@ class Scheduler(PollScheduler): not self._task_queues.merge)): break - return self._keep_scheduling() - def _job_delay(self): """ @rtype: bool