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: cease many model fetch api calls in checkpoint tab #8749

Merged
merged 4 commits into from
Jan 25, 2024

Conversation

keita-determined
Copy link
Contributor

@keita-determined keita-determined commented Jan 24, 2024

Description

WEB-1950

Test Plan

  • Check if model fetch api is only called once in init phase
  • Check if checkpoint delete and register still works

Commentary (optional)

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 Jan 24, 2024
@keita-determined keita-determined marked this pull request as ready for review January 24, 2024 22:15
@keita-determined keita-determined requested a review from a team as a code owner January 24, 2024 22:15
Copy link

netlify bot commented Jan 24, 2024

Deploy Preview for determined-ui ready!

Name Link
🔨 Latest commit cf50301
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/65b2da8e8109280008d8cce3
😎 Deploy Preview https://deploy-preview-8749--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

codecov bot commented Jan 24, 2024

Codecov Report

Attention: 48 lines in your changes are missing coverage. Please review.

Comparison is base (96b9064) 47.44% compared to head (cf50301) 42.33%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8749      +/-   ##
==========================================
- Coverage   47.44%   42.33%   -5.11%     
==========================================
  Files        1046      730     -316     
  Lines      166968   128338   -38630     
  Branches     2245     2240       -5     
==========================================
- Hits        79214    54337   -24877     
+ Misses      87595    73842   -13753     
  Partials      159      159              
Flag Coverage Δ
harness ?
web 42.50% <29.41%> (-0.02%) ⬇️

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

Files Coverage Δ
...ui/react/src/components/CheckpointModalTrigger.tsx 93.02% <100.00%> (+2.85%) ⬆️
...t/src/pages/TrialDetails/TrialDetailsWorkloads.tsx 19.37% <20.00%> (+0.08%) ⬆️
.../pages/ExperimentDetails/ExperimentCheckpoints.tsx 14.17% <23.07%> (-0.25%) ⬇️
...t/src/pages/ExperimentDetails/ExperimentTrials.tsx 13.15% <9.09%> (-0.07%) ⬇️
webui/react/src/hooks/useFetchModels.tsx 31.42% <31.42%> (ø)

... and 317 files with indirect coverage changes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

@gt2345 gt2345 left a comment

Choose a reason for hiding this comment

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

I'm not sure about this approach, if we've done everything else correct, and fetchModels run twice, then adding a top-level variable makes sense

@keita-determined
Copy link
Contributor Author

keita-determined commented Jan 24, 2024

I'm not sure about this approach, if we've done everything else correct, and fetchModels run twice, then adding a top-level variable makes sense

i used this approach. i think the api is already called once or twice for each register/delete component, but there are several register/delete components in a checkpoint page. Thats why api is called several times ((1 or 2 api calls) * checkpoint counts in a page).

@keita-determined
Copy link
Contributor Author

im the wrong one probably. its not working right rn. let me investigate it more

@keita-determined
Copy link
Contributor Author

@gt2345 The original issue is that src/components/CheckpointModalTrigger.tsx calls model fetch, so if there are 100 checkpoints in a page, the api is called at least 100 times. I moved the fetching api logic into the top level component.

Copy link
Contributor

@gt2345 gt2345 left a comment

Choose a reason for hiding this comment

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

Works as expected.
Do you think we should put models in a store?

@keita-determined
Copy link
Contributor Author

Works as expected. Do you think we should put models in a store?

for now, i dont think so because the usage of model is not as much as others.

@keita-determined keita-determined changed the title fix: cease many model fetch api call in checkpoint tab fix: cease many model fetch api calls in checkpoint tab Jan 25, 2024
@keita-determined keita-determined merged commit f771acb into main Jan 25, 2024
74 of 85 checks passed
@keita-determined keita-determined deleted the fix/stop-many-api-call branch January 25, 2024 22:12
maxrussell pushed a commit that referenced this pull request Mar 21, 2024
* fix: cease many model fetch api call in checkpoint tab

* fix: move model fetch api into the top level component

* refactor: custom hook for models fetch

* chore: feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants