Skip to content

Commit 2ff7351

Browse files
committed
Added pod yaml print statements
1 parent 232ecfe commit 2ff7351

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed

tests/e2e/local_interactive_sdk_kind_test.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from time import sleep
1212

1313
from support import *
14+
import yaml
1415

1516

1617
@pytest.mark.kind
@@ -91,7 +92,29 @@ def run_local_interactives(self):
9192
print(
9293
f"Exception when calling CustomObjectsApi->list_namespaced_custom_object: {e}"
9394
)
94-
95+
print("------------- PODS ----------------")
96+
try:
97+
pods = v1.list_namespaced_pod(self.namespace)
98+
except client.exceptions.ApiException as e:
99+
print(f"Exception when calling CoreV1Api->list_namespaced_pod: {e}")
100+
exit(1)
101+
102+
# Loop through the list of pods and print the YAML of those that start with 'test-name-head'
103+
for pod in pods.items:
104+
pod_name = pod.metadata.name
105+
if pod_name.startswith("test-ray-cluster-li"):
106+
print(f"YAML configuration for pod: {pod_name}")
107+
try:
108+
pod_detail = v1.read_namespaced_pod(
109+
name=pod_name, namespace=self.namespace
110+
)
111+
pod_dict = pod_detail.to_dict()
112+
print("---------------------------------")
113+
print(yaml.dump(pod_dict, default_flow_style=False))
114+
except client.exceptions.ApiException as e:
115+
print(
116+
f"Exception when calling CoreV1Api->read_namespaced_pod for pod {pod_name}: {e}"
117+
)
95118
cluster.wait_ready()
96119

97120
generate_cert.generate_tls_cert(cluster_name, self.namespace)

tests/e2e/mnist_raycluster_sdk_aw_kind_test.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from time import sleep
1212

1313
# This test creates an AppWrapper containing a Ray Cluster and covers the Ray Job submission functionality on Kind Cluster
14+
import yaml
1415

1516

1617
@pytest.mark.kind
@@ -90,6 +91,29 @@ def run_mnist_raycluster_sdk_kind(self):
9091
print(
9192
f"Exception when calling CustomObjectsApi->list_namespaced_custom_object: {e}"
9293
)
94+
print("------------- PODS ----------------")
95+
try:
96+
pods = v1.list_namespaced_pod(self.namespace)
97+
except client.exceptions.ApiException as e:
98+
print(f"Exception when calling CoreV1Api->list_namespaced_pod: {e}")
99+
exit(1)
100+
101+
# Loop through the list of pods and print the YAML of those that start with 'test-name-head'
102+
for pod in pods.items:
103+
pod_name = pod.metadata.name
104+
if pod_name.startswith("mnist"):
105+
print(f"YAML configuration for pod: {pod_name}")
106+
try:
107+
pod_detail = v1.read_namespaced_pod(
108+
name=pod_name, namespace=self.namespace
109+
)
110+
pod_dict = pod_detail.to_dict()
111+
print("---------------------------------")
112+
print(yaml.dump(pod_dict, default_flow_style=False))
113+
except client.exceptions.ApiException as e:
114+
print(
115+
f"Exception when calling CoreV1Api->read_namespaced_pod for pod {pod_name}: {e}"
116+
)
93117
cluster.status()
94118

95119
cluster.wait_ready()

tests/e2e/mnist_raycluster_sdk_kind_test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
# This test creates a Ray Cluster and covers the Ray Job submission functionality on Kind Cluster
1414

15+
import yaml
16+
1517

1618
@pytest.mark.kind
1719
class TestRayClusterSDKKind:
@@ -90,6 +92,29 @@ def run_mnist_raycluster_sdk_kind(self):
9092
print(
9193
f"Exception when calling CustomObjectsApi->list_namespaced_custom_object: {e}"
9294
)
95+
print("------------- PODS ----------------")
96+
try:
97+
pods = v1.list_namespaced_pod(self.namespace)
98+
except client.exceptions.ApiException as e:
99+
print(f"Exception when calling CoreV1Api->list_namespaced_pod: {e}")
100+
exit(1)
101+
102+
# Loop through the list of pods and print the YAML of those that start with 'test-name-head'
103+
for pod in pods.items:
104+
pod_name = pod.metadata.name
105+
if pod_name.startswith("mnist"):
106+
print(f"YAML configuration for pod: {pod_name}")
107+
try:
108+
pod_detail = v1.read_namespaced_pod(
109+
name=pod_name, namespace=self.namespace
110+
)
111+
pod_dict = pod_detail.to_dict()
112+
print("---------------------------------")
113+
print(yaml.dump(pod_dict, default_flow_style=False))
114+
except client.exceptions.ApiException as e:
115+
print(
116+
f"Exception when calling CoreV1Api->read_namespaced_pod for pod {pod_name}: {e}"
117+
)
93118
cluster.status()
94119

95120
cluster.wait_ready()

0 commit comments

Comments
 (0)