@@ -74,6 +74,8 @@ def __init__(
74
74
port : int = 7123 ,
75
75
image : Optional [DockerImage ] = None ,
76
76
base_image : str = "python:3.11-alpine3.18" ,
77
+ docker_startup_timeout : float = 300.0 ,
78
+ repl_startup_timeout : float = 3.0 ,
77
79
** kwargs : Dict [str , Any ],
78
80
) -> None :
79
81
"""Starts docker container with python REPL server and wait till it
@@ -89,6 +91,8 @@ def __init__(
89
91
:param port: port to use for the python REPL server.
90
92
:param image: docker image to use for the container.
91
93
:param base_image: base image to use for the docker image.
94
+ :param docker_startup_timeout: timeout in seconds to wait for docker container to start.
95
+ :param repl_startup_timeout: timeout in seconds to wait for REPL server to start.
92
96
:param kwargs: additional params to pass to DockerContainer constructor.
93
97
"""
94
98
# for now use the image we created.
@@ -105,8 +109,8 @@ def __init__(
105
109
# we need to ensure container is running and REPL server is
106
110
# ready to accept requests, otherwise we might get connection
107
111
# refused due to race conditions.
108
- self ._wait_for_container_running ()
109
- self ._wait_for_repl_ready ()
112
+ self ._wait_for_container_running (timeout = docker_startup_timeout )
113
+ self ._wait_for_repl_ready (timeout = repl_startup_timeout )
110
114
111
115
def _wait_for_container_running (self , timeout : float = 3.0 ) -> None :
112
116
"""Sleep until container is running or timeout is reached.
0 commit comments