diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-07-29 15:17:07 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-07-29 15:17:07 +0000 |
commit | be4003dde85dbceddf7aaf56a496aea8b32743f7 (patch) | |
tree | 578c2bf786bee4f2f1a4ef27ce130d89eb631701 | |
parent | e4efa726d065712d39c4d61b7babc5a8278ff54d (diff) | |
download | portage-be4003dde85dbceddf7aaf56a496aea8b32743f7.tar.gz portage-be4003dde85dbceddf7aaf56a496aea8b32743f7.tar.bz2 portage-be4003dde85dbceddf7aaf56a496aea8b32743f7.zip |
Enable Scheduler._job_delay() whenever --load-average is enabled, for whole
time the scheduler is running. This protects against too many jobs being
sheduled if the load average temporarily drops.
svn path=/main/trunk/; revision=11264
-rw-r--r-- | pym/_emerge/__init__.py | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index a153ea6f3..5d1b7f174 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -8862,14 +8862,9 @@ class Scheduler(PollScheduler): # The load average takes some time to respond when new # jobs are added, so we need to limit the rate of adding - # new jobs when emerge first starts. - self._main_loop_init_delay_period = 60 + # new jobs. self._job_delay_factor = 0.5 - - # State variables - self._main_loop_init_delay = None self._previous_job_start_time = None - self._main_loop_start_time = None self._set_digraph(digraph) @@ -9636,8 +9631,6 @@ class Scheduler(PollScheduler): self._config_pool[settings["ROOT"]].append(settings) def _main_loop(self): - self._main_loop_init_delay = self._max_load is not None - self._main_loop_start_time = time.time() # Only allow 1 job max if a restart is scheduled # due to portage update. @@ -9675,15 +9668,11 @@ class Scheduler(PollScheduler): @returns: True if job scheduling should be delayed, False otherwise. """ - if self._main_loop_init_delay and self._jobs: + if self._jobs and self._max_load is not None: current_time = time.time() - if current_time - self._main_loop_start_time > \ - self._main_loop_init_delay_period: - self._main_loop_init_delay = False - - elif current_time - self._previous_job_start_time < \ + if current_time - self._previous_job_start_time < \ self._job_delay_factor * self._jobs: return True @@ -9702,11 +9691,9 @@ class Scheduler(PollScheduler): if not self._pkg_queue or self._failed_pkgs: return (False, state_change) - if self._job_delay(): - return (True, state_change) - if self._choose_pkg_return_early or \ - not self._can_add_job(): + not self._can_add_job() or \ + self._job_delay(): return (True, state_change) pkg = self._choose_pkg() |