zenml
zenml copied to clipboard
[BUG]: Connection error between Kubeflow and ZenML
Contact Details [Optional]
System Information
ZENML_LOCAL_VERSION: 0.42.1 ZENML_SERVER_VERSION: 0.42.1 Zenml: Docker Desktop with wsl2 backend Os: window 11 Python version: 3.10 Environmen: conda
What happened?
I follow this link to deploy kubeflow in local PC using DesktopDocker. After the setup, I configured the stack and ran with with the example kubeflow_pipelines_orchestration. I delete the tensorboard log from the source code I able to run the pipeline with kubeflow. But after I restart my computer, and run again, it appears error in the "Relevant log output"
Reproduction steps
- Setup Zenml server with Docker Desktop at port 8238 and connect the local zenml to it
- Download the stack recipe for local Kubeflow and deploy it
- Configure the stack with output's yaml file of the stack recipe deployment
- Download kubeflow_pipelines_orchestration example, delete the tensorboard logging function
- Run the run.py file in the example with the Kubeflow stack ...
Relevant log output
time="2023-08-10T07:29:44.479Z" level=info msg="capturing logs" argo=true
โญโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโฎ
โ /usr/local/lib/python3.10/site-packages/urllib3/connection.py:174 in โ
โ _new_conn โ
โ โ
โ 171 โ โ โ extra_kw["socket_options"] = self.socket_options โ
โ 172 โ โ โ
โ 173 โ โ try: โ
โ โฑ 174 โ โ โ conn = connection.create_connection( โ
โ 175 โ โ โ โ (self._dns_host, self.port), self.timeout, **extra_kw โ
โ 176 โ โ โ ) โ
โ 177 โ
โ โ
โ /usr/local/lib/python3.10/site-packages/urllib3/util/connection.py:95 in โ
โ create_connection โ
โ โ
โ 92 โ โ โ โ sock = None โ
โ 93 โ โ
โ 94 โ if err is not None: โ
โ โฑ 95 โ โ raise err โ
โ 96 โ โ
โ 97 โ raise socket.error("getaddrinfo returns an empty list") โ
โ 98 โ
โ โ
โ /usr/local/lib/python3.10/site-packages/urllib3/util/connection.py:85 in โ
โ create_connection โ
โ โ
โ 82 โ โ โ โ sock.settimeout(timeout) โ
โ 83 โ โ โ if source_address: โ
โ 84 โ โ โ โ sock.bind(source_address) โ
โ โฑ 85 โ โ โ sock.connect(sa) โ
โ 86 โ โ โ return sock โ
โ 87 โ โ โ
โ 88 โ โ except socket.error as e: โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
ConnectionRefusedError: [Errno 111] Connection refused
During handling of the above exception, another exception occurred:
โญโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโฎ
โ /usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py:714 in โ
โ urlopen โ
โ โ
โ 711 โ โ โ โ self._prepare_proxy(conn) โ
โ 712 โ โ โ โ
โ 713 โ โ โ # Make the request on the httplib connection object. โ
โ โฑ 714 โ โ โ httplib_response = self._make_request( โ
โ 715 โ โ โ โ conn, โ
โ 716 โ โ โ โ method, โ
โ 717 โ โ โ โ url, โ
โ โ
โ /usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py:415 in โ
โ _make_request โ
โ โ
โ 412 โ โ โ if chunked: โ
โ 413 โ โ โ โ conn.request_chunked(method, url, **httplib_request_k โ
โ 414 โ โ โ else: โ
โ โฑ 415 โ โ โ โ conn.request(method, url, **httplib_request_kw) โ
โ 416 โ โ โ
โ 417 โ โ # We are swallowing BrokenPipeError (errno.EPIPE) since the s โ
โ 418 โ โ # legitimately able to close the connection after sending a v โ
โ โ
โ /usr/local/lib/python3.10/site-packages/urllib3/connection.py:244 in request โ
โ โ
โ 241 โ โ โ headers = headers.copy() โ
โ 242 โ โ if "user-agent" not in (six.ensure_str(k.lower()) for k in hea โ
โ 243 โ โ โ headers["User-Agent"] = _get_default_user_agent() โ
โ โฑ 244 โ โ super(HTTPConnection, self).request(method, url, body=body, he โ
โ 245 โ โ
โ 246 โ def request_chunked(self, method, url, body=None, headers=None): โ
โ 247 โ โ """ โ
โ โ
โ /usr/local/lib/python3.10/http/client.py:1283 in request โ
โ โ
โ 1280 โ def request(self, method, url, body=None, headers={}, *, โ
โ 1281 โ โ โ โ encode_chunked=False): โ
โ 1282 โ โ """Send a complete request to the server.""" โ
โ โฑ 1283 โ โ self._send_request(method, url, body, headers, encode_chunked โ
โ 1284 โ โ
โ 1285 โ def _send_request(self, method, url, body, headers, encode_chunke โ
โ 1286 โ โ # Honor explicitly requested Host: and Accept-Encoding: heade โ
โ โ
โ /usr/local/lib/python3.10/http/client.py:1329 in _send_request โ
โ โ
โ 1326 โ โ โ # RFC 2616 Section 3.7.1 says that text default has a โ
โ 1327 โ โ โ # default charset of iso-8859-1. โ
โ 1328 โ โ โ body = _encode(body, 'body') โ
โ โฑ 1329 โ โ self.endheaders(body, encode_chunked=encode_chunked) โ
โ 1330 โ โ
โ 1331 โ def getresponse(self): โ
โ 1332 โ โ """Get the response from the server. โ
โ โ
โ /usr/local/lib/python3.10/http/client.py:1278 in endheaders โ
โ โ
โ 1275 โ โ โ self.__state = _CS_REQ_SENT โ
โ 1276 โ โ else: โ
โ 1277 โ โ โ raise CannotSendHeader() โ
โ โฑ 1278 โ โ self._send_output(message_body, encode_chunked=encode_chunked โ
โ 1279 โ โ
โ 1280 โ def request(self, method, url, body=None, headers={}, *, โ
โ 1281 โ โ โ โ encode_chunked=False): โ
โ โ
โ /usr/local/lib/python3.10/http/client.py:1038 in _send_output โ
โ โ
โ 1035 โ โ self._buffer.extend((b"", b"")) โ
โ 1036 โ โ msg = b"\r\n".join(self._buffer) โ
โ 1037 โ โ del self._buffer[:] โ
โ โฑ 1038 โ โ self.send(msg) โ
โ 1039 โ โ โ
โ 1040 โ โ if message_body is not None: โ
โ 1041 โ
โ โ
โ /usr/local/lib/python3.10/http/client.py:976 in send โ
โ โ
โ 973 โ โ โ
โ 974 โ โ if self.sock is None: โ
โ 975 โ โ โ if self.auto_open: โ
โ โฑ 976 โ โ โ โ self.connect() โ
โ 977 โ โ โ else: โ
โ 978 โ โ โ โ raise NotConnected() โ
โ 979 โ
โ โ
โ /usr/local/lib/python3.10/site-packages/urllib3/connection.py:205 in connect โ
โ โ
โ 202 โ โ โ self.auto_open = 0 โ
โ 203 โ โ
โ 204 โ def connect(self): โ
โ โฑ 205 โ โ conn = self._new_conn() โ
โ 206 โ โ self._prepare_conn(conn) โ
โ 207 โ โ
โ 208 โ def putrequest(self, method, url, *args, **kwargs): โ
โ โ
โ /usr/local/lib/python3.10/site-packages/urllib3/connection.py:186 in โ
โ _new_conn โ
โ โ
โ 183 โ โ โ ) โ
โ 184 โ โ โ
โ 185 โ โ except SocketError as e: โ
โ โฑ 186 โ โ โ raise NewConnectionError( โ
โ 187 โ โ โ โ self, "Failed to establish a new connection: %s" % e โ
โ 188 โ โ โ ) โ
โ 189 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
NewConnectionError: <urllib3.connection.HTTPConnection object at
0x7f35667affa0>: Failed to establish a new connection: [Errno 111] Connection
refused
During handling of the above exception, another exception occurred:
โญโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโฎ
โ /usr/local/lib/python3.10/site-packages/requests/adapters.py:486 in send โ
โ โ
โ 483 โ โ โ timeout = TimeoutSauce(connect=timeout, read=timeout) โ
โ 484 โ โ โ
โ 485 โ โ try: โ
โ โฑ 486 โ โ โ resp = conn.urlopen( โ
โ 487 โ โ โ โ method=request.method, โ
โ 488 โ โ โ โ url=url, โ
โ 489 โ โ โ โ body=request.body, โ
โ โ
โ /usr/local/lib/python3.10/site-packages/urllib3/connectionpool.py:798 in โ
โ urlopen โ
โ โ
โ 795 โ โ โ elif isinstance(e, (SocketError, HTTPException)): โ
โ 796 โ โ โ โ e = ProtocolError("Connection aborted.", e) โ
โ 797 โ โ โ โ
โ โฑ 798 โ โ โ retries = retries.increment( โ
โ 799 โ โ โ โ method, url, error=e, _pool=self, _stacktrace=sys.exc โ
โ 800 โ โ โ ) โ
โ 801 โ โ โ retries.sleep() โ
โ โ
โ /usr/local/lib/python3.10/site-packages/urllib3/util/retry.py:592 in โ
โ increment โ
โ โ
โ 589 โ โ ) โ
โ 590 โ โ โ
โ 591 โ โ if new_retry.is_exhausted(): โ
โ โฑ 592 โ โ โ raise MaxRetryError(_pool, url, error or ResponseError(cau โ
โ 593 โ โ โ
โ 594 โ โ log.debug("Incremented Retry for (url='%s'): %r", url, new_ret โ
โ 595 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
MaxRetryError: HTTPConnectionPool(host='localhost', port=8238): Max retries
exceeded with url: /api/v1/info (Caused by
NewConnectionError('<urllib3.connection.HTTPConnection object at
0x7f35667affa0>: Failed to establish a new connection: [Errno 111] Connection
refused'))
During handling of the above exception, another exception occurred:
โญโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโฎ
โ /usr/local/lib/python3.10/site-packages/zenml/zen_stores/base_zen_store.py:1 โ
โ 44 in __init__ โ
โ โ
โ 141 โ โ super().__init__(**kwargs) โ
โ 142 โ โ โ
โ 143 โ โ try: โ
โ โฑ 144 โ โ โ self._initialize() โ
โ 145 โ โ except Exception as e: โ
โ 146 โ โ โ raise RuntimeError( โ
โ 147 โ โ โ โ f"Error initializing {self.type.value} store with URL โ
โ โ
โ /usr/local/lib/python3.10/site-packages/zenml/zen_stores/rest_zen_store.py:4 โ
โ 17 in _initialize โ
โ โ
โ 414 โ def _initialize(self) -> None: โ
โ 415 โ โ """Initialize the REST store.""" โ
โ 416 โ โ client_version = zenml.__version__ โ
โ โฑ 417 โ โ server_version = self.get_store_info().version โ
โ 418 โ โ โ
โ 419 โ โ if not DISABLE_CLIENT_SERVER_MISMATCH_WARNING and ( โ
โ 420 โ โ โ server_version != client_version โ
โ โ
โ /usr/local/lib/python3.10/site-packages/zenml/zen_stores/rest_zen_store.py:4 โ
โ 38 in get_store_info โ
โ โ
โ 435 โ โ Returns: โ
โ 436 โ โ โ Information about the server. โ
โ 437 โ โ """ โ
โ โฑ 438 โ โ body = self.get(INFO) โ
โ 439 โ โ return ServerModel.parse_obj(body) โ
โ 440 โ โ
โ 441 โ # ------ โ
โ โ
โ /usr/local/lib/python3.10/site-packages/zenml/zen_stores/rest_zen_store.py:2 โ
โ 480 in get โ
โ โ
โ 2477 โ โ โ The response body. โ
โ 2478 โ โ """ โ
โ 2479 โ โ logger.debug(f"Sending GET request to {path}...") โ
โ โฑ 2480 โ โ return self._request( โ
โ 2481 โ โ โ "GET", self.url + API + VERSION_1 + path, params=params, โ
โ 2482 โ โ ) โ
โ 2483 โ
โ โ
โ /usr/local/lib/python3.10/site-packages/zenml/zen_stores/rest_zen_store.py:2 โ
โ 442 in _request โ
โ โ
โ 2439 โ โ โ
โ 2440 โ โ try: โ
โ 2441 โ โ โ return self._handle_response( โ
โ โฑ 2442 โ โ โ โ self.session.request( โ
โ 2443 โ โ โ โ โ method, โ
โ 2444 โ โ โ โ โ url, โ
โ 2445 โ โ โ โ โ params=params, โ
โ โ
โ /usr/local/lib/python3.10/site-packages/requests/sessions.py:589 in request โ
โ โ
โ 586 โ โ โ "allow_redirects": allow_redirects, โ
โ 587 โ โ } โ
โ 588 โ โ send_kwargs.update(settings) โ
โ โฑ 589 โ โ resp = self.send(prep, **send_kwargs) โ
โ 590 โ โ โ
โ 591 โ โ return resp โ
โ 592 โ
โ โ
โ /usr/local/lib/python3.10/site-packages/requests/sessions.py:703 in send โ
โ โ
โ 700 โ โ start = preferred_clock() โ
โ 701 โ โ โ
โ 702 โ โ # Send the request โ
โ โฑ 703 โ โ r = adapter.send(request, **kwargs) โ
โ 704 โ โ โ
โ 705 โ โ # Total elapsed time of the request (approximately) โ
โ 706 โ โ elapsed = preferred_clock() - start โ
โ โ
โ /usr/local/lib/python3.10/site-packages/requests/adapters.py:519 in send โ
โ โ
โ 516 โ โ โ โ # This branch is for urllib3 v1.22 and later. โ
โ 517 โ โ โ โ raise SSLError(e, request=request) โ
โ 518 โ โ โ โ
โ โฑ 519 โ โ โ raise ConnectionError(e, request=request) โ
โ 520 โ โ โ
โ 521 โ โ except ClosedPoolError as e: โ
โ 522 โ โ โ raise ConnectionError(e, request=request) โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
ConnectionError: HTTPConnectionPool(host='localhost', port=8238): Max retries
exceeded with url: /api/v1/info (Caused by
NewConnectionError('<urllib3.connection.HTTPConnection object at
0x7f35667affa0>: Failed to establish a new connection: [Errno 111] Connection
refused'))
Code of Conduct
- [X] I agree to follow this project's Code of Conduct
Thanks for reporting @ngohoanganh96 ! We will need to have a closer look.
Hey @ngohoanganh96, thanks for the issue. Please help me with the following so I can understand your problem better:
- What is the output when you run
zenml status
? - Can you try disconnecting to the server (
zenml disconnect
) and then connecting again? - What code, specifically, have you deleted and why? If you have it in a public repo, that'd be super helpful too or you can just post relevant snippets.
Dear @wjayesh, sorry for the late reply, for each of your question, my answers are as below
-
What is the output when you run
zenml status
? -----ZenML Server Status----- Connected to a ZenML server: 'http://localhost:8238' The active user is: 'default' The active workspace is: 'default' (global) The active stack is: 'default' (global) Using configuration from: 'C:\Users\anhnth16\AppData\Roaming\zenml' Local store files are located at: 'C:\Users\anhnth16\AppData\Roaming\zenml\local_stores' The status of the local dashboard: ZenML server 'local' โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ URL โ โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ STATUS โ โธ โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ STATUS_MESSAGE โ Docker container is not present โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ CONNECTED โ โ โโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ -
Can you try disconnecting to the server (
zenml disconnect
) and then connecting again? Yes, I have tried to disconnect to the server, and re-connect, it connected fine, but it still occured the same error when i ran the code. -
What code, specifically, have you deleted and why? If you have it in a public repo, that'd be super helpful too or you can just post relevant snippets.
log_dir = os.path.join(context.get_output_artifact_uri(), "logs")
tensorboard_callback = tf.keras.callbacks.TensorBoard(
log_dir=log_dir, histogram_freq=1
)
I deleted this part in trainers.py, since it could not log out the path in the log_dir
P/s: envs: I ran both kubeflow and zenml in the Docker Destop debug test: I created a pod in kubernetes to connect to zenml server serve at localhost port 8238, but it seems like there is no connection betweem them. I think the error occurs because it could not create a connection between kubernetes and the zenml server in Docker Desktop.
Hey @ngohoanganh96 I think the connectivity problem is coming from the fact that you are trying to run zenml from docker, Both ZenML and the Kubeflow will be deployed within isolated environments within docker, so unless there is some extra configuration to allow connectivity between the 2 running containers. The easiest way to fix this is to use a local version of zenml rather than docker, when you do the local recipe will mount the Kubernetes container to the path where zenml files are stored and will be accessible directly
Hey @ngohoanganh96 I think the connectivity problem is coming from the fact that you are trying to run zenml from docker, Both ZenML and the Kubeflow will be deployed within isolated environments within docker, so unless there is some extra configuration to allow connectivity between the 2 running containers. The easiest way to fix this is to use a local version of zenml rather than docker, when you do the local recipe will mount the Kubernetes container to the path where zenml files are stored and will be accessible directly
Dear @safoinme, In the first time I set up the environment, it was able to run normally so I assumed kubernetes (running kubelow orchestrator) was able to make connection with zenml server normally. It only after i restart my computer (or restart the docker desktop), and run again, it appeared error as above. There something happened after the computer (or docker desktop) restart that make the kubenetes pod unable to connect to zenml server. I also create a docker deskop container and connect it to zenml server. It ran totally fine. The error only appear when I try to connect to zenml from the kubernetes pod ( which I assumed zenml execute it in the initiation of zeml step's pod when run a pipeline). If you have any information about this error, I will be very much appreciated. I will also try with the local zenml and give you the feedback. Thank you.
Update trying with local zenml: I have disconnected zenml server, and run kubernetes (running kubelow orchestrator) with local zenml, but it shows below error. I do not know understand why the deployment did not work with created ID, since the ID for deployment is generated automatically.
ERROR:
time="2023-08-22T01:27:38.421Z" level=info msg="capturing logs" argo=true
[1;35mCreating default workspace 'default' ...[0m
[1;35mCreating default user 'default' ...[0m
[1;35mCreating default stack for user 'default' in workspace default...[0m
[33mThe current global active stack is no longer available. Resetting the active stack to default.[0m
[33mThe current repo active workspace is no longer available. Resetting the active workspace to 'default'.[0m
[33mThe current repo active stack is no longer available. Resetting the active stack to default.[0m
[33mThe current global active stack is no longer available. Resetting the active stack to default.[0m
[1;35mReloading configuration file /app/.zen/config.yaml[0m
โญโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโฎ
โ /usr/local/lib/python3.10/runpy.py:196 in _run_module_as_main โ
โ โ
โ 193 โ main_globals = sys.modules["main"].dict โ
โ 194 โ if alter_argv: โ
โ 195 โ โ sys.argv[0] = mod_spec.origin โ
โ โฑ 196 โ return _run_code(code, main_globals, None, โ
โ 197 โ โ โ โ โ "main", mod_spec) โ
โ 198 โ
โ 199 def run_module(mod_name, init_globals=None, โ
โ โ
โ /usr/local/lib/python3.10/runpy.py:86 in _run_code โ
โ โ
โ 83 โ โ โ โ โ loader = loader, โ
โ 84 โ โ โ โ โ package = pkg_name, โ
โ 85 โ โ โ โ โ spec = mod_spec) โ
โ โฑ 86 โ exec(code, run_globals) โ
โ 87 โ return run_globals โ
โ 88 โ
โ 89 def _run_module_code(code, init_globals=None, โ
โ โ
โ /usr/local/lib/python3.10/site-packages/zenml/entrypoints/entrypoint.py:58 โ
โ in
The problem here lies within the fact, that one zenml-server instance - deployed with the default settings- can accept up to 20 requests for the database connection. Depending on what exactly you are running, this gets exceeded and therefore kubeflow cannot "reconnect" to zenml to pass through all data. You can simply increased the replicas of zenml server instances or work with the environment variables: zenml.environment.ZENML_STORE_POOL_SIZE = xxx zenml.environment.ZENML_STORE_MAX_OVERFLOW = xxx defaults to 20/20
@ngohoanganh96 รดng ฦกi, tรดi cลฉng ฤang tรฌm hiแปu vแป zenml, รดng cรฒn tรฌm hiแปu vแป zenml nแปฏa khรดng?