Skip to content

Commit

Permalink
fly m run support for spot-price restart policy and gpu bid price
Browse files Browse the repository at this point in the history
  • Loading branch information
dangra committed Jul 25, 2024
1 parent b57b0b9 commit 41096f5
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.19.0
github.com/stretchr/testify v1.9.0
github.com/superfly/fly-go v0.1.19-0.20240716210409-e3d434ec3f18
github.com/superfly/fly-go v0.1.19-0.20240722210612-a53ef77115d0
github.com/superfly/graphql v0.2.4
github.com/superfly/lfsc-go v0.1.1
github.com/superfly/macaroon v0.2.14-0.20240702184853-b8ac52a1fc77
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -626,8 +626,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/superfly/fly-go v0.1.19-0.20240716210409-e3d434ec3f18 h1:lXtwecpu2Ynwm1mkSl7pcJFFM86HzJNUsrNC4vswrYg=
github.com/superfly/fly-go v0.1.19-0.20240716210409-e3d434ec3f18/go.mod h1:JQke/BwoZqrWurqYkypSlcSo7bIUgCI3eVnqMC6AUj0=
github.com/superfly/fly-go v0.1.19-0.20240722210612-a53ef77115d0 h1:wm4EJAxGKSyk+8QOHS2kWUMl7a6jQXUSmamspSHeQRs=
github.com/superfly/fly-go v0.1.19-0.20240722210612-a53ef77115d0/go.mod h1:JQke/BwoZqrWurqYkypSlcSo7bIUgCI3eVnqMC6AUj0=
github.com/superfly/graphql v0.2.4 h1:Av8hSk4x8WvKJ6MTnEwrLknSVSGPc7DWpgT3z/kt3PU=
github.com/superfly/graphql v0.2.4/go.mod h1:CVfDl31srm8HnJ9udwLu6hFNUW/P6GUM2dKcG1YQ8jc=
github.com/superfly/lfsc-go v0.1.1 h1:dGjLgt81D09cG+aR9lJZIdmonjZSR5zYCi7s54+ZU2Q=
Expand Down
10 changes: 10 additions & 0 deletions internal/command/machine/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ var sharedFlags = flag.Set{
Description: `Set the restart policy for a Machine. Options include 'no', 'always', and 'on-fail'.
Default is 'on-fail' for Machines created by 'fly deploy' and Machines with a schedule. Default is 'always' for Machines created by 'fly m run'.`,
},
flag.Float64{
Name: "gpu-bid-price",
Description: `Set the GPU price to bid for (HELP!)`,
Hidden: true,
},
flag.StringSlice{
Name: "standby-for",
Description: "For Machines without services, a comma separated list of Machine IDs to act as standby for.",
Expand Down Expand Up @@ -734,6 +739,11 @@ func determineMachineConfig(
machineConf.Restart = &fly.MachineRestart{
Policy: fly.MachineRestartPolicyAlways,
}
case "spot-price":
machineConf.Restart = &fly.MachineRestart{
Policy: fly.MachineRestartPolicySpotPrice,
GPUBidPrice: float32(flag.GetFloat64(ctx, "gpu-bid-price")),
}
case "":
if flag.IsSpecified(ctx, "restart") {
// An empty policy was explicitly requested.
Expand Down

0 comments on commit 41096f5

Please sign in to comment.