Always clean up

Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
fly 2020-01-15 13:54:27 +00:00
parent e08fbea737
commit 5926a0f72e

View file

@ -111,6 +111,12 @@ def get_job(action):
ret = get_job(action)
return ret
def cleanup():
if os.path.isfile("projects/worldbuild-" + name + "/osm2city-exceptions.log"):
run("mv projects/worldbuild-" + name + "/osm2city-exceptions.log projects/worldbuild/output/error/" + name + ".exceptions.log", shell=True)
run("rm -rf projects/worldbuild-" + name, shell=True)
running = True
while running:
@ -165,11 +171,7 @@ while running:
build = Popen("./build -S 10 -t 1 worldbuild-" + name, shell=True, start_new_session=True)
if os.path.isfile("projects/worldbuild-" + name + "/osm2city-exceptions.log"):
run("mv projects/worldbuild-" + name + "/osm2city-exceptions.log projects/worldbuild/output/error/" + name + ".exceptions.log", shell=True)
sleep(10)
run("rm -rf projects/worldbuild-" + name, shell=True)
cleanup()
send_status(name, "done")
except KeyboardInterrupt:
@ -177,6 +179,8 @@ while running:
running = False
try:
build.wait()
cleanup()
send_status(name, "done")
except KeyboardInterrupt:
#TODO doesn't work
print("Forcing shutdown...")
@ -184,4 +188,5 @@ while running:
sleep(5)
build.kill()
sleep(5)
cleanup()
sys.exit(0)