From 61e5698fe63d02a1372479712d08854c1c02fdbc Mon Sep 17 00:00:00 2001 From: yejianwu Date: Thu, 26 Apr 2018 19:46:51 +0800 Subject: [PATCH] fix caffe validate for exited container --- tools/sh_commands.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/tools/sh_commands.py b/tools/sh_commands.py index 8817dd93..61f49b52 100644 --- a/tools/sh_commands.py +++ b/tools/sh_commands.py @@ -643,6 +643,11 @@ def validate_model(abi, sh.docker("build", "-t", image_name, "docker/caffe") container_id = sh.docker("ps", "-qa", "-f", "name=%s" % container_name) + if container_id and not sh.docker("ps", "-qa", "--filter", + "status=running", "-f", + "name=%s" % container_name): + sh.docker("rm", "-f", container_name) + container_id = "" if not container_id: print("Run caffe container") sh.docker( @@ -654,14 +659,6 @@ def validate_model(abi, image_name, "/bin/bash") - container_status = sh.docker("inspect", - "-f", - "{{.State.Running}}", - container_name) - if container_status == "false": - print("Start caffe container") - sh.docker("start", container_name) - for input_name in input_nodes: formatted_input_name = formatted_file_name( input_name, input_file_name) -- GitLab