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

[ExecuteTime] A way to clear timing results is needed #1021

Closed
wstomv opened this issue Jul 18, 2017 · 6 comments
Closed

[ExecuteTime] A way to clear timing results is needed #1021

wstomv opened this issue Jul 18, 2017 · 6 comments

Comments

@wstomv
Copy link

wstomv commented Jul 18, 2017

This issue concerns the ExecuteTime extension.

Currently, there seems to be no way to clear selected or all timing results. You can only hide them.

Sometimes (e.g., when giving a presentation), you do want to see the timings, but you want to start with a clean slate (and not show timing results of an earlier run).

It seems reasonable that restarting the kernel clears the timing results.

If that is not possible or not desirable, then an extra menu item would be welcome.

Of course, it is possible to achieve this clearing with an external script, but that seems unnecessarily cumbersome.

@jcb91
Copy link
Member

jcb91 commented Jul 18, 2017

Yes, this sounds like a good idea, and easy to achieve. For me, I think i wouldn't want timings cleared, but it's equally easy to make this a configurable behaviour, so I can add that too, I should think. Feel free to make a PR if you've time/inclination, otherwise I'll get around to it when I have a chance :)

@wstomv
Copy link
Author

wstomv commented Jul 19, 2017

@jcb91 I won't have time to dive into the internals of ExecuteTime and solve this myself anytime soon. Any kind of solution would be appreciated, since I will be using Jupyter notebooks in a number of screencasts that I am preparing, and I would like to start each screencast with a truly empty notebook.

The ability to clear timing results is also useful when you are handing out a notebook to students for doing some homework exercises. Any timing results left over from previous runs that you did yourself are noise (or plain giveaways as to the expected efficiency).

Currently, I use a script that I wrote to delete all metadata for a given key. But that is somewhat cumbersome.

@jcb91 jcb91 changed the title A way to clear timing results is needed [ExecuteTime] A way to clear timing results is needed Jul 19, 2017
@wstomv
Copy link
Author

wstomv commented Jul 19, 2017

By the way, here is another reason for wanting to clear timing results.

When you keep your notebooks in a repository (for configuration management, e.g. using Git),
it is good practice to clear all outputs before committing changes to a notebook.

Reason: Changes in the notebook may cause changes in the output, and those output changes would pollute diffs.

When execution timings are committed as well, you still get noise in your diffs, since these timings change with each rerun.

That is also why it would be convenient to have the ability to clear timing results along with removal of output. For instance, when you do Kernel > Restart & Clear Output.

@jcb91
Copy link
Member

jcb91 commented Jul 19, 2017

Oh sure, there's definitely reasons for doing it! I've added menu items ok, I think. My plan to now has been to give a configurable option along the lines of "clear timings on kernel restart", which will automatically apply. Would you prefer to add another option to the kernel menu (eg. Kernel > Restart & Clear Output & Timings, or another configurable setting to make the nbextension clear timings when choosing the existing Kernel > Restart & Clear Output?

@wstomv
Copy link
Author

wstomv commented Jul 19, 2017 via email

@jcb91
Copy link
Member

jcb91 commented Jul 19, 2017

Ok, I've made a stab at a PR which provides both menu items to clear selected/all cells' timing data, and configurable options to also clear all cells' data on kenrel restart, or clear any cell's data when its outputs are cleared (which would cover use of Kernel > Restart & Clear Output & Timings). If you could let me know if/when you get a chance to try it, that'd be fab 😁

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

No branches or pull requests

2 participants