Skip to content

Commit

Permalink
Adds tutorial.quick_restore option
Browse files Browse the repository at this point in the history
Or TUTORIAL_QUICK_RESTORE env variable

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

Fixes rstudio#508
  • Loading branch information
gadenbuie committed Mar 30, 2021
1 parent 3d93f7f commit a7f9ee0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions R/exercise.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ setup_exercise_handler <- function(exercise_rx, session) {
# short circuit for restore (we restore some outputs like errors so that
# they are not re-executed when bringing the tutorial back up)
if (exercise$restore) {
if (
getOption(
"tutorial.quick_restore",
identical(Sys.getenv("TUTORIAL_QUICK_RESTORE", "0"), "1")
)
) {
# don't evaluate at all if quick_restore is enabled
rv$result <- list()
return()
}

object <- get_exercise_submission(session = session, label = exercise$label)
if (!is.null(object) && !is.null(object$data$output)) {

Expand Down

0 comments on commit a7f9ee0

Please sign in to comment.