diff --git a/grpc4bmi/bmi_client_docker.py b/grpc4bmi/bmi_client_docker.py index 328400a..e102c5c 100644 --- a/grpc4bmi/bmi_client_docker.py +++ b/grpc4bmi/bmi_client_docker.py @@ -102,7 +102,8 @@ def __init__(self, image: str, work_dir: str, image_port=50051, host=None, super(BmiClientDocker, self).__init__(BmiClient.create_grpc_channel(port=port, host=host), timeout=timeout) def __del__(self): - self.container.stop() + if hasattr(self, 'container'): + self.container.stop() def logs(self) -> str: """Returns complete combined stdout and stderr written by the Docker container. diff --git a/grpc4bmi/bmi_client_subproc.py b/grpc4bmi/bmi_client_subproc.py index 9b84081..6e81d92 100644 --- a/grpc4bmi/bmi_client_subproc.py +++ b/grpc4bmi/bmi_client_subproc.py @@ -26,7 +26,7 @@ def __init__(self, module_name, path=None, timeout=None, delay=1): super(BmiClientSubProcess, self).__init__(BmiClient.create_grpc_channel(port=port, host=host), timeout=timeout) def __del__(self): - self.pipe.terminate() + self.pipe.kill() self.pipe.wait(timeout=0.1) def get_value_ref(self, var_name):