Quiet flag for worker

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2020-02-15 20:38:50 +00:00
parent 38e7820ccd
commit b4d6afe7a2
2 changed files with 8 additions and 4 deletions

View file

@ -93,7 +93,7 @@ class launcher(threading.Thread):
self.run_max = count
def start_worker(self):
self.running.append(Popen(["./scripts/worldbuild-worker.py", "-p", ], start_new_session=True))
self.running.append(Popen(["./scripts/worldbuild-worker.py", "-q", "-p", prefix], start_new_session=True))
self.run_count += 1

View file

@ -26,6 +26,7 @@ action = "pending"
host = socket.gethostname()
port = 12345
prefix = ""
quiet = False
argc = len(sys.argv)
i = 1
@ -54,6 +55,7 @@ while i < argc:
print(" -p, --prefix Database prefix to use")
print(" --host Manager host")
print(" --port Manager port")
print(" -q, --quiet Don't print messages")
print(" -a, --action Considered tiles for build. Can be:")
print(" pending: Only builds pending tiles. These are always build: default")
print(" started: Run tiles marked as started. CAUTION, use with care.")
@ -83,7 +85,7 @@ def send_status(name, status):
sock.send(("set " + name + " " + status).encode())
sock.close()
except IOError:
print("Unable to send status. Aborting...")
print("Unable to send status " + status + " for tile " + name + ". Aborting...")
sys.exit(1)
def get_job(action):
@ -167,7 +169,8 @@ while running:
run("echo '" + bounds + "' > projects/worldbuild-" + name + "/settings", shell=True)
print("Building " + name)
if not quiet:
print("Building " + name)
with open("projects/worldbuild/output/" + name + ".log", "w") as log_file:
build = Popen("./build -S 10 -t 1 worldbuild-" + name, stdout=log_file, stderr=STDOUT, shell=True, start_new_session=True)
@ -178,7 +181,8 @@ while running:
send_status(name, "done")
except KeyboardInterrupt:
print("Graceful shutdown triggered. To force immedate stop, press Ctrl+C again")
if not quiet:
print("Graceful shutdown triggered. To force immedate stop, press Ctrl+C again")
running = False
try:
build.wait()