@@ -44,8 +44,18 @@ def get_run_mode(camel_mode, check_port):
4444def _wait_for_ready_integration (mode , integration ):
4545 server_address = mode .server_address (integration )
4646 health_check_address = f"{ server_address } /q/health"
47+
48+ healthy_integration = False
49+ max_retries = 100
4750 while True :
48- response = requests .get (health_check_address , timeout = (5 , None ))
51+ try :
52+ response = requests .get (health_check_address , timeout = (5 , 5 ))
53+ except requests .exceptions .ConnectionError :
54+ time .sleep (1 )
55+ max_retries -= 1
56+ if max_retries == 0 :
57+ break
58+ continue
4959 json_response = json .loads (response .content )
5060 all_routes_are_up = True
5161 for check in json_response ['checks' ]:
@@ -63,9 +73,12 @@ def _wait_for_ready_integration(mode, integration):
6373 route_index += 1
6474 route = f'route:route{ route_index } '
6575 if all_routes_are_up :
76+ healthy_integration = True
6677 break
6778 time .sleep (1 )
6879
80+ return healthy_integration
81+
6982
7083# Wait for an integration to reach its running state and not only that but
7184# also be in a state where it can immediately execute incoming requests.
@@ -84,9 +97,14 @@ def await_start(mode, integration):
8497 print ('Integration did not start correctly.' )
8598
8699 # Perform health check and wait for integration to be ready.
87- _wait_for_ready_integration (mode , integration )
100+ healthy_integration = _wait_for_ready_integration (mode , integration )
101+
102+ if healthy_integration :
103+ print (f'Integration { integration .integration_name } is healthy.' )
104+ return integration_is_running
88105
89- return integration_is_running
106+ print (f'Integration { integration .integration_name } is not healthy.' )
107+ return False
90108
91109
92110@ray .remote (num_cpus = 0 )
0 commit comments