mllg / batchtools

Tools for computation on batch systems
https://mllg.github.io/batchtools/
GNU Lesser General Public License v3.0
172 stars 51 forks source link

Adding wrong "source" path breaks registry irrecoverably #122

Closed adibender closed 7 years ago

adibender commented 7 years ago

When I have a registry and I want to add a file to source retrospectively, the only way I see at the moment is

reg$source <- c(reg$source, "incorrect/path/file.R")
saveRegistry()

However, if the file or path provided does not exist, reloading the registry (after restarting R session), throws error and non of the registry functions will work

Error in sys.source(fn, envir = .GlobalEnv) : 
  'incorrect/path/file.R' is not an existing file

This is problematic especially when the registry already contains a lot of jobs.

I don't see a way to fix this, except to maybe create the "incorrect" path/file on the file system -> load the registry -> correct path

Maybe worth adding sth like

addSource <- function(src, reg=getDefaultRegistry())  {
  assertFileExists(src)
  reg$source <- c(reg$source, src)
}

would be appropriate?

mllg commented 7 years ago

Should be fixed now. On the master you now get a warning if any dependency is not satisfied so that you can fix it yourself. On the master and with testJob() this still raises an exception.