dagster-k8s 0.24.5__py3-none-any.whl → 0.24.7__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.
- dagster_k8s/client.py +38 -18
- dagster_k8s/version.py +1 -1
- {dagster_k8s-0.24.5.dist-info → dagster_k8s-0.24.7.dist-info}/METADATA +2 -2
- {dagster_k8s-0.24.5.dist-info → dagster_k8s-0.24.7.dist-info}/RECORD +7 -7
- {dagster_k8s-0.24.5.dist-info → dagster_k8s-0.24.7.dist-info}/LICENSE +0 -0
- {dagster_k8s-0.24.5.dist-info → dagster_k8s-0.24.7.dist-info}/WHEEL +0 -0
- {dagster_k8s-0.24.5.dist-info → dagster_k8s-0.24.7.dist-info}/top_level.txt +0 -0
dagster_k8s/client.py
CHANGED
|
@@ -525,21 +525,25 @@ class DagsterKubernetesClient:
|
|
|
525
525
|
|
|
526
526
|
def wait_for_pod(
|
|
527
527
|
self,
|
|
528
|
-
pod_name,
|
|
529
|
-
namespace,
|
|
530
|
-
wait_for_state=WaitForPodState.Ready,
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
528
|
+
pod_name: str,
|
|
529
|
+
namespace: str,
|
|
530
|
+
wait_for_state: WaitForPodState = WaitForPodState.Ready,
|
|
531
|
+
pod_launch_timeout: float = DEFAULT_WAIT_TIMEOUT,
|
|
532
|
+
wait_timeout: float = DEFAULT_WAIT_TIMEOUT,
|
|
533
|
+
wait_time_between_attempts: float = DEFAULT_WAIT_BETWEEN_ATTEMPTS,
|
|
534
|
+
start_time: Any = None,
|
|
534
535
|
ignore_containers: Optional[Set] = None,
|
|
535
|
-
):
|
|
536
|
+
) -> None:
|
|
536
537
|
"""Wait for a pod to launch and be running, or wait for termination (useful for job pods).
|
|
537
538
|
|
|
538
539
|
Args:
|
|
540
|
+
----
|
|
539
541
|
pod_name (str): Name of the pod to wait for.
|
|
540
542
|
namespace (str): Namespace in which the pod is located.
|
|
541
543
|
wait_for_state (WaitForPodState, optional): Whether to wait for pod readiness or
|
|
542
544
|
termination. Defaults to waiting for readiness.
|
|
545
|
+
pod_launch_timeout (numeric, optional): Timeout after which to give up and raise exception
|
|
546
|
+
if the pod never appears. Defaults to DEFAULT_WAIT_TIMEOUT. Set to 0 to disable.
|
|
543
547
|
wait_timeout (numeric, optional): Timeout after which to give up and raise exception.
|
|
544
548
|
Defaults to DEFAULT_WAIT_TIMEOUT. Set to 0 to disable.
|
|
545
549
|
wait_time_between_attempts (numeric, optional): Wait time between polling attempts. Defaults
|
|
@@ -549,15 +553,18 @@ class DagsterKubernetesClient:
|
|
|
549
553
|
when waiting for the pod to be ready/terminate.
|
|
550
554
|
|
|
551
555
|
Raises:
|
|
556
|
+
------
|
|
552
557
|
DagsterK8sError: Raised when wait_timeout is exceeded or an error is encountered
|
|
558
|
+
|
|
553
559
|
"""
|
|
554
560
|
check.str_param(pod_name, "pod_name")
|
|
555
561
|
check.str_param(namespace, "namespace")
|
|
556
562
|
check.inst_param(wait_for_state, "wait_for_state", WaitForPodState)
|
|
557
563
|
check.numeric_param(wait_timeout, "wait_timeout")
|
|
564
|
+
check.numeric_param(pod_launch_timeout, "pod_launch_timeout")
|
|
558
565
|
check.numeric_param(wait_time_between_attempts, "wait_time_between_attempts")
|
|
559
566
|
|
|
560
|
-
self.logger('Waiting for pod "
|
|
567
|
+
self.logger(f'Waiting for pod "{pod_name}"')
|
|
561
568
|
|
|
562
569
|
start = start_time or self.timer()
|
|
563
570
|
|
|
@@ -568,17 +575,17 @@ class DagsterKubernetesClient:
|
|
|
568
575
|
|
|
569
576
|
while True:
|
|
570
577
|
pods = self.core_api.list_namespaced_pod(
|
|
571
|
-
namespace=namespace, field_selector="metadata.name
|
|
578
|
+
namespace=namespace, field_selector=f"metadata.name={pod_name}"
|
|
572
579
|
).items
|
|
573
580
|
pod = pods[0] if pods else None
|
|
574
581
|
|
|
575
|
-
if
|
|
582
|
+
if pod_launch_timeout and self.timer() - start > pod_launch_timeout:
|
|
576
583
|
raise DagsterK8sError(
|
|
577
|
-
"Timed out while waiting for pod to become ready with pod info:
|
|
584
|
+
f"Timed out while waiting for pod to become ready with pod info: {pod!s}"
|
|
578
585
|
)
|
|
579
586
|
|
|
580
587
|
if pod is None:
|
|
581
|
-
self.logger('Waiting for pod "
|
|
588
|
+
self.logger(f'Waiting for pod "{pod_name}" to launch...')
|
|
582
589
|
self.sleeper(wait_time_between_attempts)
|
|
583
590
|
continue
|
|
584
591
|
|
|
@@ -588,7 +595,20 @@ class DagsterKubernetesClient:
|
|
|
588
595
|
)
|
|
589
596
|
self.sleeper(wait_time_between_attempts)
|
|
590
597
|
continue
|
|
598
|
+
break
|
|
591
599
|
|
|
600
|
+
while True:
|
|
601
|
+
pods = self.core_api.list_namespaced_pod(
|
|
602
|
+
namespace=namespace, field_selector=f"metadata.name={pod_name}"
|
|
603
|
+
).items
|
|
604
|
+
pod = pods[0] if pods else None
|
|
605
|
+
if pod is None:
|
|
606
|
+
raise DagsterK8sError(f'Pod "{pod_name}" was unexpectedly killed')
|
|
607
|
+
|
|
608
|
+
if wait_timeout and self.timer() - start > wait_timeout:
|
|
609
|
+
raise DagsterK8sError(
|
|
610
|
+
f"Timed out while waiting for pod to get to status {wait_for_state.value} with pod info: {pod!s}"
|
|
611
|
+
)
|
|
592
612
|
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#containerstatus-v1-core
|
|
593
613
|
all_statuses = []
|
|
594
614
|
all_statuses.extend(pod.status.init_container_statuses or [])
|
|
@@ -614,11 +634,11 @@ class DagsterKubernetesClient:
|
|
|
614
634
|
# ready is boolean field of container status
|
|
615
635
|
ready = container_status.ready
|
|
616
636
|
if not ready:
|
|
617
|
-
self.logger('Waiting for pod "
|
|
637
|
+
self.logger(f'Waiting for pod "{pod_name}" to become ready...')
|
|
618
638
|
self.sleeper(wait_time_between_attempts)
|
|
619
639
|
continue
|
|
620
640
|
else:
|
|
621
|
-
self.logger('Pod "
|
|
641
|
+
self.logger(f'Pod "{pod_name}" is ready, done waiting')
|
|
622
642
|
break
|
|
623
643
|
else:
|
|
624
644
|
check.invariant(
|
|
@@ -630,13 +650,13 @@ class DagsterKubernetesClient:
|
|
|
630
650
|
elif state.waiting is not None:
|
|
631
651
|
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#containerstatewaiting-v1-core
|
|
632
652
|
if state.waiting.reason == KubernetesWaitingReasons.PodInitializing:
|
|
633
|
-
self.logger('Waiting for pod "
|
|
653
|
+
self.logger(f'Waiting for pod "{pod_name}" to initialize...')
|
|
634
654
|
self.sleeper(wait_time_between_attempts)
|
|
635
655
|
continue
|
|
636
656
|
if state.waiting.reason == KubernetesWaitingReasons.CreateContainerConfigError:
|
|
637
657
|
self.logger(
|
|
638
|
-
'Pod "
|
|
639
|
-
" - trying again to see if it recovers"
|
|
658
|
+
f'Pod "{pod_name}" is waiting due to a CreateContainerConfigError with message "{state.waiting.message}"'
|
|
659
|
+
" - trying again to see if it recovers"
|
|
640
660
|
)
|
|
641
661
|
self.sleeper(wait_time_between_attempts)
|
|
642
662
|
continue
|
|
@@ -662,7 +682,7 @@ class DagsterKubernetesClient:
|
|
|
662
682
|
f' Message="{state.waiting.message}"\n{debug_info}'
|
|
663
683
|
)
|
|
664
684
|
else:
|
|
665
|
-
raise DagsterK8sError("Unknown issue:
|
|
685
|
+
raise DagsterK8sError(f"Unknown issue: {state.waiting}")
|
|
666
686
|
|
|
667
687
|
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#containerstateterminated-v1-core
|
|
668
688
|
elif state.terminated is not None:
|
dagster_k8s/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.24.
|
|
1
|
+
__version__ = "0.24.7"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dagster-k8s
|
|
3
|
-
Version: 0.24.
|
|
3
|
+
Version: 0.24.7
|
|
4
4
|
Summary: A Dagster integration for k8s
|
|
5
5
|
Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-k8s
|
|
6
6
|
Author: Dagster Labs
|
|
@@ -15,7 +15,7 @@ Classifier: License :: OSI Approved :: Apache Software License
|
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
16
16
|
Requires-Python: >=3.8,<3.13
|
|
17
17
|
License-File: LICENSE
|
|
18
|
-
Requires-Dist: dagster ==1.8.
|
|
18
|
+
Requires-Dist: dagster ==1.8.7
|
|
19
19
|
Requires-Dist: kubernetes
|
|
20
20
|
Requires-Dist: google-auth !=2.23.1
|
|
21
21
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
dagster_k8s/__init__.py,sha256=7LyrMxxhXKdGQYClq7OJwMiVJW0KYPP-8lTDrWLwyzU,750
|
|
2
|
-
dagster_k8s/client.py,sha256=
|
|
2
|
+
dagster_k8s/client.py,sha256=0phSk90G6S52NEevHmpSUumL3_bGIp5UF20N_l_amZY,37324
|
|
3
3
|
dagster_k8s/container_context.py,sha256=gyFS0FgdupEUHIIsfYzS-TKHzXOd2mx-yX7onw2XuiY,21353
|
|
4
4
|
dagster_k8s/executor.py,sha256=IZMWEtzXXd37INbU4gxkMU46cX4qoZw4MdgszxngZuQ,13934
|
|
5
5
|
dagster_k8s/job.py,sha256=2tCIYlGUIt3ZydbZ9WRyPgr7YWz8t_2vaD20u7h5efw,41512
|
|
@@ -9,11 +9,11 @@ dagster_k8s/pipes.py,sha256=lsf657zbvxAH71zjEOIc-Oxo2oRvN-mp2XBjbahPUyU,17195
|
|
|
9
9
|
dagster_k8s/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
10
10
|
dagster_k8s/test.py,sha256=cNtcbzxytiZtd01wY5ip7KPi01y0BUQuQhohoIfAFUM,684
|
|
11
11
|
dagster_k8s/utils.py,sha256=c1bHqh5f1p5RZ0JCT6WEbPPjDvbgUp3pl4nYZRaaI4s,786
|
|
12
|
-
dagster_k8s/version.py,sha256=
|
|
12
|
+
dagster_k8s/version.py,sha256=2ynJVRZcVbxnjaXuP8lTE1Ucy3DQK3byKnrGP4xsAJE,23
|
|
13
13
|
dagster_k8s/ops/__init__.py,sha256=ur-9GrE_DRfnsFCpYan03qOY9cWbjagC8KHZFZuiCmc,113
|
|
14
14
|
dagster_k8s/ops/k8s_job_op.py,sha256=cIrIn30Ew1MQDVJOf4A4LsERG60m64Vp9J4q90enebw,20533
|
|
15
|
-
dagster_k8s-0.24.
|
|
16
|
-
dagster_k8s-0.24.
|
|
17
|
-
dagster_k8s-0.24.
|
|
18
|
-
dagster_k8s-0.24.
|
|
19
|
-
dagster_k8s-0.24.
|
|
15
|
+
dagster_k8s-0.24.7.dist-info/LICENSE,sha256=TMatHW4_G9ldRdodEAp-l2Xa2WvsdeOh60E3v1R2jis,11349
|
|
16
|
+
dagster_k8s-0.24.7.dist-info/METADATA,sha256=rWxT5g9DDYVKwOLj9fdolH0P7Tezy0Bu74NO-Dw9kMo,778
|
|
17
|
+
dagster_k8s-0.24.7.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
18
|
+
dagster_k8s-0.24.7.dist-info/top_level.txt,sha256=wFPjskoWPlk2hOLugYCaoZhSiZdUcbCA1QZe9I4dals,12
|
|
19
|
+
dagster_k8s-0.24.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|