diff options
author | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-07-29 21:23:30 -0400 |
---|---|---|
committer | Konstantin Ryabitsev <konstantin@linuxfoundation.org> | 2020-07-29 21:23:30 -0400 |
commit | fefdfc385fa25c28a76de0056278b30c191d4a48 (patch) | |
tree | 70f1761e5f8debc0117d8170a38b7c48b34106d1 | |
parent | 9ed23c49bc00a1fde6db8bb147f8f8d2337f2ad7 (diff) | |
download | grokmirror-fefdfc385fa25c28a76de0056278b30c191d4a48.tar.gz |
Don't pause the spa on -o runs
When doing initial cloning with -o, we don't want to pause the spa on
high loads because this will negate a lot of disk savings we get due to
cloning with reference.
Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
-rwxr-xr-x | grokmirror/pull.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/grokmirror/pull.py b/grokmirror/pull.py index 758d387..f3637a4 100755 --- a/grokmirror/pull.py +++ b/grokmirror/pull.py @@ -171,20 +171,20 @@ def build_optimal_forkgroups(l_manifest, r_manifest, toplevel, obstdir): return forkgroups -def spa_worker(config, q_spa): +def spa_worker(config, q_spa, pauseonload): toplevel = os.path.realpath(config['core'].get('toplevel')) cpus = mp.cpu_count() saidpaused = False while True: - load = os.getloadavg() - if load[0] > cpus: - if not saidpaused: - logger.info(' spa: paused (system load), %s waiting', q_spa.qsize()) - saidpaused = True - time.sleep(5) - continue - - saidpaused = False + if pauseonload: + load = os.getloadavg() + if load[0] > cpus: + if not saidpaused: + logger.info(' spa: paused (system load), %s waiting', q_spa.qsize()) + saidpaused = True + time.sleep(5) + continue + saidpaused = False try: (gitdir, actions) = q_spa.get(timeout=1) @@ -1051,7 +1051,11 @@ def pull_mirror(config, verbose=False, nomtime=False, forcepurge=False, runonce= continue if not q_spa.empty() and not len(dws): - dw = mp.Process(target=spa_worker, args=(config, q_spa)) + if runonce: + pauseonload = False + else: + pauseonload = True + dw = mp.Process(target=spa_worker, args=(config, q_spa, pauseonload)) dw.start() dws.append(dw) |