Skip to content

Commit e189f3d

Browse files
[Dashboard] Do not fail the whole k8s infra table if some contexts are not available (#8085)
* do not fail the whole k8s table if some contexts are not available * format code
1 parent 717a13c commit e189f3d

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

sky/dashboard/src/data/connectors/infra.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,23 @@ async function getKubernetesGPUsFromContexts(contextNames) {
370370

371371
// Get all of the node info for all contexts in parallel and put them
372372
// in a dictionary keyed by context name.
373-
const contextNodeInfoList = await Promise.all(
373+
// Use Promise.allSettled to handle partial failures gracefully
374+
const contextNodeInfoResults = await Promise.allSettled(
374375
contextNames.map((context) => getKubernetesPerNodeGPUs(context))
375376
);
376377
const contextToNodeInfo = {};
377378
for (let i = 0; i < contextNames.length; i++) {
378-
contextToNodeInfo[contextNames[i]] = contextNodeInfoList[i];
379+
const result = contextNodeInfoResults[i];
380+
if (result.status === 'fulfilled') {
381+
contextToNodeInfo[contextNames[i]] = result.value;
382+
} else {
383+
// Log the error but continue with other contexts
384+
console.warn(
385+
`Failed to get node info for context ${contextNames[i]}:`,
386+
result.reason
387+
);
388+
contextToNodeInfo[contextNames[i]] = {};
389+
}
379390
}
380391

381392
// Populate the gpuToData map for each context.

0 commit comments

Comments
 (0)