File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,19 @@ def get_mission(mission: str) -> list[V1PodList]:
36
36
return crew
37
37
38
38
39
+ def get_pod_exit_status (pod_name ):
40
+ try :
41
+ sclient = get_static_client ()
42
+ pod = sclient .read_namespaced_pod (name = pod_name , namespace = get_default_namespace ())
43
+ for container_status in pod .status .container_statuses :
44
+ if container_status .state .terminated :
45
+ return container_status .state .terminated .exit_code
46
+ return None
47
+ except client .ApiException as e :
48
+ print (f"Exception when calling CoreV1Api->read_namespaced_pod: { e } " )
49
+ return None
50
+
51
+
39
52
def get_edges () -> any :
40
53
sclient = get_static_client ()
41
54
configmap = sclient .read_namespaced_config_map (name = "edges" , namespace = "warnet" )
Original file line number Diff line number Diff line change 12
12
13
13
from warnet import SRC_DIR
14
14
from warnet .control import get_active_scenarios
15
+ from warnet .k8s import get_pod_exit_status
15
16
from warnet .network import _connected as network_connected
16
17
from warnet .network import _status as network_status
17
18
@@ -132,7 +133,12 @@ def check_scenarios():
132
133
scns = get_active_scenarios ()
133
134
if len (scns ) == 0 :
134
135
return True
135
- return all (s ["status" ] == "succeeded" for s in scns )
136
+ for s in scns :
137
+ exit_status = get_pod_exit_status (s )
138
+ self .log .debug (f"Scenario { s } exited with code { exit_status } " )
139
+ if exit_status != 0 :
140
+ return False
141
+ return True
136
142
137
143
self .wait_for_predicate (check_scenarios )
138
144
You can’t perform that action at this time.
0 commit comments