Skip to content
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

fix: API migration to improve performance in resource pool page #9056

Merged
merged 14 commits into from
Mar 28, 2024

Conversation

keita-determined
Copy link
Contributor

@keita-determined keita-determined commented Mar 26, 2024

Description

ET-104
Related to #9048

Test Plan

  • Check if Slots Allocated bars show the correct data
  • Check if topology works
    • Check if topology doesn't show up if nodes > 1,000 OR slots > 10,000
    • Check if polling is working when topology is available
  • Check if test cases covers edge cases

Commentary (optional)

Merge this after #9048

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

Ticket

@cla-bot cla-bot bot added the cla-signed label Mar 26, 2024
@keita-determined keita-determined changed the base branch from main to hz-customerk March 26, 2024 20:41
Copy link

netlify bot commented Mar 26, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit 0d6943a
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/6604f022320c4d0008990f24
😎 Deploy Preview https://deploy-preview-9056--determined-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@hamidzr hamidzr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm we want to make sure agent.slots is not used anywhere in the cluster page but the topology view.

webui/react/src/stores/cluster.tsx Outdated Show resolved Hide resolved
webui/react/src/types.ts Outdated Show resolved Hide resolved
Base automatically changed from hz-customerk to main March 27, 2024 01:16
@@ -481,7 +481,8 @@ export const getTelemetry: DetApi<EmptyParams, Api.V1GetTelemetryResponse, Telem
export const getAgents: DetApi<EmptyParams, Api.V1GetAgentsResponse, Type.Agent[]> = {
name: 'getAgents',
postProcess: (response) => decoder.jsonToAgents(response.agents || []),
request: () => detApi.Cluster.getAgents(),
request: () =>
detApi.Cluster.getAgents(undefined, undefined, undefined, undefined, undefined, true),
Copy link
Contributor

@hamidzr hamidzr Mar 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some changes in this branch where I was working toward parameterizing getting slots so that we can still use it for topology in case it helps

that branch also includes some changes for disabling topology

basically if and only if agents < 1000 && slotCount < 10000 then we want to pull down slots and render toplogy

@hamidzr hamidzr added the to-cherry-pick Pull requests that need to be cherry-picked into the current release label Mar 27, 2024
@keita-determined keita-determined force-pushed the fix/web-resource-pools branch 2 times, most recently from 29719a0 to 19fe58e Compare March 27, 2024 02:13
@keita-determined keita-determined marked this pull request as ready for review March 27, 2024 02:13
@keita-determined keita-determined requested a review from a team as a code owner March 27, 2024 02:13
Copy link

codecov bot commented Mar 27, 2024

Codecov Report

Attention: Patch coverage is 22.96296% with 104 lines in your changes are missing coverage. Please review.

Project coverage is 40.57%. Comparing base (18dd29e) to head (0d6943a).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9056      +/-   ##
==========================================
- Coverage   47.16%   40.57%   -6.59%     
==========================================
  Files        1150      829     -321     
  Lines      141674   102591   -39083     
  Branches     2415     2416       +1     
==========================================
- Hits        66814    41630   -25184     
+ Misses      74670    60771   -13899     
  Partials      190      190              
Flag Coverage Δ
harness ?
web 38.92% <22.96%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
webui/react/src/utils/cluster.ts 100.00% <100.00%> (ø)
webui/react/src/services/decoder.ts 19.95% <0.00%> (-0.03%) ⬇️
webui/react/src/types.ts 99.66% <66.66%> (-0.34%) ⬇️
webui/react/src/services/types.ts 0.00% <0.00%> (ø)
webui/react/src/services/api.ts 0.00% <0.00%> (ø)
webui/react/src/services/apiConfig.ts 72.56% <27.27%> (-0.29%) ⬇️
webui/react/src/stores/cluster.tsx 37.74% <34.78%> (+0.95%) ⬆️
...eact/src/pages/ResourcePool/ResourcepoolDetail.tsx 0.00% <0.00%> (ø)

... and 321 files with indirect coverage changes

@hamidzr
Copy link
Contributor

hamidzr commented Mar 27, 2024

something looks wrong with the topology:

before change
Screenshot 2024-03-26 at 21 31 40
after change
Screenshot 2024-03-26 at 21 32 00

@hamidzr
Copy link
Contributor

hamidzr commented Mar 27, 2024

thanks for working on this! I posted some questions and comments

@mackrorysd mackrorysd self-assigned this Mar 27, 2024
@keita-determined keita-determined force-pushed the fix/web-resource-pools branch 2 times, most recently from 4760395 to 80f82ba Compare March 27, 2024 19:22
webui/react/src/pages/ResourcePool/ResourcepoolDetail.tsx Outdated Show resolved Hide resolved
webui/react/src/pages/ResourcePool/ResourcepoolDetail.tsx Outdated Show resolved Hide resolved
webui/react/src/pages/ResourcePool/ResourcepoolDetail.tsx Outdated Show resolved Hide resolved
webui/react/src/pages/ResourcePool/ResourcepoolDetail.tsx Outdated Show resolved Hide resolved
webui/react/src/utils/cluster.ts Outdated Show resolved Hide resolved
webui/react/src/utils/cluster.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@ashtonG ashtonG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

javascript looks good

@hamidzr
Copy link
Contributor

hamidzr commented Mar 27, 2024

I can see the toplogy turning on and off as expected. but I also do see a request to fetch all the slots in a scenario I wasn't expecting
Screenshot 2024-03-27 at 15 39 54

this case has 1m slots

const agents = Loadable.getOrElse([], useObservable(clusterStore.agents));
probably needs to check that agents are loaded before going past this check?

if (agents.length > MAX_USABLE_NODES || totalSlots > MAX_USABLE_SLOTS) {
return [];
}

Copy link
Contributor

@hamidzr hamidzr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the update. I can see it pulling down the slots fine now when it should. But also we'd want it to keep refreshing those and continue to keep requesting for them. I assume that's needed for the topology to show the latest data
Screenshot 2024-03-27 at 21 36 51

Copy link
Contributor

@hamidzr hamidzr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing that issue. I see the ui is double requesting agents now on a recurring basis we can say we want the latest numbers on agents to be able to turn topology on or off if the situation changes but maybe just relying on the initial agent response once is enough?
this only happens when the conditions to show the topology is met eg the cluster is smaller so it's probably fine?

after 2024-03-28_09-40

before in main
Screenshot 2024-03-28 at 09 41 34

@keita-determined
Copy link
Contributor Author

thanks for fixing that issue. I see the ui is double requesting agents now on a recurring basis we can say we want the latest numbers on agents to be able to turn topology on or off if the situation changes but maybe just relying on the initial agent response once is enough?
this only happens when the conditions to show the topology is met eg the cluster is smaller so it's probably fine?

i think this should be fine because both APIs are used for different purposes and calling APIs is cheaper than the original issue.

@keita-determined keita-determined merged commit 17287f5 into main Mar 28, 2024
71 of 83 checks passed
@keita-determined keita-determined deleted the fix/web-resource-pools branch March 28, 2024 16:57
dai-release bot pushed a commit that referenced this pull request Mar 28, 2024
* squash

squash

* fix: API migration for resource pool

* fix: removed unused code

* fix: migrate `slotContainerStates` with the new agent schema

* test: test cases for `getSlotContainerStates`

* fix: better type

* test: add edae case

* fix: minor rebase fixes

* feat: topology workaround

* fix: minor fixes

* fix: add condition to show topology

* fix: feedback

* fix: avoid call agent api if there are too many nodes or slots

* fix: polling agent with slots

---------

Co-authored-by: Hamid Zare <12127420+hamidzr@users.noreply.github.com>
(cherry picked from commit 17287f5)
@hamidzr
Copy link
Contributor

hamidzr commented Apr 3, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed to-cherry-pick Pull requests that need to be cherry-picked into the current release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants