Commit 9c43dc11 authored by Samuel GAIST's avatar Samuel GAIST

[databases] Properly stop and remove the containers on index and view commands

It also prints what went wrong if the container failed.
parent 0d031f78
......@@ -377,7 +377,11 @@ def index_outputs(configuration, names, uid=None, db_root=None, docker=False):
uid=uid, db_root=db_root
)
status = host.wait(databases_container)
logs = host.logs(databases_container)
host.rm(databases_container)
if status != 0:
logger.error("Error occurred: %s", logs)
retcode += 1
return retcode
......@@ -509,6 +513,8 @@ def view_outputs(configuration, dataset_name, excluded_outputs=None, uid=None,
input_group = input_list.group(set_name)
retvalue = 0
# Display the data
try:
previous_start = -1
......@@ -559,9 +565,18 @@ def view_outputs(configuration, dataset_name, excluded_outputs=None, uid=None,
except Exception as e:
logger.error("Failed to retrieve the next data: %s", e)
return 1
retvalue = 1
if docker:
host.kill(databases_container)
status = host.wait(databases_container)
logs = host.logs(databases_container)
host.rm(databases_container)
if status != 0:
logger.error("Docker error: %s", logs)
return 0
return retvalue
# ----------------------------------------------------------
......
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