dagster-k8s 0.24.6__py3-none-any.whl → 0.24.8__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.
Potentially problematic release.
This version of dagster-k8s might be problematic. Click here for more details.
- dagster_k8s/client.py +51 -20
- dagster_k8s/version.py +1 -1
- {dagster_k8s-0.24.6.dist-info → dagster_k8s-0.24.8.dist-info}/METADATA +2 -2
- {dagster_k8s-0.24.6.dist-info → dagster_k8s-0.24.8.dist-info}/RECORD +7 -7
- {dagster_k8s-0.24.6.dist-info → dagster_k8s-0.24.8.dist-info}/LICENSE +0 -0
- {dagster_k8s-0.24.6.dist-info → dagster_k8s-0.24.8.dist-info}/WHEEL +0 -0
- {dagster_k8s-0.24.6.dist-info → dagster_k8s-0.24.8.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,36 +553,40 @@ 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
|
|
|
564
571
|
# A set of container names that have exited.
|
|
565
572
|
exited_containers = set()
|
|
573
|
+
ready_containers = set()
|
|
566
574
|
ignore_containers = ignore_containers or set()
|
|
567
575
|
error_logs = []
|
|
568
576
|
|
|
569
577
|
while True:
|
|
570
578
|
pods = self.core_api.list_namespaced_pod(
|
|
571
|
-
namespace=namespace, field_selector="metadata.name
|
|
579
|
+
namespace=namespace, field_selector=f"metadata.name={pod_name}"
|
|
572
580
|
).items
|
|
573
581
|
pod = pods[0] if pods else None
|
|
574
582
|
|
|
575
|
-
if
|
|
583
|
+
if pod_launch_timeout and self.timer() - start > pod_launch_timeout:
|
|
576
584
|
raise DagsterK8sError(
|
|
577
|
-
"Timed out while waiting for pod to become ready with pod info:
|
|
585
|
+
f"Timed out while waiting for pod to become ready with pod info: {pod!s}"
|
|
578
586
|
)
|
|
579
587
|
|
|
580
588
|
if pod is None:
|
|
581
|
-
self.logger('Waiting for pod "
|
|
589
|
+
self.logger(f'Waiting for pod "{pod_name}" to launch...')
|
|
582
590
|
self.sleeper(wait_time_between_attempts)
|
|
583
591
|
continue
|
|
584
592
|
|
|
@@ -588,11 +596,25 @@ class DagsterKubernetesClient:
|
|
|
588
596
|
)
|
|
589
597
|
self.sleeper(wait_time_between_attempts)
|
|
590
598
|
continue
|
|
599
|
+
break
|
|
591
600
|
|
|
601
|
+
while True:
|
|
602
|
+
pods = self.core_api.list_namespaced_pod(
|
|
603
|
+
namespace=namespace, field_selector=f"metadata.name={pod_name}"
|
|
604
|
+
).items
|
|
605
|
+
pod = pods[0] if pods else None
|
|
606
|
+
if pod is None:
|
|
607
|
+
raise DagsterK8sError(f'Pod "{pod_name}" was unexpectedly killed')
|
|
608
|
+
|
|
609
|
+
if wait_timeout and self.timer() - start > wait_timeout:
|
|
610
|
+
raise DagsterK8sError(
|
|
611
|
+
f"Timed out while waiting for pod to get to status {wait_for_state.value} with pod info: {pod!s}"
|
|
612
|
+
)
|
|
592
613
|
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#containerstatus-v1-core
|
|
593
614
|
all_statuses = []
|
|
594
615
|
all_statuses.extend(pod.status.init_container_statuses or [])
|
|
595
616
|
all_statuses.extend(pod.status.container_statuses or [])
|
|
617
|
+
initcontainers = set(s.name for s in (pod.status.init_container_statuses or []))
|
|
596
618
|
|
|
597
619
|
# Filter out ignored containers
|
|
598
620
|
all_statuses = [s for s in all_statuses if s.name not in ignore_containers]
|
|
@@ -603,7 +625,9 @@ class DagsterKubernetesClient:
|
|
|
603
625
|
#
|
|
604
626
|
# In case we are waiting for the pod to be ready, we will exit after
|
|
605
627
|
# the first container in this list is ready.
|
|
606
|
-
container_status = next(
|
|
628
|
+
container_status = next(
|
|
629
|
+
s for s in all_statuses if s.name not in exited_containers | ready_containers
|
|
630
|
+
)
|
|
607
631
|
|
|
608
632
|
# State checks below, see:
|
|
609
633
|
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#containerstate-v1-core
|
|
@@ -614,12 +638,15 @@ class DagsterKubernetesClient:
|
|
|
614
638
|
# ready is boolean field of container status
|
|
615
639
|
ready = container_status.ready
|
|
616
640
|
if not ready:
|
|
617
|
-
self.logger('Waiting for pod "
|
|
641
|
+
self.logger(f'Waiting for pod "{pod_name}" to become ready...')
|
|
618
642
|
self.sleeper(wait_time_between_attempts)
|
|
619
643
|
continue
|
|
620
644
|
else:
|
|
621
|
-
|
|
622
|
-
|
|
645
|
+
ready_containers.add(container_status.name)
|
|
646
|
+
if initcontainers.issubset(exited_containers | ready_containers):
|
|
647
|
+
self.logger(f'Pod "{pod_name}" is ready, done waiting')
|
|
648
|
+
break
|
|
649
|
+
|
|
623
650
|
else:
|
|
624
651
|
check.invariant(
|
|
625
652
|
wait_for_state == WaitForPodState.Terminated, "New invalid WaitForPodState"
|
|
@@ -630,13 +657,13 @@ class DagsterKubernetesClient:
|
|
|
630
657
|
elif state.waiting is not None:
|
|
631
658
|
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#containerstatewaiting-v1-core
|
|
632
659
|
if state.waiting.reason == KubernetesWaitingReasons.PodInitializing:
|
|
633
|
-
self.logger('Waiting for pod "
|
|
660
|
+
self.logger(f'Waiting for pod "{pod_name}" to initialize...')
|
|
634
661
|
self.sleeper(wait_time_between_attempts)
|
|
635
662
|
continue
|
|
636
663
|
if state.waiting.reason == KubernetesWaitingReasons.CreateContainerConfigError:
|
|
637
664
|
self.logger(
|
|
638
|
-
'Pod "
|
|
639
|
-
" - trying again to see if it recovers"
|
|
665
|
+
f'Pod "{pod_name}" is waiting due to a CreateContainerConfigError with message "{state.waiting.message}"'
|
|
666
|
+
" - trying again to see if it recovers"
|
|
640
667
|
)
|
|
641
668
|
self.sleeper(wait_time_between_attempts)
|
|
642
669
|
continue
|
|
@@ -662,7 +689,7 @@ class DagsterKubernetesClient:
|
|
|
662
689
|
f' Message="{state.waiting.message}"\n{debug_info}'
|
|
663
690
|
)
|
|
664
691
|
else:
|
|
665
|
-
raise DagsterK8sError("Unknown issue:
|
|
692
|
+
raise DagsterK8sError(f"Unknown issue: {state.waiting}")
|
|
666
693
|
|
|
667
694
|
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#containerstateterminated-v1-core
|
|
668
695
|
elif state.terminated is not None:
|
|
@@ -679,6 +706,10 @@ class DagsterKubernetesClient:
|
|
|
679
706
|
|
|
680
707
|
self.logger(msg)
|
|
681
708
|
error_logs.append(msg)
|
|
709
|
+
elif container_name in initcontainers:
|
|
710
|
+
self.logger(
|
|
711
|
+
f"Init container {container_name} in {pod_name} has exited successfully"
|
|
712
|
+
)
|
|
682
713
|
else:
|
|
683
714
|
self.logger(f"Container {container_name} in {pod_name} has exited successfully")
|
|
684
715
|
|
dagster_k8s/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.24.
|
|
1
|
+
__version__ = "0.24.8"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: dagster-k8s
|
|
3
|
-
Version: 0.24.
|
|
3
|
+
Version: 0.24.8
|
|
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.8
|
|
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=9stIMp196v-vaVct8kBFp5pveo0lAup78y9Gi7g9VMM,37873
|
|
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=O9QkGk46Yh2lp8IBRcbEaStijlXe7yZyxRbauvT7w1Q,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.8.dist-info/LICENSE,sha256=TMatHW4_G9ldRdodEAp-l2Xa2WvsdeOh60E3v1R2jis,11349
|
|
16
|
+
dagster_k8s-0.24.8.dist-info/METADATA,sha256=WcRObvjp4C5A7TJSHS4ovVTp-q9Hjo0IQO_mGM0evIA,778
|
|
17
|
+
dagster_k8s-0.24.8.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
18
|
+
dagster_k8s-0.24.8.dist-info/top_level.txt,sha256=wFPjskoWPlk2hOLugYCaoZhSiZdUcbCA1QZe9I4dals,12
|
|
19
|
+
dagster_k8s-0.24.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|