Always clean up
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
e08fbea737
commit
5926a0f72e
1 changed files with 10 additions and 5 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue