Feat: integrate batch allocator in processor allocator#4559
Feat: integrate batch allocator in processor allocator#4559lacroixthomas wants to merge 9 commits into
Conversation
|
Build Failed 😭 Build Id: c114e430-ff0d-4839-957e-5fd66102b7b0 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
1 similar comment
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
This is quite a "direct" import of the changes from the original PR, did minor updates on it |
|
Build Failed 😭 Build Id: c50b1a31-0600-48c2-95e8-4face7902b8e Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
/gcbrun |
|
Build Failed 😭 Build Id: 4246cd2b-53d1-4624-98df-3b0ca5e6fb97 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
/gcbrun |
|
Build Succeeded 🥳 Build Id: ff1ca275-3f67-4710-8594-a3dcf6bd472f The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
Build Failed 😭 Build Id: 68ed4e65-1fa3-402d-8035-3e561058d925 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
Build Failed 😭 Build Id: d8e3da64-c889-4a5f-a488-91c6d963bd23 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
LGTM! |
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
Build Succeeded 🥳 Build Id: 49b84f77-5e45-46f3-b9bf-5e7a10dc66a9 The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
Build Succeeded 🥳 Build Id: 551a05f8-1a19-4098-9389-1bd9d8fad35f The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
fd67e32 to
8bf3c39
Compare
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
Build Failed 😭 Build Id: d52a066c-5aed-45fc-a35e-f207dca8a47b Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
Build Failed 😭 Build Id: 2f1cd500-b351-4a80-88f2-a0963b5a53c1 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
/gcbrun |
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
Build Failed 😭 Build Id: ecd49a81-249e-42c3-a66e-3c2319bcea12 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
Build Failed 😭 Build Id: d246536c-b23a-42fd-9e92-9d61c8e4526e Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
Signed-off-by: Thomas Lacroix <thomas.lacroix@epitech.eu>
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
|
Build Failed 😭 Build Id: 2ae33ff8-fe72-4e3a-9939-6547fd1434a1 Status: FAILURE To get permission to view the Cloud Build view, join the agones-discuss Google Group. |
|
/gcbrun |
|
Build Succeeded 🥳 Build Id: a7f42097-7e72-41fa-976a-0608c252904d The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
|
This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size. |
| c.allocationCache.AddGameServer(gs) | ||
| } | ||
| res.err = ErrGameServerUpdateConflict | ||
| res.err = goErrors.Join(ErrGameServerUpdateConflict, err) |
There was a problem hiding this comment.
golang native error management is slipping through.
Might be time to really commit to #4510
| if applyErr == nil { | ||
| if alreadyAllocated { | ||
| existingBatch.responses = append(existingBatch.responses, response{request: req, gs: gsToReorder.DeepCopy(), err: nil}) | ||
| existingBatch.counterErrors = goErrors.Join(existingBatch.counterErrors, counterErrors) |
There was a problem hiding this comment.
More native go error handling slipping though.
| var propagatedErr error | ||
| updatedGs, updateErr := c.gameServerGetter.GameServers(lastGsState.ObjectMeta.Namespace).Update(ctx, lastGsState, metav1.UpdateOptions{}) | ||
| if updateErr != nil { | ||
| c.allocationCache.AddGameServer(lastGsState) |
There was a problem hiding this comment.
If the erorr is a conflict, we shouldn't put it back in the cache, as the data will be stale.
| case goErrors.Is(err, ErrConflictInGameServerSelection): | ||
| gsa.Status.State = allocationv1.GameServerAllocationContention | ||
| return gsa, nil | ||
| case goErrors.Is(err, ErrGameServerUpdateConflict): |
There was a problem hiding this comment.
More modern go error library slipping through.
| updatedGs, updateErr := c.gameServerGetter.GameServers(lastGsState.ObjectMeta.Namespace).Update(ctx, lastGsState, metav1.UpdateOptions{}) | ||
| if updateErr != nil { | ||
| c.allocationCache.AddGameServer(lastGsState) | ||
| propagatedErr = goErrors.Join(ErrGameServerUpdateConflict, updateErr) |
There was a problem hiding this comment.
Shouldn't this only be a Conflict error, on an actual conflict?
| } | ||
|
|
||
| case <-ctx.Done(): | ||
| flush() |
There was a problem hiding this comment.
Not sure I understand why we're flushing when we are shutting down -- would this lock up, as it's pushing into channels that don't have any workers to receive?
| switch { | ||
| case err == nil: | ||
| return true, nil | ||
| case err == ErrNoGameServer: |
| gsToReorderIndex int | ||
| want []*agonesv1.GameServer | ||
| }{ | ||
| "pakced (no change)": { |
| return | ||
|
|
||
| default: | ||
| flush() |
There was a problem hiding this comment.
Nit: flush will recreate a new map on each pass through - even when there's nothing to process. Would be good to check this either inside or outside of flush()
| if removeErr := c.allocationCache.RemoveGameServer(foundGs); removeErr != nil { | ||
| removeErr = errors.Wrap(removeErr, "error removing gameserver from cache") | ||
| req.response <- response{request: req, gs: nil, err: removeErr} | ||
| list = append(list[:foundGsIndex], list[foundGsIndex+1:]...) |
There was a problem hiding this comment.
If this fails, is the index now wrong? since the list has changed size?
|
Build Succeeded 🥳 Build Id: dee469f2-222e-4a45-b738-6b1541fbf89f The following development artifacts have been built, and will exist for the next 30 days:
A preview of the website (the last 30 builds are retained): To install this version: |
What type of PR is this?
/kind feature
What this PR does / Why we need it:
Bring the batch allocator improvement from this PR to the processorAllocator feature gate : #4176
Which issue(s) this PR fixes:
Part of #4190 and #3992
Special notes for your reviewer: