File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 22
33python create_env_file.py
44sudo docker compose -f save-and-restore.yml up -d
5+ python wait_for_startup.py
56
67# Wait until the service is started.
7- sleep 30
8+ # sleep 30
Original file line number Diff line number Diff line change 1+ import time
2+
3+ import httpx
4+
5+ t_wait = 30
6+ BASE_URL = "http://localhost:8080/save-restore"
7+ root_node_uid = "44bef5de-e8e6-4014-af37-b8f6c8a939a2"
8+
9+ if __name__ == "__main__" :
10+ t_start = time .time ()
11+ with httpx .Client (base_url = BASE_URL , timeout = 1 ) as client :
12+ url = f"/node/{ root_node_uid } "
13+ while time .time () - t_start < t_wait :
14+ try :
15+ response = client .request ("GET" , url )
16+ if response .status_code == 200 :
17+ print ("Success: save-and-restore server is up" )
18+ exit (0 )
19+ except (httpx .ConnectError , httpx .ReadError ):
20+ pass
21+
22+ print (f"TIMEOUT: save-and-restore server failed to start in { t_wait } seconds" )
23+ exit (1 )
You can’t perform that action at this time.
0 commit comments