File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change 3838# standard library
3939from datetime import datetime
4040import json
41+ import time
4142
4243# third party
4344import requests
7475}
7576
7677
77- def fetch_json (path , payload ):
78+ def fetch_json (path , payload , call_count = 1 ):
7879 """Send a request to the server and return the parsed JSON response."""
7980
8081 # it's polite to self-identify this "bot"
@@ -102,7 +103,13 @@ def fetch_json(path, payload):
102103 resp = method (flusurv_url , headers = headers , data = data )
103104
104105 # check the HTTP status code
105- if resp .status_code != 200 :
106+ if resp .status_code == 500 and call_count <= 2 :
107+ # the server often fails with this status, so wait and retry
108+ delay = 10 * call_count
109+ print ('got status %d, will retry in %d sec...' % (resp .status_code , delay ))
110+ time .sleep (delay )
111+ return fetch_json (path , payload , call_count = call_count + 1 )
112+ elif resp .status_code != 200 :
106113 raise Exception (['status code != 200' , resp .status_code ])
107114
108115 # check response mine type
Original file line number Diff line number Diff line change @@ -291,7 +291,6 @@ def get_fusion_parameters(known_locations):
291291 H = graph [is_known , :]
292292 W = graph [is_unknown , :]
293293 if np .linalg .matrix_rank (H ) != len (atoms ):
294- print (np .linalg .matrix_rank (H ))
295294 raise Exception ('system is underdetermined' )
296295
297296 HtH = np .dot (H .T , H )
You can’t perform that action at this time.
0 commit comments