Commit 5e55a079 authored by José Henrique's avatar José Henrique
Browse files

Fixes for concurrent builds

parent 0ee6955c
......@@ -45,7 +45,6 @@ def determine_build_dir(base_dir):
max_concurrent = 2
build_dir = base_dir
max_time = 3 # 3 seconds
time.sleep(max_time+1)
for i in range(1, max_concurrent + 1):
if i != 1:
build_dir = base_dir + "_" + str(i)
......@@ -56,29 +55,23 @@ def determine_build_dir(base_dir):
if os.path.exists(build_dir):
ts_file = build_dir + "/.ts"
if os.path.exists(ts_file):
current_time = time.time()
ts_file_m_time = os.stat(ts_file).st_mtime
if (ts_file_m_time < current_time) - max_time:
current_time = int(time.time())
ts_file_m_time = int(os.stat(ts_file).st_mtime)
if current_time - ts_file_m_time >= max_time:
kill_container(build_container_name)
return build_dir
else:
print(ts_file + " modification time: " +
str(ts_file_m_time))
print("current time: " + str(current_time))
else:
return build_dir
else:
return build_dir
sys.exit("Unable to determine build dir: " + build_dir)
def write_ts_file_thread(build_dir):
ts_file = build_dir + "/.ts"
while stop_ts_thread is False:
with open(ts_file, "w") as f:
f.write(str(time.time()))
time.sleep(1)
os.remove(ts_file)
def cleanup():
......
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