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

Disable rerun of code execution at application start-up #508

Closed
mstackhouse opened this issue Mar 30, 2021 · 9 comments · Fixed by #509
Closed

Disable rerun of code execution at application start-up #508

mstackhouse opened this issue Mar 30, 2021 · 9 comments · Fixed by #509

Comments

@mstackhouse
Copy link

My team has searched around to see if this is possible, but we don't think it is.

Currently, when you open a learnr application, each of the exercise blocks executes to restore the results from the last session. When a learnr application gets larger, this can become quite intensive - particularly if the application will be used in a larger environment with a shared external evaluator, and in turn cause exercise chunks to hang while waiting for others' code to finish.

An ideal scenario would be to restore the code executed to the exercise chunk, but not rerun the exercise itself.

gadenbuie added a commit to gadenbuie/learnr that referenced this issue Mar 30, 2021
Or TUTORIAL_QUICK_RESTORE env variable

Short-circuit complete evaluation of user code on restore for large tutorials.

Fixes rstudio#508
@gadenbuie
Copy link
Member

I added a tutorial.quick_restore global option (also settable via the env var TUTORIAL_QUICK_RESTORE) that modifies the restore behavior when TRUE (or 1 for the env var). When enabled, the last submission code is restored to the exercise, but that code is not evaluated. This speeds up restore considerable, especially if any of those exercises take considerable time to evaluate.

A side-effect of the current implementation of the quick restore method is that stored previous exercise output isn't restored. Users will have to click Run Code or Submit Answer to explicitly see the exercise output. I have another version of this same feature in a branch at gadenbuie/learnr@quick-restore-2 that will use the stored output (if any).

Where and how previous output is stored depends on your setup. @mstackhouse, Would you be able to test the quick-restore-2 version and see if that also works in your case? It'd be nice to be able to restore previous feedback, if its available and if that doesn't add too much overhead at tutorial load.

@mstackhouse
Copy link
Author

@gadenbuie Sure! We'd be happy to!

I do want to confirm that tutorial.quick_restore works - we've tested that implementation out already when you pushed yesterday.

@elimillera
Copy link

Hey @gadenbuie, Thanks for the update! Can you give a short reprex I can test this with? I'm not sure in what cases the output is stored but we are currently using the default tutorial storage option.

@yassinza
Copy link

Hi @gadenbuie, we are building some large tutorials, and quick_restore, where the output is saved, would be great to have!
Anything I can help with here to being this back to life? Thank!

@gadenbuie
Copy link
Member

Good news @yassinza, the quick restore feature was released! Check out #509 for details.

@yassinza
Copy link

Thanks @gadenbuie! We are using this one already, but we were wondering about the quick-restore-2 you mentioned above. Do you have plans to make that available? I think it is a great feature to have for large tutorials like the ones we are building. Thanks a lot for the package btw, it is amazing!

@gadenbuie
Copy link
Member

Hi @yassinza, I rebased the quick-restore-2 branch onto the latest version of learnr and I added support for both options in a draft PR #794. You can try it out using either of the following options:

remotes::install_github("gadenbuie/learnr@quick-restore-2")

remotes::install_github("rstudio/learnr#794")

Let me know how it goes!

@yassinza
Copy link

Hi @gadenbuie, thanks for the quick response!
I tested it, and it works as expected. The only thing missing is the Submit Answer feedback, if any. If that's easy to add, that would be great; if not, this is already super awesome. Thanks!

@gadenbuie
Copy link
Member

I tested it, and it works as expected. The only thing missing is the Submit Answer feedback, if any.

@yassinza Unfortunately, this isn't something that we currently save in the tutorial storage.

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 a pull request may close this issue.

4 participants