From 00520d6c1198c107e11a69403502d9e9968472cf Mon Sep 17 00:00:00 2001 From: kaetemi Date: Mon, 4 Jan 2021 09:58:44 +0800 Subject: [PATCH] Process rbank in parallel --- .../build_gamedata/processes/rbank/2_build.py | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/nel/tools/build_gamedata/processes/rbank/2_build.py b/nel/tools/build_gamedata/processes/rbank/2_build.py index b4c0ca674..ee41ede7f 100755 --- a/nel/tools/build_gamedata/processes/rbank/2_build.py +++ b/nel/tools/build_gamedata/processes/rbank/2_build.py @@ -24,7 +24,7 @@ # along with this program. If not, see . # -import time, sys, os, shutil, subprocess, distutils.dir_util +import time, sys, os, shutil, subprocess, distutils.dir_util, multiprocessing sys.path.append("../../configuration") if os.path.isfile("log.log"): @@ -226,15 +226,20 @@ else: else: printLog(log, "SKIP " + lr1) while len(zonesToBuild) > 0: - processCommand = [ ExecTimeout, str(RbankBuildTesselTimeout), BuildRbank, "-c", "-P", "-g" ] - processCommand.extend(zonesToBuild[:min(len(zonesToBuild), 64)]) - if len(zonesToBuild) > 64: - zonesToBuild = zonesToBuild[64:] - else: - zonesToBuild = [] - print processCommand - print len(processCommand) - subprocess.call(processCommand) + procs = [] + for i in range(0, multiprocessing.cpu_count()): + processCommand = [ ExecTimeout, str(RbankBuildTesselTimeout), BuildRbank, "-c", "-P", "-g" ] + processCommand.extend(zonesToBuild[:min(len(zonesToBuild), 64)]) + if len(zonesToBuild) > 64: + zonesToBuild = zonesToBuild[64:] + else: + zonesToBuild = [] + print processCommand + print len(processCommand) + proc = subprocess.Popen(processCommand) + procs.append(proc) + for proc in procs: + proc.wait() printLog(log, "") printLog(log, ">>> Detect modifications to rebuild lr <<<")