Skip to content

Commit 8a8130f

Browse files
committed
add experience to launchpad
1 parent 6e67d57 commit 8a8130f

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

v1/providers/launchpad/instance_create.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ import (
1212
validation "github.com/go-ozzo/ozzo-validation/v4"
1313
)
1414

15+
const (
16+
brevExperienceID = "43123766-35ec-4eb4-a5ba-3f2945228445"
17+
minimalExperienceID = "a5d93f56-bbdb-44db-a1ae-6b1ad7d3c6df"
18+
)
19+
1520
func (c *LaunchpadClient) CreateInstance(ctx context.Context, attrs v1.CreateInstanceAttrs) (*v1.Instance, error) {
1621
createAttrs := launchpadCreateAttrs(attrs)
1722
err := createAttrs.validate()
@@ -31,8 +36,8 @@ func (c *LaunchpadClient) CreateInstance(ctx context.Context, attrs v1.CreateIns
3136
createAttrs.Tags = createAttrs.generateTags(c.GetReferenceID())
3237
// deploymentCluster := launchpad.StringAsDeploymentCluster(launchpad.PtrString(clusterID))
3338
deployment := openapi.Deployment{
34-
// ExperienceId: collections.Ptr(instanceTypeToLaunchpadExperience(instanceTypeInfo)), // TODO: shouldn't need to set this
35-
ExpiresAt: *openapi.NewNullableTime(nil),
39+
ExperienceId: collections.Ptr(instanceTypeToLaunchpadExperience(instanceTypeInfo)), // TODO: necessary for now, but ideally we would use a Brev reservation/pool
40+
ExpiresAt: *openapi.NewNullableTime(nil),
3641
// Cluster: &deploymentCluster,
3742
GpuModel: *openapi.NewNullableString(collections.Ptr(instanceTypeInfo.gpuName)),
3843
GpuCount: *openapi.NewNullableInt32(collections.Ptr(instanceTypeInfo.gpuCount)),
@@ -45,7 +50,7 @@ func (c *LaunchpadClient) CreateInstance(ctx context.Context, attrs v1.CreateIns
4550
RequesterName: "brev.dev", // TODO: use user name
4651
Tags: createAttrs.Tags,
4752
Workshop: *openapi.NewNullableBool(collections.Ptr(true)),
48-
// WorkshopId: *openapi.NewNullableString(collections.Ptr(BrevWorkshopID)), // TODO: shouldn't need to set this
53+
WorkshopId: *openapi.NewNullableString(collections.Ptr("brev-dgxc")), // TODO: this should be mapped to a Brev reservation/pool. this will need to be handed down as a create attr
4954
}
5055
createDeployment, resp, err := c.client.CatalogDeploymentsAPI.CatalogDeploymentsCreate(c.makeAuthContext(ctx)).
5156
Deployment(deployment).
@@ -70,6 +75,13 @@ func (c *LaunchpadClient) CreateInstance(ctx context.Context, attrs v1.CreateIns
7075
return inst, nil
7176
}
7277

78+
func instanceTypeToLaunchpadExperience(instanceTypeInfo instanceTypeInfo) string {
79+
if instanceTypeInfo.provider == "nebius" {
80+
return minimalExperienceID
81+
}
82+
return brevExperienceID
83+
}
84+
7385
type launchpadCreateAttrs v1.CreateInstanceAttrs
7486

7587
func (l launchpadCreateAttrs) validate() error {

0 commit comments

Comments
 (0)