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

Add refresh button to widgets UI #741

Merged

Conversation

ChristianZaccaria
Copy link
Collaborator

@ChristianZaccaria ChristianZaccaria commented Oct 25, 2024

Issue link

Jira: https://issues.redhat.com/browse/RHOAIENG-14057

What changes have been made

  • Added a refresh button to the UI:

    When the button is clicked, the DataFrame is refreshed. Refreshing the list of RayClusters, the spec, and the status of the RayClusters in the DataFrame.

    Additionally, when the button is clicked, the button is disabled until the K8s API request for the list of RayClusters has returned. - This usually takes around 1 second.

  • Removed redundant code. - Using self.namespace variable as opposed to retrieving the namespace from the dataframe.

  • Updated Sphinx docs.

  • Added UI e2e test case.

  • Small refactor to separate concerns.

Verification steps

  1. Checkout this PR and run poetry build to generate a new wheel.
  2. Install the wheel with pip install.
  3. Run through the widgets notebook.
  4. Create a RayCluster.
  5. Run view_clusters()
  6. Create a 2nd RayCluster.
  7. Click the button to refresh the DataFrame.

We can also test to refresh the DataFrame while the RayCluster has the status Failed. Once ready we can refresh the DataFrame to show current status, eventually being Ready.

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • Testing is not required for this change

@ChristianZaccaria ChristianZaccaria added the test-ui-notebooks Run PR check to verify UI notebooks label Oct 25, 2024
Copy link

codecov bot commented Oct 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@ec72303). Learn more about missing BASE report.
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #741   +/-   ##
=======================================
  Coverage        ?   94.12%           
=======================================
  Files           ?       36           
  Lines           ?     2417           
  Branches        ?        0           
=======================================
  Hits            ?     2275           
  Misses          ?      142           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Bobbins228
Copy link
Contributor

@ChristianZaccaria I thought that we were also going to add polling as well as the refresh button?

@ChristianZaccaria
Copy link
Collaborator Author

ChristianZaccaria commented Oct 25, 2024

@Bobbins228 I left a comment in the Jira summarizing the team discussion. TLDR: Option 0 and 1 are preferred.

  • Option 0 [For RayClusters]: offering a button used to refresh the list of RayClusters and its spec in the DataFrame, on demand without the need to be waiting *30 seconds to refresh the data (as done in Option 1). - Being more straightforward, practical, and faster/on-demand for the user.

  • Option 1 [For i.e., RayJobs and KFTO Jobs]: can be used in future to refresh data on Job statuses as they progress which include RayJobs, KFTO Jobs, etc. Eventhough we would be polling every *30 seconds, a single List API request would be made per kind of Job resource, and not per each Job, reducing the load on API requests made.

Although thinking about it, we could definitely alter option 0 to continue to refresh for 1min, then enable the refresh button again. WDYT? - It would be like having real-time data flowing for a minute on-demand, and not indefinitely.

I.e.,:

    def _on_refresh_data_button_click(self, b):
        """
        _on_refresh_button_click handles the event when the Refresh Data button is clicked, refreshing the list of Ray Clusters.
        """
        self.refresh_data_button.disabled = True
        start_time = time.time()
        while True:
            elapsed_time = time.time() - start_time
            if elapsed_time < 60:
                self._refresh_dataframe()
            else:
                break
        self.refresh_data_button.disabled = False

@Bobbins228
Copy link
Contributor

@ChristianZaccaria nevermind we should stick to our initial vote of option 0

@Bobbins228
Copy link
Contributor

/lgtm tested this out and works as intended

Copy link
Collaborator

@KPostOffice KPostOffice left a comment

Choose a reason for hiding this comment

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

/lgtm Tested and worked as expected

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Nov 1, 2024
@Bobbins228
Copy link
Contributor

@ChristianZaccaria can you rebase this when you get the chance and we can approve again?

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 4, 2024
@ChristianZaccaria
Copy link
Collaborator Author

Rebased

@Bobbins228
Copy link
Contributor

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 4, 2024
Copy link
Contributor

openshift-ci bot commented Nov 4, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Bobbins228, KPostOffice

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:
  • OWNERS [Bobbins228,KPostOffice]

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

@openshift-merge-bot openshift-merge-bot bot merged commit a5a229c into project-codeflare:main Nov 4, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. test-ui-notebooks Run PR check to verify UI notebooks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants