Whoops...
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
d245ba9844
commit
b23b4421ba
1 changed files with 35 additions and 35 deletions
|
@ -105,53 +105,53 @@ try:
|
||||||
else:
|
else:
|
||||||
name = get_job(action, host, port)
|
name = get_job(action, host, port)
|
||||||
|
|
||||||
run("mkdir -p projects/worldbuild-" + name, shell=True)
|
run("mkdir -p projects/worldbuild-" + name, shell=True)
|
||||||
|
|
||||||
run("cp projects/worldbuild/params.ini projects/worldbuild-" + name + "/", shell=True)
|
run("cp projects/worldbuild/params.ini projects/worldbuild-" + name + "/", shell=True)
|
||||||
|
|
||||||
if global_db:
|
if global_db:
|
||||||
db_name = prefix + "worldbuild"
|
db_name = prefix + "worldbuild"
|
||||||
|
else:
|
||||||
|
if get_south(name) >= 80:
|
||||||
|
db_name = prefix + "n-pole"
|
||||||
|
elif get_south(name) < -80:
|
||||||
|
db_name = prefix + "s-pole"
|
||||||
else:
|
else:
|
||||||
if get_south(name) >= 80:
|
match = re.match(r"[0-9]{1,7}", name)
|
||||||
db_name = prefix + "n-pole"
|
if match == None:
|
||||||
elif get_south(name) < -80:
|
print("ERROR: Invalid tile name")
|
||||||
db_name = prefix + "s-pole"
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
match = re.match(r"[0-9]{1,7}", name)
|
db_name = prefix + get_area_name(get_south(name), get_west(name), major=True)
|
||||||
if match == None:
|
|
||||||
print("ERROR: Invalid tile name")
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
|
||||||
db_name = prefix + get_area_name(get_south(name), get_west(name), major=True)
|
|
||||||
|
|
||||||
if get_west(name) < 0:
|
if get_west(name) < 0:
|
||||||
bounds = "bounds=*"
|
bounds = "bounds=*"
|
||||||
else:
|
else:
|
||||||
bounds = "bounds="
|
bounds = "bounds="
|
||||||
|
|
||||||
bounds += str(get_west(name)) + "_" + str(get_south(name)) + "_" + str(get_east(name)) + "_" + str(get_north(name))
|
bounds += str(get_west(name)) + "_" + str(get_south(name)) + "_" + str(get_east(name)) + "_" + str(get_north(name))
|
||||||
|
|
||||||
run("sed -i 's/DB_NAME.*/DB_NAME = \"" + db_name + "\"/' projects/worldbuild-" + name + "/params.ini", shell=True)
|
run("sed -i 's/DB_NAME.*/DB_NAME = \"" + db_name + "\"/' projects/worldbuild-" + name + "/params.ini", shell=True)
|
||||||
|
|
||||||
run("echo '" + bounds + "' > projects/worldbuild-" + name + "/settings", shell=True)
|
run("echo '" + bounds + "' > projects/worldbuild-" + name + "/settings", shell=True)
|
||||||
|
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print("Building " + name)
|
print("Building " + name)
|
||||||
|
|
||||||
logpath = "projects/worldbuild/output/" + get_area_name(get_south(name), get_west(name), major=True) + "/" + get_area_name(get_south(name), get_west(name)) + "/"
|
logpath = "projects/worldbuild/output/" + get_area_name(get_south(name), get_west(name), major=True) + "/" + get_area_name(get_south(name), get_west(name)) + "/"
|
||||||
run("mkdir -p " + logpath, shell=True)
|
run("mkdir -p " + logpath, shell=True)
|
||||||
with open(logpath + name + "-" + strftime("%Y%m%d-%H%M") + ".log", "w") as log_file:
|
with open(logpath + name + "-" + strftime("%Y%m%d-%H%M") + ".log", "w") as log_file:
|
||||||
build = Popen("./build -S 10 -t 1 worldbuild-" + name, stdout=log_file, stderr=STDOUT, shell=True, start_new_session=True)
|
build = Popen("./build -S 10 -t 1 worldbuild-" + name, stdout=log_file, stderr=STDOUT, shell=True, start_new_session=True)
|
||||||
|
|
||||||
build.wait()
|
build.wait()
|
||||||
build = None
|
build = None
|
||||||
|
|
||||||
cleanup()
|
cleanup()
|
||||||
|
|
||||||
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:
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print("Graceful shutdown triggered. To force immedate stop, press Ctrl+C again")
|
print("Graceful shutdown triggered. To force immedate stop, press Ctrl+C again")
|
||||||
|
|
Loading…
Reference in a new issue