From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 1300E138010 for ; Sat, 6 Oct 2012 22:01:20 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 27EEBE0484; Sat, 6 Oct 2012 22:01:10 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 952F1E0484 for ; Sat, 6 Oct 2012 22:01:09 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C192A33D776 for ; Sat, 6 Oct 2012 22:01:08 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 463B2E5436 for ; Sat, 6 Oct 2012 22:01:06 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1349560853.e8b66e3e9781aaad8535085007aa12b9a2a64742.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/PollScheduler.py pym/_emerge/Scheduler.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: e8b66e3e9781aaad8535085007aa12b9a2a64742 X-VCS-Branch: master Date: Sat, 6 Oct 2012 22:01:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d2f82d29-dcb6-4fe6-9a9b-5a514bcbd946 X-Archives-Hash: 9d4d69d5d2e4945c4d8beff6ea53c60d commit: e8b66e3e9781aaad8535085007aa12b9a2a64742 Author: Zac Medico gentoo org> AuthorDate: Sat Oct 6 22:00:53 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Oct 6 22:00:53 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=e8b66e3e PollScheduler: move _main_loop to Scheduler --- pym/_emerge/PollScheduler.py | 30 ------------------------------ pym/_emerge/Scheduler.py | 30 ++++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/pym/_emerge/PollScheduler.py b/pym/_emerge/PollScheduler.py index dbf137f..105943f 100644 --- a/pym/_emerge/PollScheduler.py +++ b/pym/_emerge/PollScheduler.py @@ -147,36 +147,6 @@ class PollScheduler(object): finally: self._scheduling = False - def _main_loop(self): - term_check_id = self.sched_iface.idle_add(self._termination_check) - loadavg_check_id = None - if self._max_load is not None: - # We have to schedule periodically, in case the load - # average has changed since the last call. - loadavg_check_id = self.sched_iface.timeout_add( - self._loadavg_latency, self._schedule) - - try: - # Populate initial event sources. Unless we're scheduling - # based on load average, we only need to do this once - # here, since it can be called during the loop from within - # event handlers. - self._schedule() - - # Loop while there are jobs to be scheduled. - while self._keep_scheduling(): - self.sched_iface.iteration() - - # Clean shutdown of previously scheduled jobs. In the - # case of termination, this allows for basic cleanup - # such as flushing of buffered output to logs. - while self._is_work_scheduled(): - self.sched_iface.iteration() - finally: - self.sched_iface.source_remove(term_check_id) - if loadavg_check_id is not None: - self.sched_iface.source_remove(loadavg_check_id) - def _is_work_scheduled(self): return bool(self._running_job_count()) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 6a87938..1814344 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -1338,6 +1338,36 @@ class Scheduler(PollScheduler): blocker_db = self._blocker_db[pkg.root] blocker_db.discardBlocker(pkg) + def _main_loop(self): + term_check_id = self.sched_iface.idle_add(self._termination_check) + loadavg_check_id = None + if self._max_load is not None: + # We have to schedule periodically, in case the load + # average has changed since the last call. + loadavg_check_id = self.sched_iface.timeout_add( + self._loadavg_latency, self._schedule) + + try: + # Populate initial event sources. Unless we're scheduling + # based on load average, we only need to do this once + # here, since it can be called during the loop from within + # event handlers. + self._schedule() + + # Loop while there are jobs to be scheduled. + while self._keep_scheduling(): + self.sched_iface.iteration() + + # Clean shutdown of previously scheduled jobs. In the + # case of termination, this allows for basic cleanup + # such as flushing of buffered output to logs. + while self._is_work_scheduled(): + self.sched_iface.iteration() + finally: + self.sched_iface.source_remove(term_check_id) + if loadavg_check_id is not None: + self.sched_iface.source_remove(loadavg_check_id) + def _merge(self): if self._opts_no_background.intersection(self.myopts):