|
57 | 57 | from github.SelfHostedActionsRunner import SelfHostedActionsRunner |
58 | 58 | from github.GithubException import GithubException |
59 | 59 |
|
| 60 | +from requests.exceptions import RetryError as RequestsRetryError |
| 61 | + |
60 | 62 | from concurrent.futures import ThreadPoolExecutor, Future |
61 | 63 |
|
62 | 64 | # Lock to access the volumes list |
@@ -556,11 +558,10 @@ def filtered_run_jobs( |
556 | 558 | for run in workflow_runs: |
557 | 559 | try: |
558 | 560 | jobs = list(run.jobs()) |
559 | | - except GithubException as exc: |
560 | | - # Log and skip API calls that fail (e.g., GitHub 502) |
| 561 | + except (GithubException, RequestsRetryError) as exc: |
| 562 | + # Log and skip API calls that fail (e.g., GitHub 502, timeout, retry errors) |
561 | 563 | action.note( |
562 | | - f"WARNING:Skipping workflow run {run.id}, failed to fetch jobs: {exc}", |
563 | | - level=logging.WARNING, |
| 564 | + f"WARNING:Skipping workflow run {run.id}, failed to fetch jobs: {exc}" |
564 | 565 | ) |
565 | 566 | continue |
566 | 567 |
|
@@ -893,9 +894,17 @@ def recycle_server( |
893 | 894 | server.labels = server_labels |
894 | 895 |
|
895 | 896 | with Action(f"Rebuilding recycled server {server.name} image", server_name=name): |
896 | | - server.rebuild(image=server_image).action.wait_until_finished( |
897 | | - max_retries=timeout |
898 | | - ) |
| 897 | + try: |
| 898 | + server.rebuild(image=server_image).action.wait_until_finished( |
| 899 | + max_retries=timeout |
| 900 | + ) |
| 901 | + except APIException as exc: |
| 902 | + # Re-raise with context since Hetzner's server_error has message=None |
| 903 | + raise APIException( |
| 904 | + code=exc.code, |
| 905 | + message=f"error while rebuilding recycled server {server.name}: {exc.message}", |
| 906 | + details=getattr(exc, "details", None), |
| 907 | + ) from exc |
899 | 908 |
|
900 | 909 | setup_worker_pool.submit( |
901 | 910 | server_setup, |
|
0 commit comments