From 5fdaaccb940d6a1a2c0f954dc2ea8a3fa1d4eb88 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp Date: Thu, 7 Dec 2023 10:43:27 -0500 Subject: [PATCH 1/4] Update @akashnetwork/akashjs version to 0.5.0 --- deploy-web/package-lock.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/deploy-web/package-lock.json b/deploy-web/package-lock.json index 391a8ea18..dc68d64c7 100644 --- a/deploy-web/package-lock.json +++ b/deploy-web/package-lock.json @@ -10,7 +10,7 @@ "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@akashnetwork/akashjs": "0.4.17", + "@akashnetwork/akashjs": "0.5.0", "@auth0/nextjs-auth0": "^3.1.0", "@cosmjs/encoding": "^0.29.5", "@cosmjs/stargate": "^0.29.5", @@ -93,9 +93,9 @@ } }, "node_modules/@akashnetwork/akashjs": { - "version": "0.4.17", - "resolved": "https://registry.npmjs.org/@akashnetwork/akashjs/-/akashjs-0.4.17.tgz", - "integrity": "sha512-jA9E1e26MtU8PT79frdWqNrXICWeY9I2H29UEuh4Xey9p+ZQKY5GheHNd7nfX9H/m2UIrlh4gZo6u9JoMjJo/A==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@akashnetwork/akashjs/-/akashjs-0.5.0.tgz", + "integrity": "sha512-PRErEdbDZHNjVSFQ+2Hc0WnZdW+h9zWJBFr/T468VDTdxUlQx/88vX+7s5Fo4T9+HkBhFDtaEj5nl7dTr38PNw==", "dependencies": { "@cosmjs/launchpad": "^0.27.0", "@cosmjs/proto-signing": "^0.28.11", @@ -15709,9 +15709,9 @@ }, "dependencies": { "@akashnetwork/akashjs": { - "version": "0.4.17", - "resolved": "https://registry.npmjs.org/@akashnetwork/akashjs/-/akashjs-0.4.17.tgz", - "integrity": "sha512-jA9E1e26MtU8PT79frdWqNrXICWeY9I2H29UEuh4Xey9p+ZQKY5GheHNd7nfX9H/m2UIrlh4gZo6u9JoMjJo/A==", + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@akashnetwork/akashjs/-/akashjs-0.5.0.tgz", + "integrity": "sha512-PRErEdbDZHNjVSFQ+2Hc0WnZdW+h9zWJBFr/T468VDTdxUlQx/88vX+7s5Fo4T9+HkBhFDtaEj5nl7dTr38PNw==", "requires": { "@cosmjs/launchpad": "^0.27.0", "@cosmjs/proto-signing": "^0.28.11", From c55e27a57638e41538eae48cefc27e190215d07f Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp Date: Thu, 7 Dec 2023 11:48:56 -0500 Subject: [PATCH 2/4] map resources offer to bids --- .../newDeploymentWizard/BidGroup.tsx | 2 + deploy-web/src/queries/useBidQuery.ts | 3 +- deploy-web/src/types/deployment.ts | 105 +++++++----------- 3 files changed, 47 insertions(+), 63 deletions(-) diff --git a/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx b/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx index 5b96c59c6..696ceb5c9 100644 --- a/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx +++ b/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx @@ -108,6 +108,8 @@ export const BidGroup: React.FunctionComponent = ({ } }, [deploymentDetail, gseq]); + console.log(bids); + return ( ; + endpoints: Array<{ + kind: string; + sequence_number: number; + }>; +} +interface DeploymentResource_V3 extends DeploymentResource_V2 {} + interface DeploymentGroup_v2 { group_id: { owner: string; @@ -78,37 +111,7 @@ interface DeploymentGroup_v2 { }>; }; resources: Array<{ - resources: { - cpu: { - units: { - val: string; - }; - attributes: any[]; - }; - gpu: { - units: { - val: string; - }; - attributes: any[]; - }; - memory: { - quantity: { - val: string; - }; - attributes: any[]; - }; - storage: Array<{ - name: string; - quantity: { - val: string; - }; - attributes: any[]; - }>; - endpoints: Array<{ - kind: string; - sequence_number: number; - }>; - }; + resources: DeploymentResource_V2; count: number; price: { denom: string; @@ -139,37 +142,7 @@ interface DeploymentGroup_v3 { }>; }; resources: Array<{ - resource: { - cpu: { - units: { - val: string; - }; - attributes: any[]; - }; - gpu: { - units: { - val: string; - }; - attributes: any[]; - }; - memory: { - quantity: { - val: string; - }; - attributes: any[]; - }; - storage: Array<{ - name: string; - quantity: { - val: string; - }; - attributes: any[]; - }>; - endpoints: Array<{ - kind: string; - sequence_number: number; - }>; - }; + resource: DeploymentResource_V3; count: number; price: { denom: string; @@ -300,6 +273,10 @@ export interface RpcBid { amount: string; }; created_at: string; + resources_offer: Array<{ + resources: DeploymentResource_V3; + count: number; + }>; }; escrow_account: { id: { @@ -337,4 +314,8 @@ export interface BidDto { amount: string; }; state: string; + resourcesOffer: Array<{ + resources: DeploymentResource_V3; + count: number; + }>; } From 43dbe4e21efc4c6817142a94c1e53151ed1a4679 Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp Date: Thu, 7 Dec 2023 14:03:33 -0500 Subject: [PATCH 3/4] Refactor BidRow component styles --- .../newDeploymentWizard/BidGroup.tsx | 2 - .../components/newDeploymentWizard/BidRow.tsx | 88 ++++++++++--------- 2 files changed, 48 insertions(+), 42 deletions(-) diff --git a/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx b/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx index 696ceb5c9..5b96c59c6 100644 --- a/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx +++ b/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx @@ -108,8 +108,6 @@ export const BidGroup: React.FunctionComponent = ({ } }, [deploymentDetail, gseq]); - console.log(bids); - return ( ({ } }, selectedRow: { - backgroundColor: `${theme.palette.mode === "dark" ? theme.palette.grey[700] : theme.palette.grey[400]} !important` + backgroundColor: `${theme.palette.mode === "dark" ? darken(theme.palette.success.main, 0.8) : lighten(theme.palette.success.main, 0.8)} !important`, + border: "1px solid" }, secondaryText: { fontSize: ".8rem" }, chip: { - height: ".9rem", - fontSize: ".7rem", - lineHeight: ".7rem" + height: "1rem", + fontSize: ".75rem", + lineHeight: ".75rem" }, priceTooltip: { display: "flex", @@ -52,7 +53,8 @@ const useStyles = makeStyles()(theme => ({ marginBottom: "4px" }, providerOffline: { - marginTop: "4px" + marginTop: "4px", + fontSize: "1rem" }, stateIcon: { marginRight: ".5rem" @@ -61,7 +63,7 @@ const useStyles = makeStyles()(theme => ({ color: theme.palette.secondary.main }, stateInactive: { - color: theme.palette.primary.main + color: theme.palette.primary.contrastText }, flexCenter: { display: "flex", @@ -191,39 +193,45 @@ export const BidRow: React.FunctionComponent = ({ bid, selectedBid, handl - {isLoadingStatus && ( - - - - )} - {!isLoadingStatus && error && !isSendingManifest && ( -
- - OFFLINE -
- )} - - {!isLoadingStatus && !error && !isSendingManifest && ( - <> - {bid.state !== "open" || disabled ? ( - - - - ) : ( - handleBidSelected(bid)} - value={bid.id} - name="radio-button-demo" - disabled={bid.state !== "open" || disabled} - size="medium" - color="success" - /> - )} - - )} - - {isSendingManifest && isCurrentBid && } + + {isLoadingStatus && ( + + + + )} + {!isLoadingStatus && error && !isSendingManifest && ( +
+ + OFFLINE +
+ )} + + {!isLoadingStatus && !error && !isSendingManifest && ( + <> + {bid.state !== "open" || disabled ? ( + + + + ) : ( + handleBidSelected(bid)} + value={bid.id} + name="radio-button-demo" + disabled={bid.state !== "open" || disabled} + size="small" + color="success" + /> + )} + + )} + + {isSendingManifest && isCurrentBid && ( + + + + )} +
); From c978ea0ff0d1b55da6d80534df348446fca4293f Mon Sep 17 00:00:00 2001 From: Maxime Beauchamp Date: Fri, 8 Dec 2023 15:47:56 -0500 Subject: [PATCH 4/4] added gpu in bid row --- .../newDeploymentWizard/BidGroup.tsx | 8 +- .../components/newDeploymentWizard/BidRow.tsx | 83 +++++++++++++------ deploy-web/src/types/deployment.ts | 8 +- 3 files changed, 68 insertions(+), 31 deletions(-) diff --git a/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx b/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx index 5b96c59c6..cf84abdac 100644 --- a/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx +++ b/deploy-web/src/components/newDeploymentWizard/BidGroup.tsx @@ -158,9 +158,11 @@ export const BidGroup: React.FunctionComponent = ({ Provider - - Favorite - + {deploymentDetail.gpuAmount > 0 && ( + + GPU + + )} Audited diff --git a/deploy-web/src/components/newDeploymentWizard/BidRow.tsx b/deploy-web/src/components/newDeploymentWizard/BidRow.tsx index 85d3db0b6..e190ceebb 100644 --- a/deploy-web/src/components/newDeploymentWizard/BidRow.tsx +++ b/deploy-web/src/components/newDeploymentWizard/BidRow.tsx @@ -30,7 +30,7 @@ const useStyles = makeStyles()(theme => ({ } }, selectedRow: { - backgroundColor: `${theme.palette.mode === "dark" ? darken(theme.palette.success.main, 0.8) : lighten(theme.palette.success.main, 0.8)} !important`, + backgroundColor: `${theme.palette.mode === "dark" ? darken(theme.palette.success.main, 0.8) : lighten(theme.palette.success.main, 0.8)} !important`, border: "1px solid" }, secondaryText: { @@ -54,7 +54,7 @@ const useStyles = makeStyles()(theme => ({ }, providerOffline: { marginTop: "4px", - fontSize: "1rem" + fontSize: ".85rem" }, stateIcon: { marginRight: ".5rem" @@ -68,6 +68,14 @@ const useStyles = makeStyles()(theme => ({ flexCenter: { display: "flex", alignItems: "center" + }, + gpuChip: { + height: "16px", + fontSize: ".65rem", + fontWeight: "bold" + }, + gpuChipLabel: { + padding: "0 4px" } })); @@ -86,7 +94,6 @@ export const BidRow: React.FunctionComponent = ({ bid, selectedBid, handl const isFavorite = favoriteProviders.some(x => provider.owner === x); const isCurrentBid = selectedBid?.id === bid.id; const { - data: providerStatus, isLoading: isLoadingStatus, refetch: fetchProviderStatus, error @@ -94,6 +101,17 @@ export const BidRow: React.FunctionComponent = ({ bid, selectedBid, handl enabled: false, retry: false }); + const gpuModels = bid.resourcesOffer + .map(x => + x.resources.gpu.attributes + .filter(y => y.key.startsWith("vendor/")) + .map(y => { + const modelKey = y.key.split("/"); + // vendor/nvidia/model/h100 -> nvidia,h100 + return { vendor: modelKey[1], model: modelKey[modelKey.length - 1] }; + }) + ) + .flat(); useEffect(() => { if (provider) { @@ -151,29 +169,46 @@ export const BidRow: React.FunctionComponent = ({ bid, selectedBid, handl {provider.uptime7d ? :
-
}
- - {provider.name ? ( - e.stopPropagation()}> - {provider.name?.length > 20 ? ( - - {getSplitText(provider.name, 4, 13)} - + + + + + {provider.name ? ( + e.stopPropagation()}> + {provider.name?.length > 20 ? ( + + {getSplitText(provider.name, 4, 13)} + + ) : ( + provider.name + )} + ) : ( - provider.name +
+ +
{getSplitText(provider.hostUri, 4, 13)}
+
+
)} - - ) : ( -
- -
{getSplitText(provider.hostUri, 4, 13)}
-
-
- )} +
+
- - - + {gpuModels.length > 0 && ( + + {gpuModels.map((gpu, i) => ( + + ))} + + )} {provider.isAudited ? ( @@ -201,8 +236,8 @@ export const BidRow: React.FunctionComponent = ({ bid, selectedBid, handl )} {!isLoadingStatus && error && !isSendingManifest && (
- - OFFLINE + + OFFLINE
)} diff --git a/deploy-web/src/types/deployment.ts b/deploy-web/src/types/deployment.ts index 655982e7e..d7d105218 100644 --- a/deploy-web/src/types/deployment.ts +++ b/deploy-web/src/types/deployment.ts @@ -63,26 +63,26 @@ interface DeploymentResource_V2 { units: { val: string; }; - attributes: any[]; + attributes: {key: string, value: string}[]; }; gpu: { units: { val: string; }; - attributes: any[]; + attributes: {key: string, value: string}[]; }; memory: { quantity: { val: string; }; - attributes: any[]; + attributes: {key: string, value: string}[]; }; storage: Array<{ name: string; quantity: { val: string; }; - attributes: any[]; + attributes: {key: string, value: string}[]; }>; endpoints: Array<{ kind: string;