diff --git a/.github/workflows/studio-inference-smoke.yml b/.github/workflows/studio-inference-smoke.yml index ce0c6f6ba4..ce4bf46425 100644 --- a/.github/workflows/studio-inference-smoke.yml +++ b/.github/workflows/studio-inference-smoke.yml @@ -467,15 +467,18 @@ jobs: }, ) # Shared CI runners stall sporadically, so retry transport-level - # failures only; HTTP status errors surface immediately. - for attempt in range(3): + # failures only; HTTP status errors surface immediately. Long + # probes (timeout > 300s) get a single attempt so the worst + # case stays inside the job's timeout-minutes budget. + attempts = 3 if timeout <= 300 else 1 + for attempt in range(attempts): try: with urllib.request.urlopen(req, timeout = timeout) as resp: return resp.status, json.loads(resp.read().decode()) except urllib.error.HTTPError: raise except (TimeoutError, ConnectionError, urllib.error.URLError) as exc: - if attempt == 2: + if attempt == attempts - 1: raise print(f"[retry] {path}: {exc!r}", flush = True) time.sleep(15) @@ -972,15 +975,18 @@ jobs: }, ) # Shared CI runners stall sporadically, so retry transport-level - # failures only; HTTP status errors surface immediately. - for attempt in range(3): + # failures only; HTTP status errors surface immediately. Long + # probes (timeout > 300s) get a single attempt so the worst + # case stays inside the job's timeout-minutes budget. + attempts = 3 if timeout <= 300 else 1 + for attempt in range(attempts): try: with urllib.request.urlopen(req, timeout = timeout) as resp: return resp.status, json.loads(resp.read().decode()) except urllib.error.HTTPError: raise except (TimeoutError, ConnectionError, urllib.error.URLError) as exc: - if attempt == 2: + if attempt == attempts - 1: raise print(f"[retry] {path}: {exc!r}", flush = True) time.sleep(15) diff --git a/.github/workflows/studio-mac-inference-smoke.yml b/.github/workflows/studio-mac-inference-smoke.yml index d9d98e3a16..805817b518 100644 --- a/.github/workflows/studio-mac-inference-smoke.yml +++ b/.github/workflows/studio-mac-inference-smoke.yml @@ -453,15 +453,18 @@ jobs: }, ) # Shared CI runners stall sporadically, so retry transport-level - # failures only; HTTP status errors surface immediately. - for attempt in range(3): + # failures only; HTTP status errors surface immediately. Long + # probes (timeout > 300s) get a single attempt so the worst + # case stays inside the job's timeout-minutes budget. + attempts = 3 if timeout <= 300 else 1 + for attempt in range(attempts): try: with urllib.request.urlopen(req, timeout = timeout) as resp: return resp.status, json.loads(resp.read().decode()) except urllib.error.HTTPError: raise except (TimeoutError, ConnectionError, urllib.error.URLError) as exc: - if attempt == 2: + if attempt == attempts - 1: raise print(f"[retry] {path}: {exc!r}", flush = True) time.sleep(15) @@ -864,15 +867,18 @@ jobs: }, ) # Shared CI runners stall sporadically, so retry transport-level - # failures only; HTTP status errors surface immediately. - for attempt in range(3): + # failures only; HTTP status errors surface immediately. Long + # probes (timeout > 300s) get a single attempt so the worst + # case stays inside the job's timeout-minutes budget. + attempts = 3 if timeout <= 300 else 1 + for attempt in range(attempts): try: with urllib.request.urlopen(req, timeout = timeout) as resp: return resp.status, json.loads(resp.read().decode()) except urllib.error.HTTPError: raise except (TimeoutError, ConnectionError, urllib.error.URLError) as exc: - if attempt == 2: + if attempt == attempts - 1: raise print(f"[retry] {path}: {exc!r}", flush = True) time.sleep(15) diff --git a/.github/workflows/studio-windows-inference-smoke.yml b/.github/workflows/studio-windows-inference-smoke.yml index 00cf9adcf1..740cde15fb 100644 --- a/.github/workflows/studio-windows-inference-smoke.yml +++ b/.github/workflows/studio-windows-inference-smoke.yml @@ -659,15 +659,18 @@ jobs: }, ) # Shared CI runners stall sporadically, so retry transport-level - # failures only; HTTP status errors surface immediately. - for attempt in range(3): + # failures only; HTTP status errors surface immediately. Long + # probes (timeout > 300s) get a single attempt so the worst + # case stays inside the job's timeout-minutes budget. + attempts = 3 if timeout <= 300 else 1 + for attempt in range(attempts): try: with urllib.request.urlopen(req, timeout = timeout) as resp: return resp.status, json.loads(resp.read().decode()) except urllib.error.HTTPError: raise except (TimeoutError, ConnectionError, urllib.error.URLError) as exc: - if attempt == 2: + if attempt == attempts - 1: raise print(f"[retry] {path}: {exc!r}", flush = True) time.sleep(15) @@ -1098,15 +1101,18 @@ jobs: }, ) # Shared CI runners stall sporadically, so retry transport-level - # failures only; HTTP status errors surface immediately. - for attempt in range(3): + # failures only; HTTP status errors surface immediately. Long + # probes (timeout > 300s) get a single attempt so the worst + # case stays inside the job's timeout-minutes budget. + attempts = 3 if timeout <= 300 else 1 + for attempt in range(attempts): try: with urllib.request.urlopen(req, timeout = timeout) as resp: return resp.status, json.loads(resp.read().decode()) except urllib.error.HTTPError: raise except (TimeoutError, ConnectionError, urllib.error.URLError) as exc: - if attempt == 2: + if attempt == attempts - 1: raise print(f"[retry] {path}: {exc!r}", flush = True) time.sleep(15)