-
Notifications
You must be signed in to change notification settings - Fork 214
Introduce min runner version to selection #3505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
64df67c
Add Runner Sem Versioning
leszko ecdeb05
WIP: Filter out Orchestrators with wrong Runner Version
leszko 0b8066e
Propagate Runner version to Gateway
leszko 091478f
Fix imports
leszko 4663320
Add '-aiMinRunnerVersions' flag
leszko e3ad48b
Add propagating the flag in Gateway
leszko c74891f
Add filtering by version
leszko 5b9e802
Exclude Orchestrator by min runner version
leszko 7984b6a
Remove versioning from the box
leszko 18c6387
Regenerate openapi.yaml
leszko ac6ecbb
Refactor
leszko e4ea351
Merge branch 'master' into rafal/runner-version
leszko e932310
Add unit tests
leszko b7b7c7e
Fix existing unit tests
leszko c4833fe
Refactor
leszko 1dd150c
Add info that it works only for warm runner containers
leszko a343337
Merge branch 'master' into rafal/runner-version
leszko 7f08c25
Merge branch 'master' into rafal/runner-version
leszko da3e05c
Merge branch 'master' into rafal/runner-version
leszko 062135b
Fix returning the default runner version
leszko 610b1c4
Merge remote-tracking branch 'origin/rafal/runner-version' into rafal…
leszko 7d9488b
Add warning if multiple runner versions set
leszko 7373d29
Merge branch 'master' into rafal/runner-version
leszko 547cd4a
Update go bindings
leszko bb41a5d
Fix unit test
leszko 7fe3364
Refactor
leszko 07432e4
Merge branch 'master' into rafal/runner-version
leszko a020605
Merge branch 'master' into rafal/runner-version
leszko 27c4c39
Final fixers
leszko 3965de3
Remove unused WorkerVersion()
leszko File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| package worker | ||
|
|
||
| import ( | ||
| "context" | ||
| "github.com/Masterminds/semver/v3" | ||
| "github.com/livepeer/go-livepeer/clog" | ||
| ) | ||
|
|
||
| // LowestVersion returns the lowest version of a given pipeline and model ID from a list of versions. | ||
| func LowestVersion(versions []Version, pipeline string, modelId string) string { | ||
| var res string | ||
| var lowest *semver.Version | ||
|
|
||
| for _, v := range versions { | ||
| if v.Pipeline != pipeline || v.ModelId != modelId { | ||
| continue | ||
| } | ||
| ver, err := semver.NewVersion(v.Version) | ||
| if err != nil { | ||
| clog.Warningf(context.Background(), "Invalid runner version '%s'", v) | ||
| continue | ||
| } | ||
| if lowest == nil || ver.LessThan(lowest) { | ||
| if lowest != nil { | ||
| clog.Warningf(context.Background(), "Orchestrator has multiple versions set for the same pipeline and model ID. Using the lowest version: %s", ver) | ||
| } | ||
| lowest = ver | ||
| res = v.Version | ||
| } | ||
| } | ||
| return res | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package worker | ||
|
|
||
| import "testing" | ||
|
|
||
| func TestLowestVersion(t *testing.T) { | ||
| versions := []Version{ | ||
| {Pipeline: "pipeline1", ModelId: "model1", Version: "1.0.0"}, | ||
| {Pipeline: "pipeline1", ModelId: "model1", Version: "2.0.0"}, | ||
| {Pipeline: "pipeline2", ModelId: "model2", Version: "1.5.0"}, | ||
| {Pipeline: "pipeline2", ModelId: "model2", Version: "0.1.0"}, | ||
| {Pipeline: "pipeline2", ModelId: "model2", Version: "1.5.0"}, | ||
| {Pipeline: "pipeline2", ModelId: "model2", Version: "0.0.2"}, | ||
| } | ||
|
|
||
| tests := []struct { | ||
| pipeline string | ||
| modelId string | ||
| expected string | ||
| }{ | ||
| {"pipeline1", "model1", "1.0.0"}, | ||
| {"pipeline2", "model2", "0.0.2"}, | ||
| {"pipeline3", "model3", ""}, | ||
| } | ||
|
|
||
| for _, test := range tests { | ||
| t.Run(test.pipeline+"_"+test.modelId, func(t *testing.T) { | ||
| result := LowestVersion(versions, test.pipeline, test.modelId) | ||
| if result != test.expected { | ||
| t.Errorf("Expected %s, got %s", test.expected, result) | ||
| } | ||
| }) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.