Skip to content

Commit

Permalink
fix: createPriceMap时不使用callOnAll, 适配器连接异常时也显示启用按键
Browse files Browse the repository at this point in the history
  • Loading branch information
piccaSun committed Jul 15, 2024
1 parent dbebe7f commit 6b159ac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
26 changes: 16 additions & 10 deletions apps/mis-server/src/bl/PriceMap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,30 @@ export async function createPriceMap(
return price;
};

// partitions info for all clusters
const partitionsForClusters: Record<string, Partition[]> = {};


// call for all activated clusters
const activatedClusters = await getActivatedClusters(em, logger).catch((e) => {
logger.info("!!![important] No available activated clusters.This will skip creating price map in cluster!!!");
logger.info(e);
return {};
});
const reply = await clusterPlugin.callOnAll(
activatedClusters,
logger,
async (client) => await asyncClientCall(client.config, "getClusterConfig", {}),
);

reply.forEach((x) => {
partitionsForClusters[x.cluster] = x.result.partitions;
});
// partitions info for all clusters
const partitionsForClusters: Record<string, Partition[]> = {};

await Promise.allSettled(Object.keys(activatedClusters).map(async (cluster) => {
try {
const result = await clusterPlugin.callOnOne(
cluster,
logger,
async (client) => await asyncClientCall(client.config, "getClusterConfig", {}),
);
partitionsForClusters[cluster] = result.partitions;
} catch (error) {
logger.info(`Can not get cluster's (clusterId: ${cluster}) config info from adapter.`, error);
};
}));

return {

Expand Down
2 changes: 1 addition & 1 deletion apps/mis-server/src/tasks/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function fetchJobs(
logger.info("!!![important] No available activated clusters.This will skip fetching Jobs in cluster!!!");
logger.info(e);
return {};
}); ;
});

// Calculate prices for new info and persist
const pricedJobs: JobInfo[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export const ClusterManagementTable: React.FC<Props> = ({
}
{
r.hpcEnabled && r.activationStatus === ClusterActivationStatus.DEACTIVATED
&& r.connectionStatus === ClusterConnectionStatus.AVAILABLE
&& (
<>
<a onClick={() => {
Expand Down

0 comments on commit 6b159ac

Please sign in to comment.