Skip to content

Commit

Permalink
fix(cmd/gpud): handle "run --expected-port-states-nvidia-infiniband" …
Browse files Browse the repository at this point in the history
…flag (#212)

Signed-off-by: Gyuho Lee <[email protected]>
  • Loading branch information
gyuho authored Nov 30, 2024
1 parent c5116bd commit d65975c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/gpud/command/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os/signal"
"time"

"github.com/leptonai/gpud/components/accelerator/nvidia/infiniband"
"github.com/leptonai/gpud/config"
lepServer "github.com/leptonai/gpud/internal/server"
"github.com/leptonai/gpud/log"
Expand Down Expand Up @@ -45,6 +46,14 @@ func cmdRun(cliContext *cli.Context) error {
config.WithKubeletIgnoreConnectionErrors(kubeletIgnoreConnectionErrors),
}

if expectedPortStates != "" {
portStates := &infiniband.ExpectedPortStates{}
if err := json.Unmarshal([]byte(expectedPortStates), portStates); err != nil {
return err
}
configOpts = append(configOpts, config.WithExpectedPortStates(*portStates))
}

ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
cfg, err := config.DefaultConfig(ctx, configOpts...)
cancel()
Expand Down

0 comments on commit d65975c

Please sign in to comment.