Commit a7579ed1 authored by José Henrique's avatar José Henrique
Browse files

Kill process if build date file isn't present

parent 619bdf9e
......@@ -10,6 +10,7 @@ import sys
import glob
docker_client = docker.from_env()
stop_check_thread = False
def kill_container(container_name):
......@@ -82,6 +83,17 @@ def determine_build_dir(build_data_dir, base_dir):
sys.exit("Unable to determine build dir: " + build_dir)
def check_thread(build_data_file):
while stop_check_thread is False:
if not os.path.exists(build_data_file):
kill_process(os.getpid())
def start_check_thread(build_data_file):
threading.Thread(target=check_thread,
args=(build_data_file,)).start()
def write_build_data(build_env):
build_id = build_env["build_id"]
working_dir = build_env["working_dir"]
......@@ -101,6 +113,7 @@ def write_build_data(build_env):
}
with open(build_data_file, 'w') as json_file:
json.dump(data, json_file)
start_check_thread(build_data_file)
def start_notifier(environment_vars):
......@@ -125,6 +138,9 @@ def start_notifier(environment_vars):
def cleanup(build_env):
global stop_check_thread
stop_check_thread = True
time.sleep(3)
build_data_file = build_env["build_data_file"]
if os.path.exists(build_data_file):
json_data = load_json(build_data_file)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment