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

Improve performance of showing partial Pipelines and runs #1452

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

uidoyen
Copy link
Contributor

@uidoyen uidoyen commented Jun 30, 2023

Closes #1248

Description

Improve performance of showing partial Pipelines / associated Pipeline Runs by enabling pagination and limit the items. Also sort the pipelines and runs by created_at.

How Has This Been Tested?

Test Impact

Project Pipelines & Project Pipelines' Runs

  • Created few sample pipelines and runs
  • Go to DS Project -> select project -> Pipelines -> expand pipeline which contains the runs
Screenshot 2023-07-10 at 8 42 49 PM

Global Pipelines:

Screenshot 2023-07-10 at 11 16 59 PM

Global Pipeline scheduled runs:

Screenshot 2023-07-10 at 11 17 58 PM

Global Pipeline triggered runs(zoomed out):
Screenshot 2023-07-10 at 11 19 10 PM

Request review criteria:

  • The commits have meaningful messages (squashes happen on merge by the bot).
  • Included any necessary screenshots or gifs if it was a UI change.
  • Included tags to the UX team if it was a UI/UX change.
  • Testing instructions have been added in the PR body (for PRs involving changes that are not immediately obvious).
  • The developer has manually tested the changes and verified that the changes work
  • The developer has added tests or explained why testing cannot be added (unit tests & storybook for related changes)

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 30, 2023

Hi @uidoyen. Thanks for your PR.

I'm waiting for a opendatahub-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added the needs-ok-to-test The openshift bot needs to label PRs from non members to avoid strain on the CI label Jun 30, 2023
@manaswinidas
Copy link
Contributor

@uidoyen I think there is linting error, can you fix it?

@manaswinidas
Copy link
Contributor

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test The openshift bot needs `ok-to-test` to allow non member PRs to run the tests. and removed needs-ok-to-test The openshift bot needs to label PRs from non members to avoid strain on the CI labels Jul 4, 2023
Copy link
Contributor

@lucferbux lucferbux left a comment

Choose a reason for hiding this comment

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

I think you are missing the point of the change.
The issue describes that we need to filter the pipelines k8s call but I think part of the goal of this issue is to improve performance by not fetching all the calls right?

frontend/src/utilities/sortByCreatedAt.ts Outdated Show resolved Hide resolved
frontend/src/utilities/sortByCreatedAt.ts Outdated Show resolved Hide resolved
@lucferbux
Copy link
Contributor

@uidoyen Can you rebase to get latest changes, there's a bug fix for an issue present in this PR (was in our codebase before)

Copy link
Member

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

There are three views here:

  • Projects Pipelines
  • Global Pipelines
  • Global Runs (scheduled and triggered)

There are two types of changes needed:

  • Project Pipelines needs to limit to "5" because we fetching 20 has no value since we only want to show 5
  • Project Pipelines & Global Pipelines show the last 5 runs inside the expanded section -- but fetch 20 and truncate client side

So we need to handle this truncation via API on the Project Pipelines for Pipelines & Runs. Global Pipelines we need to truncate via API for the expanded row's runs. Global Runs does not need to be changed for this issue.

We want to improve our fetching so we can get the "latest" from the API without having to fetch 15 more than we need. We can fetch 6 instead of 5 that we show if that's the easiest way to show the related "show more" links that take you to the Global Pipelines or Global Runs page (depending on what link you click on).

This effort is to just limit fetching in some cases for some resources. We want our Global pages to show as much as it can for that given type.

Hope this all makes sense, let me know if you have any questions.

@andrewballantyne
Copy link
Member

@uidoyen Can you fix up your screenshots in your description?

Copy link
Member

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

Couple notes

frontend/src/const.ts Outdated Show resolved Hide resolved
Copy link
Member

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

Looks good code-wise and screenshot wise -- I have not tested it.

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Jul 10, 2023
@uidoyen
Copy link
Contributor Author

uidoyen commented Jul 11, 2023

@pnaik1 @manaswinidas Can you guys test it please?

@pnaik1
Copy link
Contributor

pnaik1 commented Jul 11, 2023

Okay @uidoyen

@pnaik1
Copy link
Contributor

pnaik1 commented Jul 11, 2023

/lgtm
but the tests are failing

@lucferbux
Copy link
Contributor

Im gonna trigger again the checks and review it. Let's see if this time it doesn't fail

@lucferbux
Copy link
Contributor

Code looks great, requests have the query params that we wanted, I only have a nit, but I think is fine as it is right now.

Screenshot 2023-07-11 at 17 53 10

As you can see in the response, the request return the total runs that you have, so LIMIT_MAX_ITEM_COUNT is not needed to show expanded, it can be achieved just fetching 5 and then checking if total_size is greater than TABLE_CONTENT_LIMIT.

I can imagine we haven't implemented this since total_size is optional and it might be missing in some scenarios right?

@lucferbux
Copy link
Contributor

But im gonna approve it anyways cause code looks great.

Copy link
Contributor

@lucferbux lucferbux left a comment

Choose a reason for hiding this comment

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

/lgtm

@lucferbux
Copy link
Contributor

I'm sorry @uidoyen I think you need to rebase interactively your PR to squash all the commits beforehand, we need to do this for ever pr for now own, please do that before merging

@pnaik1
Copy link
Contributor

pnaik1 commented Jul 13, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Jul 13, 2023
Copy link
Contributor

@manaswinidas manaswinidas left a comment

Choose a reason for hiding this comment

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

The changes work fine for me.

/lgtm

Copy link
Member

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

/approve

I'm going to add the approval label because the code works. But we should clean up the implementation so it's accurately representing the component in question -- see my comment below.

Get any review from anyone else after you adjust the prop stuff. No need to wait on me unless you feel there are more questions.

data={pipelines}
enablePagination
{...tableProps}
Copy link
Member

Choose a reason for hiding this comment

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

Two things here...

First, spreads usually are always first unless you're looking to have "defaults" that are overridden by the spread values.

<Component
  // defaults -- usually not done in most cases
  {...data} // other values that are not likely in here, or optionals for overriding defaults
  // explicit values -- will override anything passed in `data`
/>

We want to make sure nothing that we "want" is before a spread -- it will override that state.

Second, enablePagination here is also not ideal -- this table is shared by two callers:

  • Global Pipelines
  • Project Pipelines

Global Pipelines wants to be enabled, and is if you look at PipelinesView

Project Pipelines does not want to paginate -- since we are truncating the values to less than the default page limit, it won't ever trigger, but this is not great.

Changes needed

  • Please remove the enablePagination from this shared component, let the spread handle that if the caller wants it.
  • Move spread back to the top, there is no need to try and override these values (data & enablePagination -- which you are removing)

@openshift-ci openshift-ci bot added the lgtm label Jul 14, 2023
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 14, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewballantyne, lucferbux, manaswinidas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 225ba23 into opendatahub-io:main Jul 14, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test The openshift bot needs `ok-to-test` to allow non member PRs to run the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Improve performance of showing partial Pipelines / associated Pipeline Runs
6 participants