|
28 | 28 | WorkerConfig, |
29 | 29 | WorkerKeepAliveSetting, |
30 | 30 | ) |
31 | | -from noteburst.exceptions import NoteburstWorkerError |
| 31 | +from noteburst.exceptions import NoteburstWorkerStartupError |
32 | 32 |
|
33 | 33 | from .functions import keep_alive, nbexec, ping, run_python |
34 | 34 | from .identity import IdentityClaimError, IdentityManager |
@@ -85,8 +85,10 @@ async def startup(ctx: dict[Any, Any]) -> None: |
85 | 85 |
|
86 | 86 | # Loop with different identities until we get a successful spawn |
87 | 87 | spawn_exception: Exception | None = None |
| 88 | + attempted_usernames: list[str] = [] |
88 | 89 | while True: |
89 | 90 | try: |
| 91 | + attempted_usernames.append(identity.username) |
90 | 92 | nublado_pod = await NubladoPod.spawn( |
91 | 93 | identity=identity, |
92 | 94 | nublado_image=config.nublado_image, |
@@ -117,22 +119,14 @@ async def startup(ctx: dict[Any, Any]) -> None: |
117 | 119 | identity = await identity_manager.get_next_identity(identity) |
118 | 120 | except IdentityClaimError: |
119 | 121 | # No more identities available, so we can't spawn a pod |
120 | | - raise NoteburstWorkerError( |
| 122 | + raise NoteburstWorkerStartupError( |
121 | 123 | "Failed to start up Noteburst worker. Could not spawn a " |
122 | 124 | "Nublado pod with any identity.", |
123 | | - tags={ |
124 | | - "username": identity.username, |
125 | | - "image_selector": config.image_selector, |
126 | | - "image_reference": config.image_reference or "N/A", |
127 | | - }, |
128 | | - contexts={ |
129 | | - "nublado": { |
130 | | - "username": identity.username, |
131 | | - "user_token_scopes": config.parsed_worker_token_scopes, |
132 | | - "image_selector": config.image_selector, |
133 | | - "image_reference": config.image_reference, |
134 | | - } |
135 | | - }, |
| 125 | + last_username=identity.username, |
| 126 | + attempted_usernames=attempted_usernames, |
| 127 | + image_selector=config.image_selector, |
| 128 | + image_reference=config.image_reference, |
| 129 | + user_token_scopes=config.parsed_worker_token_scopes, |
136 | 130 | ) from spawn_exception |
137 | 131 |
|
138 | 132 | ctx["nublado_client"] = nublado_pod.nublado_client |
|
0 commit comments