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

Fix "unable to determine build dir" error

parent 08cc5fae
......@@ -45,10 +45,10 @@ 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)
time.sleep(1)
build_container_name = (
"android_build_" +
hashlib.md5(build_dir.encode("utf-8")).hexdigest()
......@@ -56,9 +56,15 @@ def determine_build_dir(base_dir):
if os.path.exists(build_dir):
ts_file = build_dir + "/.ts"
if os.path.exists(ts_file):
if os.stat(ts_file).st_mtime < time.time() - max_time:
current_time = time.time()
ts_file_m_time = os.stat(ts_file).st_mtime
if (ts_file_m_time < current_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:
......@@ -119,7 +125,6 @@ def start_build(environment_vars):
pull_image(image_name)
print("Starting build container, with environment variables: " +
json.dumps(environment_vars))
time.sleep(2)
try:
stream_container_logs(container_name)
time.sleep(1)
......
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