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

Auto-refreshes the run details page #722

Merged
merged 3 commits into from
Jan 24, 2019

Conversation

rileyjbauer
Copy link
Contributor

@rileyjbauer rileyjbauer commented Jan 22, 2019

Auto-refresh is paused when the window loses focus (blur) and is resumed
upon re-focus. Autorefresh is permanently terminated if the run has
stopped due to failure, error, being skipped, or succeeding.


This change is Reviewable

Auto-refresh is paused when the window loses focus (blur) and is resumed
upon re-focus. Autorefresh is permanently terminated if the run has
stopped due to failure, error, being skipped, or succeeding.
@rileyjbauer
Copy link
Contributor Author

Fixes: #683

@rileyjbauer
Copy link
Contributor Author

/test kubeflow-pipeline-build-image

Copy link
Contributor

@yebrahim yebrahim left a comment

Choose a reason for hiding this comment

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

LGTM overall, just a few minor comments.

expect(setInterval).toHaveBeenCalledTimes(2);
});

it('does not resume auto refreshing if window loses focus and then regains it but run is finished', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice test!

Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to test the refresh method getting/not getting called rather than just checking setInterval and clearInterval? We're testing the implementation at this point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think you're wrong; the interval is just a thing to make sure it refreshes, but refresh is imprecise as it can be called elsewhere, and testing it involves fake timers.

Sort of a side-note, I was previously calling refresh() on focus even if the run had completed to avoid having the slightly more complex code below, although it's technically more correct since it cuts out unnecessary refreshes.

What do you think?

private async _startAutoRefresh(): Promise<void> {
  // If the run was not finished last time we checked, check again in case anything changed
  // before proceeding to set auto-refresh interval
  if (!this.state.runFinished) {
    // refresh() updates runFinished's value
    await this.refresh();
  }

  // Only set interval if run has not finished, and verify that the interval is undefined to
  // avoid setting multiple intervals
  if (!this.state.runFinished && this._interval === undefined) {
    this._interval = setInterval(
      () => this.refresh(),
      this.AUTO_REFRESH_INTERVAL
    );
  }
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I think both ways are fine.

frontend/src/pages/RunDetails.tsx Show resolved Hide resolved
frontend/src/pages/RunDetails.tsx Outdated Show resolved Hide resolved
frontend/src/pages/RunDetails.tsx Outdated Show resolved Hide resolved
frontend/src/pages/RunDetails.tsx Outdated Show resolved Hide resolved
frontend/src/pages/Status.test.tsx Outdated Show resolved Hide resolved
@rileyjbauer
Copy link
Contributor Author

/test kubeflow-pipeline-build-image

Copy link
Contributor

@yebrahim yebrahim left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

expect(setInterval).toHaveBeenCalledTimes(2);
});

it('does not resume auto refreshing if window loses focus and then regains it but run is finished', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think both ways are fine.

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yebrahim

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

@k8s-ci-robot k8s-ci-robot merged commit 5beffef into kubeflow:master Jan 24, 2019
@k8s-ci-robot
Copy link
Contributor

@rileyjbauer: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
kubeflow-pipeline-build-image 77d3a73 link /test kubeflow-pipeline-build-image

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@rileyjbauer rileyjbauer deleted the autorefresh-run-details branch May 6, 2019 22:17
Linchin pushed a commit to Linchin/pipelines that referenced this pull request Apr 11, 2023
* artifacts-gcs on the image build step needs to match the run-notebook
  step
HumairAK pushed a commit to red-hat-data-services/data-science-pipelines that referenced this pull request Mar 11, 2024
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