Quiet flag for worker
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
38e7820ccd
commit
b4d6afe7a2
2 changed files with 8 additions and 4 deletions
|
@ -93,7 +93,7 @@ class launcher(threading.Thread):
|
||||||
self.run_max = count
|
self.run_max = count
|
||||||
|
|
||||||
def start_worker(self):
|
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
|
self.run_count += 1
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,7 @@ action = "pending"
|
||||||
host = socket.gethostname()
|
host = socket.gethostname()
|
||||||
port = 12345
|
port = 12345
|
||||||
prefix = ""
|
prefix = ""
|
||||||
|
quiet = False
|
||||||
|
|
||||||
argc = len(sys.argv)
|
argc = len(sys.argv)
|
||||||
i = 1
|
i = 1
|
||||||
|
@ -54,6 +55,7 @@ while i < argc:
|
||||||
print(" -p, --prefix Database prefix to use")
|
print(" -p, --prefix Database prefix to use")
|
||||||
print(" --host Manager host")
|
print(" --host Manager host")
|
||||||
print(" --port Manager port")
|
print(" --port Manager port")
|
||||||
|
print(" -q, --quiet Don't print messages")
|
||||||
print(" -a, --action Considered tiles for build. Can be:")
|
print(" -a, --action Considered tiles for build. Can be:")
|
||||||
print(" pending: Only builds pending tiles. These are always build: default")
|
print(" pending: Only builds pending tiles. These are always build: default")
|
||||||
print(" started: Run tiles marked as started. CAUTION, use with care.")
|
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.send(("set " + name + " " + status).encode())
|
||||||
sock.close()
|
sock.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
print("Unable to send status. Aborting...")
|
print("Unable to send status " + status + " for tile " + name + ". Aborting...")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def get_job(action):
|
def get_job(action):
|
||||||
|
@ -167,7 +169,8 @@ while running:
|
||||||
|
|
||||||
run("echo '" + bounds + "' > projects/worldbuild-" + name + "/settings", shell=True)
|
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:
|
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)
|
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")
|
send_status(name, "done")
|
||||||
except KeyboardInterrupt:
|
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
|
running = False
|
||||||
try:
|
try:
|
||||||
build.wait()
|
build.wait()
|
||||||
|
|
Loading…
Add table
Reference in a new issue