ccluster-py 0.1.1.dev180__py3-none-any.whl → 0.1.1.dev182__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ccluster/cli.py CHANGED
@@ -30,6 +30,8 @@ from kubernetes import client as k8s
30
30
  from kubernetes import config as k8s_config
31
31
  from kubernetes.dynamic import DynamicClient
32
32
  from kubernetes.dynamic.exceptions import ResourceNotFoundError
33
+ from urllib3.exceptions import MaxRetryError
34
+ from urllib3.util import Url
33
35
 
34
36
  from ccluster.client import CCLClient
35
37
  from ccluster.v1alpha1 import API_VERSION, CCLInfraPlane, Kind
@@ -239,13 +241,25 @@ def _save_control_plane(context: str) -> Path:
239
241
 
240
242
  @contextlib.contextmanager
241
243
  def _kube_errors() -> Iterator[None]:
242
- """Turn kubeconfig and API errors into one-line click errors."""
244
+ """Turn Kubernetes configuration, API and connection errors into one-line Click errors."""
243
245
  try:
244
246
  yield
245
247
  except k8s_config.ConfigException as e:
246
248
  raise click.ClickException(f"Kubeconfig could not be loaded: {e}") from e
247
249
  except k8s.ApiException as e:
248
250
  raise click.ClickException(_api_error(e)) from e
251
+ except MaxRetryError as e:
252
+ message = "Kubernetes API request failed"
253
+ if e.pool is not None:
254
+ host = e.pool.host
255
+ if ":" in host:
256
+ host = f"[{host}]"
257
+ server = Url(scheme=e.pool.scheme, host=host, port=e.pool.port)
258
+ message += f" at {server.url}"
259
+ if e.reason is not None:
260
+ reason = " ".join(str(e.reason).splitlines())
261
+ message += f": {reason}"
262
+ raise click.ClickException(message) from e
249
263
 
250
264
 
251
265
  def _cluster_admin_token(api_client: k8s.ApiClient) -> tuple[str, bytes]:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ccluster-py
3
- Version: 0.1.1.dev180
3
+ Version: 0.1.1.dev182
4
4
  Summary: Pydantic models and a client for the ccluster.nvidia.com API and its Helm chart catalog
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -14,6 +14,7 @@ Requires-Dist: click>=8.1
14
14
  Requires-Dist: kubernetes>=30
15
15
  Requires-Dist: pydantic>=2.11
16
16
  Requires-Dist: pyyaml>=6
17
+ Requires-Dist: urllib3
17
18
  Requires-Python: >=3.10
18
19
  Project-URL: Homepage, https://github.com/NVIDIA/ccluster
19
20
  Project-URL: Source, https://github.com/NVIDIA/ccluster/tree/main/python
@@ -22,7 +22,7 @@ ccluster/catalogs/deployments/job_deployment/__init__.py,sha256=nXTXBgtT1p-9CAxA
22
22
  ccluster/catalogs/namespace_base/__init__.py,sha256=dqsMhNQFbOrZjk37WHe1B0wO4dz6DB-fSIUiratrsKI,607
23
23
  ccluster/catalogs/resources/kai_gpu_queues/__init__.py,sha256=QqmHsSTG0UOtpBVTG_u7jo5H7dcLN5AqyJLcdTs59bo,1550
24
24
  ccluster/catalogs/resources/persistent_volume/__init__.py,sha256=YywIJQUkrnvxoQ48x0lzNoNwOXg4OUheCXJLIqXxAXk,2399
25
- ccluster/cli.py,sha256=zDCvPFJnaZDj5qddJMvLw-vv2_lwD68nrFiqIi320GI,14921
25
+ ccluster/cli.py,sha256=bhd3xUl36oShJpeTJdFa_sNl9dyai7kHb0y8vjsimn8,15525
26
26
  ccluster/client.py,sha256=80UAxJqYCQD10fyl-KjyfIQmdXyvXY0JbPhEqqpQnu0,18176
27
27
  ccluster/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  ccluster/v1alpha1/__init__.py,sha256=YfkcUz-G5brF5yKmEUmAZQ3cQKqc6gpGVIj-353Q8zk,1858
@@ -30,8 +30,8 @@ ccluster/v1alpha1/base.py,sha256=3ekuGj-nc-zqzXQCif3F4DEigl4pYsX_Cycw2HCSzuw,232
30
30
  ccluster/v1alpha1/cclclusterconfig.py,sha256=PBjynS17IUxgnsmBu7bwrG9k5qyBvwFoEXk_0azu774,6247
31
31
  ccluster/v1alpha1/cclcomponentset.py,sha256=AWKvUSE87R89BOqcr03SI5x0HAgjT-PVvARCnBMoSpY,11117
32
32
  ccluster/v1alpha1/cclinfraplane.py,sha256=uiKFG0Q3B1WmGE869dgbbfZ5UaU91-lQVw7NjEKN4dk,10760
33
- ccluster_py-0.1.1.dev180.dist-info/licenses/LICENSE,sha256=0HwDZ-KGHn_nD6G2efh59PovkTit5EV9ROz4suE1u0U,11431
34
- ccluster_py-0.1.1.dev180.dist-info/WHEEL,sha256=G_-rrEibZr7OEM7zdH1dSO6s-VdjfnS5PA4CLAdI9Vw,80
35
- ccluster_py-0.1.1.dev180.dist-info/entry_points.txt,sha256=rhnbwnwVzgL1u46koQI49_m-KlV6JebCtdGIDGiTvsY,48
36
- ccluster_py-0.1.1.dev180.dist-info/METADATA,sha256=L4ys0OHjK3PGpCq33NNzToblWOYEFm0h3k4FTrQNDdU,16538
37
- ccluster_py-0.1.1.dev180.dist-info/RECORD,,
33
+ ccluster_py-0.1.1.dev182.dist-info/licenses/LICENSE,sha256=0HwDZ-KGHn_nD6G2efh59PovkTit5EV9ROz4suE1u0U,11431
34
+ ccluster_py-0.1.1.dev182.dist-info/WHEEL,sha256=G_-rrEibZr7OEM7zdH1dSO6s-VdjfnS5PA4CLAdI9Vw,80
35
+ ccluster_py-0.1.1.dev182.dist-info/entry_points.txt,sha256=rhnbwnwVzgL1u46koQI49_m-KlV6JebCtdGIDGiTvsY,48
36
+ ccluster_py-0.1.1.dev182.dist-info/METADATA,sha256=SCPRkkzODpFl0bkg7FWIgzp-YDEs4bmicEkwnIdjUUY,16561
37
+ ccluster_py-0.1.1.dev182.dist-info/RECORD,,