ropensci / drake

An R-focused pipeline toolkit for reproducibility and high-performance computing
https://docs.ropensci.org/drake
GNU General Public License v3.0
1.34k stars 128 forks source link

Error: key 'drake_version' ('session') not found #1355

Closed SimonKurmann closed 3 years ago

SimonKurmann commented 3 years ago

Hi

I enjoy working with drake -- thanks for this awesome package! But now, after a hiatus, I get weird errors when I try to make a new drake plan.

I'm using drake with R 4.0.3 and RStudion on Windows 10. Since 14.01.2021 (first use of drake since october 2020, just updated to R 4.0.3 from 4.0.2), I get the error in the issue title when I define a new plan and try to make it.

An empty plan does not cause the error.

This plan already causes the error: the_plan <- drake_plan( test = mean(1:9) )

.Last.error outputs:

<callr_status_error: callr subprocess failed: key 'drake_version' ('session') not found> --> <callr_remote_error: key 'drake_version' ('session') not found> in process 11856

.Last.error.trace outputs:

Stack trace:

Process 13980:

  1. (function (r_args = list()) ...
  2. drake:::r_make(r_args = r_args)
  3. drake:::r_drake(source, drake::make_impl, list(), r_fn, r_args)
  4. base:::do.call(r_fn, r_args)
  5. (function (func, args = list(), libpath = .libPaths(), repos = default_repos(), ...
  6. callr:::get_result(output = out, options)
  7. throw(newerr, parent = remerr[[2]])

    x callr subprocess failed: key 'drake_version' ('session') not found

    Process 17368:

  8. (function (source, d_fn, d_args) ...
  9. base:::source(source)
  10. base:::withVisible(eval(ei, envir))
  11. base:::eval(ei, envir)
  12. base:::eval(ei, envir)
  13. drake:::drake_config(the_plan, lock_envir = FALSE)
  14. drake::drake_cache()
  15. drake:::thiscache(path = path)
  16. drake:::cache_vers_warn(cache = cache)
  17. drake:::cache_vers_check(cache)
  18. drake:::drake_cache_version(cache = cache)
  19. cache$get(key = "drake_version", namespace = "session")
  20. drake:::dcst_get(key = key, ..., .self = .self)
  21. .self$storr$get(key = key, ...)
  22. self$get_value(self$get_hash(key, namespace), use_cache)
  23. storr:::exists0(hash, envir)
  24. storr:::vlapply(name, exists, envir = envir, inherits = FALSE, ...
  25. base:::vapply(X, FUN, logical(1), ...)
  26. self$get_hash(key, namespace)
  27. base:::tryCatch(self$driver$get_hash(key, namespace), error = function(e) stop(KeyError(key, ...
  28. base:::tryCatchList(expr, classes, parentenv, handlers)
  29. base:::tryCatchOne(expr, names, parentenv, handlers[[1L]])
  30. value[3L]
  31. base:::stop(KeyError(key, namespace))
  32. (function (e) ...

    x key 'drake_version' ('session') not found

The .drake folder looks as follows: .drake | config | data | drake | keys .........| memoize ......... | meta .........| objects ......... | progress .........| session .................. | drake_version .................. | seed .................. | sessioninfo | scratch | .gitignore

The file drake_version contains:

0c046ff7dd7f396d

The error does not occur if I try to make an old plan (from last october). Also, at my coworkers' PCs, the error does not occur (neither with R 4.0.2 nor R 4.0.3).

I already removed and reinstalled R, RStudio and all required packages to no avail.

I would much appreciate a solution to this error.

wlandau commented 3 years ago

Sorry about the headache on your end. I think the error should go away if you remove .drake/data/0c046ff7dd7f396d.rds and all of .drake/keys/session/.

targets, the long-term successor to drake, has a more robust storage system that should prevent these issues in the future.

SimonKurmann commented 3 years ago

Hello Will

Thanks for your reply. I tried as you suggested and get a new error: Error : key 'ee572f112f513393' ('memoize') not found

Said file exists in memorize.

Would you recommend using targets, then? If so, this would be a good time for me to switch. (I'm going to read the respective chapter in the targets manual now.)

wlandau commented 3 years ago

Thanks for your reply. I tried as you suggested and get a new error: Error : key 'ee572f112f513393' ('memoize') not found

You could try deleting all of .drake/keys/memoize/, but at this point more errors might come up. Unfortunately you may have to restart the project with a new cache.

Would you recommend using targets, then? If so, this would be a good time for me to switch. (I'm going to read the respective chapter in the targets manual now.)

If you can, I do recommend switching. If you know drake, you already almost know targets.

SimonKurmann commented 3 years ago

Thanks again, Will. I started reading the targets docs and will use it in the upcoming project.

Also, thanks for your awesome packages!