Fixed more issues

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2021-03-27 19:12:03 +00:00
parent a56de2ad5a
commit 59ef035bec

View file

@ -90,7 +90,7 @@ if api != None and api_token == None:
print("Error: API given but no token") print("Error: API given but no token")
sys.exit(1) sys.exit(1)
def cleanup(): def cleanup(name):
if name != None: if name != None:
if os.path.isfile("projects/worldbuild-" + name + "/osm2city-exceptions.log"): 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) 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.wait()
build = None build = None
cleanup() cleanup(name)
if api != None: if api != None:
api_send_status(name, "done", api, api_token) api_send_status(name, "done", api, api_token)
@ -162,11 +162,11 @@ except KeyboardInterrupt:
try: try:
if build != None: if build != None:
build.wait() build.wait()
cleanup() cleanup(name)
if api != None: if api != None:
api_send_status(name, "done", api, api_token) api_send_status(name, "done", api, api_token)
else: else:
send_status(name, "done", host, port) send_status(name, "done", host, port)
except KeyboardInterrupt: except KeyboardInterrupt:
#TODO doesn't work #TODO doesn't work
print("Forcing shutdown...") print("Forcing shutdown...")
@ -174,5 +174,5 @@ except KeyboardInterrupt:
sleep(5) sleep(5)
build.kill() build.kill()
sleep(5) sleep(5)
cleanup() cleanup(name)
sys.exit(0) sys.exit(0)