diff --git a/grpc4bmi/bmi_client_subproc.py b/grpc4bmi/bmi_client_subproc.py index 4e2104a..277440c 100644 --- a/grpc4bmi/bmi_client_subproc.py +++ b/grpc4bmi/bmi_client_subproc.py @@ -15,14 +15,14 @@ class BmiClientSubProcess(BmiClient): >>> mymodel = BmiClientSubProcess(..) """ - def __init__(self, module_name, path=None, timeout=None): + def __init__(self, module_name, path=None, timeout=None, delay=1): host = "localhost" port = BmiClient.get_unique_port(host) name_options = ["--name", module_name] port_options = ["--port", str(port)] path_options = ["--path", path] if path else [] self.pipe = subprocess.Popen(["run-bmi-server"] + name_options + port_options + path_options, env=dict(os.environ)) - time.sleep(1) + time.sleep(delay) super(BmiClientSubProcess, self).__init__(BmiClient.create_grpc_channel(port=port, host=host), timeout=timeout) def __del__(self): diff --git a/test/test_subproc.py b/test/test_subproc.py index 423e87d..e57b6a2 100644 --- a/test/test_subproc.py +++ b/test/test_subproc.py @@ -22,7 +22,7 @@ def make_bmi_classes(init=False): numpy.random.seed(0) os.environ["PYTHONPATH"] = os.path.dirname(os.path.abspath(__file__)) - client = BmiClientSubProcess("heat.BmiHeat", timeout=10) + client = BmiClientSubProcess("heat.BmiHeat", timeout=10, delay=3) local = BmiHeat() if init: client.initialize(None)