From 45397f5d8c84a7e77592d87ce88d051619ecf91d Mon Sep 17 00:00:00 2001 From: ironAiken2 <51399982+ironAiken2@users.noreply.github.com> Date: Wed, 30 Oct 2024 07:59:06 +0000 Subject: [PATCH] fix: used slot calculation in resource broker when hideAgents is false (#2790) ### This PR resolves cases where the remaining resource calculation is incorrect. [Teams](https://teams.microsoft.com/l/message/19:14c484402d874dafb15806d093b95a82@thread.skype/1730271662948?tenantId=13c6a44d-9b52-4b9e-aa34-0513ee7131f2&groupId=74ae2c4d-ec4d-4fdf-b2c2-f5041d1e8631&parentMessageId=1730271662948&teamName=devops&channelName=Frontend&createdTime=1730271662948) **Chages:** - If the hideAgents option in `config.toml` is set to false, the resource broker calculates the remaining resources based on the agents that are schedulable. This solves the problem of `remaining` instead of `occupied` entering the used slot data. **How to test:** - Verify that the value of resource monitor on the session page is the same as the response value on the network. **Checklist:** (if applicable) - [ ] Mention to the original issue - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after --- src/components/backend-ai-resource-broker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/backend-ai-resource-broker.ts b/src/components/backend-ai-resource-broker.ts index e55af92290..321edd3620 100644 --- a/src/components/backend-ai-resource-broker.ts +++ b/src/components/backend-ai-resource-broker.ts @@ -862,7 +862,7 @@ export default class BackendAiResourceBroker extends BackendAIPage { // when `hideAgents` is `true`. There are some cases it is more useful // to display the remaining slots. this.used_resource_group_slot = this._roundResourceDecimalPlaces( - resourceGroupSlots.remaining, + resourceGroupSlots.occupied, ); } } else {