Skip to content

Commit

Permalink
fix p4d instance type (#4303)
Browse files Browse the repository at this point in the history
  • Loading branch information
Feroze Mohideen authored Feb 20, 2024
1 parent 9a283b0 commit 7828e0d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions dashboard/src/lib/clusters/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import gcp from "assets/gcp.png";

import {
type ClientCloudProvider,
type ClientMachineType,
type ClientRegion,
type MachineType,
type PreflightCheck,
type PreflightCheckResolution,
} from "./types";
Expand Down Expand Up @@ -94,7 +94,7 @@ const SUPPORTED_AZURE_REGIONS: ClientRegion[] = [
{ name: "westus3", displayName: "West US 3" },
];

const SUPPORTED_AWS_MACHINE_TYPES: MachineType[] = [
const SUPPORTED_AWS_MACHINE_TYPES: ClientMachineType[] = [
{
name: "t3.medium",
displayName: "t3.medium",
Expand Down Expand Up @@ -426,13 +426,13 @@ const SUPPORTED_AWS_MACHINE_TYPES: MachineType[] = [
supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
},
{
name: "g4dn.24xlarge",
displayName: "g4dn.24xlarge",
name: "p4d.24xlarge",
displayName: "p4d.24xlarge",
supportedRegions: SUPPORTED_AWS_REGIONS.map((r) => r.name),
},
];

const SUPPORTED_GCP_MACHINE_TYPES: MachineType[] = [
const SUPPORTED_GCP_MACHINE_TYPES: ClientMachineType[] = [
{
name: "e2-standard-2",
displayName: "e2-standard-2",
Expand Down Expand Up @@ -590,7 +590,7 @@ const SUPPORTED_GCP_MACHINE_TYPES: MachineType[] = [
},
];

const SUPPORTED_AZURE_MACHINE_TYPES: MachineType[] = [
const SUPPORTED_AZURE_MACHINE_TYPES: ClientMachineType[] = [
{
name: "Standard_B2als_v2",
displayName: "Standard_B2als_v2",
Expand Down
6 changes: 3 additions & 3 deletions dashboard/src/lib/clusters/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export type ClientCloudProvider = {
displayName: string;
icon: string;
regions: ClientRegion[];
machineTypes: MachineType[];
machineTypes: ClientMachineType[];
baseCost: number;
newClusterDefaultContract: Contract; // this is where we include sensible defaults for new clusters
preflightChecks: PreflightCheck[];
Expand Down Expand Up @@ -167,7 +167,7 @@ const awsMachineTypeValidator = z.enum([
"g4dn.xlarge",
"g4dn.2xlarge",
"g4dn.4xlarge",
"g4dn.24xlarge",
"p4d.24xlarge",
]);
type AWSMachineType = z.infer<typeof awsMachineTypeValidator>;
const gcpMachineTypeValidator = z.enum([
Expand Down Expand Up @@ -224,7 +224,7 @@ type AzureSKUTier = {
name: string;
displayName: string;
};
export type MachineType = {
export type ClientMachineType = {
name: AWSMachineType | GCPMachineType | AzureMachineType;
displayName: string;
supportedRegions: Array<AWSRegion | GCPRegion | AzureRegion>;
Expand Down
10 changes: 4 additions & 6 deletions dashboard/src/main/home/app-dashboard/create-app/CreateApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import VerticalSteps from "components/porter/VerticalSteps";
import DashboardHeader from "main/home/cluster-dashboard/DashboardHeader";
import { useAppAnalytics } from "lib/hooks/useAppAnalytics";
import { useAppValidation } from "lib/hooks/useAppValidation";
import { useCluster } from "lib/hooks/useCluster";
import {
useDefaultDeploymentTarget,
useDeploymentTargetList,
Expand Down Expand Up @@ -216,6 +217,7 @@ const CreateApp: React.FC<CreateAppProps> = ({ history }) => {
creating: true,
});
const { currentClusterResources } = useClusterResources();
const { cluster } = useCluster({ clusterId: currentCluster?.id });

// set the deployment target id to the default if no deployment target has been selected yet
useEffect(() => {
Expand Down Expand Up @@ -361,12 +363,7 @@ const CreateApp: React.FC<CreateAppProps> = ({ history }) => {
setIsDeploying(false);
}
},
[
currentProject?.id,
currentCluster?.id,
deploymentTargetID,
name.value,
]
[currentProject?.id, currentCluster?.id, deploymentTargetID, name.value]
);

useEffect(() => {
Expand Down Expand Up @@ -725,6 +722,7 @@ const CreateApp: React.FC<CreateAppProps> = ({ history }) => {
<ServiceList
addNewText={"Add a new service"}
fieldArrayName={"app.services"}
cluster={cluster}
/>
</>,
<>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ const GPUResources: React.FC<Props> = ({ index, cluster }) => {
const { control } = useFormContext<PorterAppFormData>();

const canEnableGPU = useMemo(() => {
return cluster?.contract.config.cluster.config.nodeGroups.some(
(ng) => ng.nodeGroupType === "CUSTOM"
return (
cluster.contract.config.cluster.config.nodeGroups.some(
(ng) => ng.nodeGroupType === "CUSTOM"
) && cluster.contract.condition === "SUCCESS"
);
}, [cluster]);

Expand All @@ -53,7 +55,7 @@ const GPUResources: React.FC<Props> = ({ index, cluster }) => {
checked={value.enabled.value}
disabled={clusterIsUpdating}
onChange={() => {
if (!canEnableGPU) {
if (!value.enabled.value && !canEnableGPU) {
setClusterModalVisible(true);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import Spacer from "components/porter/Spacer";
import Text from "components/porter/Text";
import {
type ClientClusterContract,
type MachineType,
type ClientMachineType,
} from "lib/clusters/types";

import world from "assets/world.svg";

type Props = {
availableMachineTypes: MachineType[];
availableMachineTypes: ClientMachineType[];
};
const NodeGroups: React.FC<Props> = ({ availableMachineTypes }) => {
const { control } = useFormContext<ClientClusterContract>();
Expand Down

0 comments on commit 7828e0d

Please sign in to comment.