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

Can the notebooks "run number" not flicker on run? #150924

Closed
Tyriar opened this issue May 31, 2022 · 10 comments · Fixed by #155357
Closed

Can the notebooks "run number" not flicker on run? #150924

Tyriar opened this issue May 31, 2022 · 10 comments · Fixed by #155357
Assignees
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders notebook-execution Issues related to running cells in a notebook verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@Tyriar
Copy link
Member

Tyriar commented May 31, 2022

Testing microsoft/vscode-jupyter#10170

A lot of flickering goes on when executing a cell, can the number in [] not get its text cleared and instead go from [5] to [6] for example to minimize flickering?

Recording 2022-05-31 at 15 39 49

@rebornix rebornix added bug Issue identified by VS Code Team member as probable bug notebook-execution Issues related to running cells in a notebook labels Jun 27, 2022
@rebornix rebornix removed their assignment Jun 27, 2022
@rebornix rebornix removed their assignment Jun 27, 2022
@roblourens
Copy link
Member

We clear the execution order when execution starts, and jupyter itself does not provide the new execution order until slightly after execution starts. All I can think of is doing something on the rendering side, like wait a bit to render a cleared execution order?

@roblourens roblourens added this to the Backlog milestone Jun 28, 2022
@roblourens roblourens added notebook-polish and removed bug Issue identified by VS Code Team member as probable bug labels Jun 28, 2022
@sangnguyen696969
Copy link

``

@rebornix
Copy link
Member

rebornix commented Jun 28, 2022

Found it annoying while testing microsoft/vscode-jupyter#10598. Not that in the video, I was dragging an ipywidgets slider, which somehow is updating execution status. Though it didn't really increment the execution count, it kept flickering.

Screen.Recording.2022-06-28.at.10.34.30.AM.mov

It's also annoying to see the spinner. Bump it to July as I found this UX a bit unpleasant.

@rebornix rebornix modified the milestones: Backlog, July 2022 Jun 28, 2022
@roblourens
Copy link
Member

roblourens commented Jun 28, 2022

I wonder if that is related to creating a fake execution to update an output. Should be possible to do that atomically but I can check

@roblourens
Copy link
Member

To summarize since this goes on the plan, two related issues:

  • Blinking when doing normal execution due to updating the execution count async
  • Blinking and showing running state when updating outputs with the "fake" execution object. I'm not sure what we will be able to do about the running state - we even have code that specifically ensures that if the cell enters the running state, it should show the running indicator for some minimum amount of time

roblourens added a commit that referenced this issue Jul 16, 2022
Same for the timer.
Also fix spinner delay logic to correctly implement showing for a minimum time.
Fixes #150924
@roblourens
Copy link
Member

roblourens commented Jul 18, 2022

So far I have

  • Fixed an issue with the extension using temp executions unnecessarily, so for the original report it doesn't blink anymore
  • Fixed some unnecessary blinking for normal executions

However, it's hard to avoid this for actual fake executions, because since this is a workaround for our API, it's not really clear how to detect this and treat them differently.

We've said that we want an execution to show the progress spinner for a minimum time, 500ms, so that you can definitely tell in the UI that an execution happened, even if it is very fast. So then even if an execution is created and completed within the same js task, we will still show the progress spinner. This is good for fast normal executions and not good for "fake" executions.

We could say that an execution that is completed immediately does not get the spinner at all, but I don't like that because it could hurt some simple kernel that doesn't need to do any async work as part of an execution. So I'm very open to ideas on how to improve this.

@roblourens
Copy link
Member

For future reference, here is a snippet that does a "fake" execution to update outputs outside of an execution.

from ipywidgets import interact, interactive, fixed, interact_manual, widgets

caption = widgets.Label(value='The values of slider is : ')
slider = widgets.IntSlider(min=-5, max=5, value=0, description='Slider')

def handle_slider_change(change):
    print(change)
    caption.value = 'The values of slider is : ' + str(change.new)

slider.observe(handle_slider_change, names='value')

display(caption, slider)

@roblourens
Copy link
Member

Interesting, I hadn't realize this - print in the snippet above in vscode adds outputs to the cell. In Jupyter lab, it actually writes to a different log instead of adding outputs to the cell.

To understand this usecase I'm looking for an example that updates the output in jupyter lab outside of an execution - I remember there was one which I think involved subprocess, but I can't find an example anywhere. Wondering whether you have one handy @DonJayamanne

roblourens added a commit that referenced this issue Jul 19, 2022
Don't clear execution order immediately when execution starts.
Same for the timer.
Also fix spinner delay logic to correctly implement showing for a minimum time.
Fixes #150924
@vscodenpa vscodenpa added the unreleased Patch has not yet been released in VS Code Insiders label Jul 19, 2022
@vscodenpa vscodenpa added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jul 20, 2022
@roblourens
Copy link
Member

Verification steps:

  • No flickering of the execution order or timer in a normal execution of a cell in a Jupyter notebook
  • No flickering when changing the slider with this code:
from ipywidgets import interact

def func1(x):
    return 5*x
interact(func1, x=10);
  • Some other ipywidget scenarios will still produce flickering from "fake executions", this is probably not solvable without API changes. Discovered that it's actually not working as expected in some other cases and so it could get more investigation later.

@roblourens roblourens added verification-needed Verification of issue is requested feature-request Request for new features or functionality labels Jul 21, 2022
@DonJayamanne
Copy link
Contributor

Verified

@DonJayamanne DonJayamanne added the verified Verification succeeded label Jul 27, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality insiders-released Patch has been released in VS Code Insiders notebook-execution Issues related to running cells in a notebook verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants