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) ret = get_job(action)
return ret 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 running = True
while running: while running:
@ -165,11 +171,7 @@ while running:
build = Popen("./build -S 10 -t 1 worldbuild-" + name, shell=True, start_new_session=True) 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"): cleanup()
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)
send_status(name, "done") send_status(name, "done")
except KeyboardInterrupt: except KeyboardInterrupt:
@ -177,6 +179,8 @@ while running:
running = False running = False
try: try:
build.wait() build.wait()
cleanup()
send_status(name, "done")
except KeyboardInterrupt: except KeyboardInterrupt:
#TODO doesn't work #TODO doesn't work
print("Forcing shutdown...") print("Forcing shutdown...")
@ -184,4 +188,5 @@ while running:
sleep(5) sleep(5)
build.kill() build.kill()
sleep(5) sleep(5)
cleanup()
sys.exit(0) sys.exit(0)