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 cell error instruction configurable #471

Merged
merged 14 commits into from
Nov 12, 2019

Conversation

aschlaep
Copy link
Member

@aschlaep aschlaep commented Nov 7, 2019

This adds a VoilaConfiguration option to allow customization of the debug instruction when there's a cell error. It may not always make sense to say "Please run Voila with --debug ...", for example when voila is run as a notebook/server extension. This'll allow people to supply their own instructions to the user for how to remediate potential bugs.

If anybody has any suggestions for a better name than cell_error_instruction, please let me know!

@SylvainCorlay
Copy link
Member

LGTM.

@SylvainCorlay
Copy link
Member

cc @maartenbreddels

@maartenbreddels
Copy link
Member

Good idea @aschlaep. I think however, the trait should go into VoilaExecutePreprocessor, does that make sense to you? If the strip_notebook_errors function is made into a method, it could directly access that property.

I'm happy to make those changes for you if you want.

@SylvainCorlay
Copy link
Member

@aschlaep could you push the changes that you just showed me so that I can try out the PR and the issue with default values.

@aschlaep
Copy link
Member Author

I added the default message in execute.py because the default value of the traitlet in configuration.py wasn't getting passed through for some reason...

Copy link
Member

@maartenbreddels maartenbreddels left a comment

Choose a reason for hiding this comment

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

Yes, this makes much more sense, and much cleaner. I left some suggestions to make it even simpler.

voila/execute.py Outdated
Comment on lines 218 to 220
instruction = 'Please run Voila with --debug to see the error message.'
if 'VoilaConfiguration' in self.config and 'cell_error_instruction' in self.config['VoilaConfiguration']:
instruction = self.config['VoilaConfiguration']['cell_error_instruction']
Copy link
Member

Choose a reason for hiding this comment

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

This can be removed.

voila/execute.py Outdated
if 'VoilaConfiguration' in self.config and 'cell_error_instruction' in self.config['VoilaConfiguration']:
instruction = self.config['VoilaConfiguration']['cell_error_instruction']

error_message = 'There was an error when executing cell [{}]. {}'.format(cell['execution_count'], instruction)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
error_message = 'There was an error when executing cell [{}]. {}'.format(cell['execution_count'], instruction)
error_message = 'There was an error when executing cell [{}]. {}'.format(cell['execution_count'], this.cell_error_instruction)

@maartenbreddels maartenbreddels merged commit 2654107 into voila-dashboards:master Nov 12, 2019
@maartenbreddels
Copy link
Member

Thanks @aschlaep !

maartenbreddels pushed a commit to maartenbreddels/voila that referenced this pull request Feb 5, 2020
* add cell error instruction configurable in VoilaExecutePreprocessor
maartenbreddels pushed a commit to maartenbreddels/voila that referenced this pull request Feb 5, 2020
* add cell error instruction configurable in VoilaExecutePreprocessor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants