rstudio / learnr

Interactive Tutorials with R Markdown
https://pkgs.rstudio.com/learnr
Apache License 2.0
710 stars 239 forks source link

Add second level of quick restore that can pull from tutorial storage if available #794

Closed gadenbuie closed 1 year ago

gadenbuie commented 1 year ago

This adds a second level of "quick restore" that will restore the exercise output from tutorial storage, if available, but will otherwise avoid re-evaluating submitted exercise code when starting up a tutorial.

Ideally, this increases start up time while also finding a balance of restoring saved output, if possible.

This can be set via ~/.Renviron

# Quick restore level 1 (fast as possible)
TUTORIAL_QUICK_RESTORE=1

# Quick restore level 2 (middle ground)
TUTORIAL_QUICK_RESTORE=2

or via ~/.Rprofile or in the R process:

# Quick restore level 1 (fast as possible)
Sys.setenv("TUTORIAL_QUICK_RESTORE" = "1")
options("tutorial.quick_restore" = TRUE)
options("tutorial.quick_restore" = "1")

# Quick restore level 2 (middle ground)
Sys.setenv("TUTORIAL_QUICK_RESTORE" = "2")
options("tutorial.quick_restore" = "2")

# Disable quick restore (default)
Sys.setenv("TUTORIAL_QUICK_RESTORE" = "0")
options("tutorial.quick_restore" = FALSE)
options("tutorial.quick_restore" = "0")