Skip to content

Commit de52dab

Browse files
committed
catch log streaming errors and carry on
1 parent 65e2bc5 commit de52dab

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

chipflow_lib/steps/silicon.py

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,19 +209,23 @@ def submit(self, rtlil_path, *, dry_run=False, wait=False):
209209
# Wait before polling again
210210
# time.sleep(10)
211211
# Attempt to stream logs rather than time.sleep
212-
with requests.get(
213-
log_stream_url,
214-
auth=(os.environ["CHIPFLOW_API_KEY_ID"], os.environ["CHIPFLOW_API_KEY_SECRET"]),
215-
stream=True
216-
) as log_resp:
217-
if log_resp.status_code == 200:
218-
for line in log_resp.iter_lines():
219-
if line:
220-
print(line.decode("utf-8")) # Print logs in real-time
221-
sys.stdout.flush()
222-
else:
223-
logger.warning(f"Failed to stream logs: {log_resp.text}")
224-
time.sleep(10) # Wait before polling again
212+
try:
213+
with requests.get(
214+
log_stream_url,
215+
auth=(os.environ["CHIPFLOW_API_KEY_ID"], os.environ["CHIPFLOW_API_KEY_SECRET"]),
216+
stream=True
217+
) as log_resp:
218+
if log_resp.status_code == 200:
219+
for line in log_resp.iter_lines():
220+
if line:
221+
print(line.decode("utf-8")) # Print logs in real-time
222+
sys.stdout.flush()
223+
else:
224+
logger.warning(f"Failed to stream logs: {log_resp.text}")
225+
time.sleep(10) # Wait before polling again
226+
except requests.RequestException as e:
227+
logger.error(f"Error while streaming logs: {e}")
228+
pass
225229

226230
else:
227231
# Log detailed information about the failed request

0 commit comments

Comments
 (0)