Skip to content

Commit

Permalink
fix: ensure imageOverrides passes when empty
Browse files Browse the repository at this point in the history
This commit ensures that the software functions correctly when imageOverrides
is empty. It also updates the description of the `aiRunnerImageOverrides` command
line flag.
  • Loading branch information
rickstaa committed Jan 28, 2025
1 parent f161107 commit 35c4ca9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion cmd/livepeer/livepeer.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ func parseLivepeerConfig() starter.LivepeerConfig {
cfg.AIModels = flag.String("aiModels", *cfg.AIModels, "Set models (pipeline:model_id) for AI worker to load upon initialization")
cfg.AIModelsDir = flag.String("aiModelsDir", *cfg.AIModelsDir, "Set directory where AI model weights are stored")
cfg.AIRunnerImage = flag.String("aiRunnerImage", *cfg.AIRunnerImage, "[Deprecated] Specify the base Docker image for the AI runner. Example: livepeer/ai-runner:0.0.1. Use -aiRunnerImageOverrides instead.")
cfg.AIRunnerImageOverrides = flag.String("aiRunnerImageOverrides", *cfg.AIRunnerImageOverrides, `Specify overrides for the Docker images used by the AI runner. Example: '{"segment-anything-2": "livepeer/ai-runner:segment-anything-2-v1.0", "another-pipeline": "livepeer/ai-runner:another-pipeline-v1.0"}'`)
cfg.AIRunnerImageOverrides = flag.String("aiRunnerImageOverrides", *cfg.AIRunnerImageOverrides, `Specify overrides for the Docker images used by the AI runner. Example: '{"default": "livepeer/ai-runner:v1.0", "batch": {"text-to-speech": "livepeer/ai-runner:text-to-speech-v1.0"}, "live": {"another-pipeline": "livepeer/ai-runner:another-pipeline-v1.0"}}'`)

// Live AI:
cfg.MediaMTXApiPassword = flag.String("mediaMTXApiPassword", "", "HTTP basic auth password for MediaMTX API requests")
cfg.LiveAITrickleHostForRunner = flag.String("liveAITrickleHostForRunner", "", "Trickle Host used by AI Runner; It's used to overwrite the publicly available Trickle Host")
Expand Down
8 changes: 5 additions & 3 deletions cmd/livepeer/starter/starter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1216,9 +1216,11 @@ func StartLivepeer(ctx context.Context, cfg LivepeerConfig) {

// Retrieve image overrides from the config.
var imageOverrides worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for darwin-amd64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for linux-cpu-amd64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Run tests defined for the project

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for darwin-arm64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for linux-cpu-arm64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for linux-gpu-amd64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for linux-gpu-arm64

undefined: worker.ImageOverrides

Check failure on line 1218 in cmd/livepeer/starter/starter.go

View workflow job for this annotation

GitHub Actions / Build binaries for windows-cpu-amd64

undefined: worker.ImageOverrides
if err := json.Unmarshal([]byte(*cfg.AIRunnerImageOverrides), &imageOverrides); err != nil {
glog.Errorf("Error unmarshaling image overrides: %v", err)
return
if *cfg.AIRunnerImageOverrides != "" {
if err := json.Unmarshal([]byte(*cfg.AIRunnerImageOverrides), &imageOverrides); err != nil {
glog.Errorf("Error unmarshaling image overrides: %v", err)
return
}
}

// Backwards compatibility for deprecated flags.
Expand Down

0 comments on commit 35c4ca9

Please sign in to comment.