diff --git a/worldbuild-worker.py b/worldbuild-worker.py index 8d2e101..763bd49 100755 --- a/worldbuild-worker.py +++ b/worldbuild-worker.py @@ -90,7 +90,7 @@ if api != None and api_token == None: print("Error: API given but no token") sys.exit(1) -def cleanup(): +def cleanup(name): if name != None: if os.path.isfile("projects/worldbuild-" + name + "/osm2city-exceptions.log"): run("mv projects/worldbuild-" + name + "/osm2city-exceptions.log projects/worldbuild/output/error/" + name + "-" + strftime("%Y%m%d-%H%M") + ".exceptions.log", shell=True) @@ -149,7 +149,7 @@ try: build.wait() build = None - cleanup() + cleanup(name) if api != None: api_send_status(name, "done", api, api_token) @@ -162,11 +162,11 @@ except KeyboardInterrupt: try: if build != None: build.wait() - cleanup() - if api != None: - api_send_status(name, "done", api, api_token) - else: - send_status(name, "done", host, port) + cleanup(name) + if api != None: + api_send_status(name, "done", api, api_token) + else: + send_status(name, "done", host, port) except KeyboardInterrupt: #TODO doesn't work print("Forcing shutdown...") @@ -174,5 +174,5 @@ except KeyboardInterrupt: sleep(5) build.kill() sleep(5) - cleanup() + cleanup(name) sys.exit(0)