import re import json api = "" # fill in the api url and token api_token = "" level = "area" # either area or tile, process_job_status = "rebuild" # build tiles makred as this process_status_started = "started" # set tiles we've got a job for as this # called pre-build def get_command(name, options): match = re.match("^([we])(\d{3})([sn])(\d{2})", name) if match == None: return (None, "failed") if match.group(1) == "w": w = -1 * int(match.group(2)) e = str(w + 1) w = str(w) else: w = int(match.group(2)) e = str(w + 1) w = str(w) if match.group(3) == "s": s = -1 * int(match.group(4)) n = str(s + 1) s = str(s) else: s = int(match.group(4)) n = str(s + 1) s = str(s) cmd = "" # command to run, fill in the coordinates return (cmd, "started") # called post-run, gets the return code def check_result(return_code): if return_code == 0: return "done" return "failed"