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

Warnings with DBI_0.5-1 #124

Open
cfhammill opened this issue Dec 19, 2016 · 5 comments
Open

Warnings with DBI_0.5-1 #124

cfhammill opened this issue Dec 19, 2016 · 5 comments

Comments

@cfhammill
Copy link

cfhammill commented Dec 19, 2016

Looks like the new version of DBI is causing warnings with BatchJobs. I'm not sure the exact
origin of the warning, it's buried in some of my code that uses createRegistry, batchMap, batchSubmit, waitForJobs, killJobs, and removeRegistry. If it's not immediately obvious
I can dig for the root.

2. Test sequential, multicore, and queue applies work (@test_qminc.R#28) - RSQLite::dbGetPreparedQuery() is deprecated, please switch to DBI::dbGetQuery(params = bind.data).

3. Test sequential, multicore, and queue applies work (@test_qminc.R#28) - Named parameters not used in query: fun_id, pars, jobname
@HenrikBengtsson
Copy link
Contributor

If these are truly warnings, you can turn them into errors with

options(warn=2)

Then if you rerun your code, the code should give an error and using traceback() should point to where the warning (now error) occurs.

Using options(warn=1) will force warnings to be outputted as they occur (and not at the end as with the default options(warn=0)).

@cfhammill
Copy link
Author

Thanks Henrik, I didn't going hunting yet because they happened in my test-bed. I'll isolate the failing tests and report back.

@cfhammill
Copy link
Author

cfhammill commented Dec 19, 2016

First traceback:

7: stop(obj)
6: stopf("Error in dbAddData: %s", as.character(ok))
5: dbAddData(reg, "job_def", data = data.frame(fun_id = fun.id, 
       pars = pars, jobname = jobname))
4: batchMap(registry, mcMincApply, mask_vals = mask_indices, more.args = mincApplyArguments)
3: qMincMap(qMinc_registry, filenames, fun = match.fun(fun), ..., 
       slab_sizes = slab_sizes, batches = batches, cores = cores, 
       mask = mask, tinyMask = tinyMask, temp_dir = temp_dir, resources = resources)
2: qMincApply(gf$jacobians_fixed_2, mean, slab_sizes = c(5, 1, 10))
1: verboseRun(qMincApply(gf$jacobians_fixed_2, mean, slab_sizes = c(5, 
       1, 10)), getOption("verbose"))

Looks like that explains the second of the two errors above

@HenrikBengtsson
Copy link
Contributor

I can reproduce the warning with BatchJobs 1.6;

$ library("BatchJobs")
$ reg <- makeRegistry(id = "test")
Creating dir: /home/hb/repositories/others/BatchJobs/test-files
Saving registry: /home/hb/repositories/others/BatchJobs/test-files/registry.RData

$ batchMap(reg, function(x) x^2, 1:3)
Adding 3 jobs to DB.
Warning messages:
1: RSQLite::dbGetPreparedQuery() is deprecated, please switch to DBI::dbGetQuery(params = bind.data). 
2: Named parameters not used in query: fun_id, pars, jobname 
3: Named parameters not used in query: job_def_id, seed 

$ submitJobs(reg)
Saving conf: /home/hb/repositories/others/BatchJobs/test-files/conf.RData
Submitting 3 chunks / 3 jobs.
Cluster functions: Interactive.
Auto-mailer settings: start=none, done=none, error=none.
Writing 3 R scripts...
SubmitJobs |+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++| 100% (00:00:00)
Sending 3 submit messages...
Might take some time, do not interrupt this!

$ res <- loadResults(reg)
Syncing registry ...

$ str(res)
List of 3
 $ 1: num 1
 $ 2: num 4
 $ 3: num 9

It's only a warning for now, so things should keep working as expected for a bit longer. However, as soon as RSQLite::dbGetPreparedQuery() becomes defunct, then BatchJobs 1.6 will stop working. BatchJobs 1.6 is what is on CRAN. However, on https://github.com/tudo-r/BatchJobs/ there has been several updates since that version and among those it looks like this particular issue has been addressed. You can install the GitHub version using:

source("http://callr.org/install#tudo-r/BatchJobs")

This will show

> packageVersion("BatchJobs")
[1] '1.7'

but note that version 1.7 has not been fixed (i.e. there might be more updates later and they'll also be labelled 1.7).

I guess the long term solution is to migrate to batchtools, but personally I wouldn't mind having a BatchJobs 1.7 submitted to CRAN, because I can imagine there's lots of code / users out there that rely on it.

/Henrik
(I'm listed as a BatchJobs author, but only because I contributed different things over time.)

Session information

sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.1 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] checkmate_1.8.2 BatchJobs_1.6   BBmisc_1.10    

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.8      parr_3.3.0       memuse_3.0-1     clisymbols_1.0.0 prompt_1.0.0     digest_0.6.10.2 
 [7] crayon_1.3.2     MASS_7.3-45      DBI_0.5-1        backports_1.0.4  magrittr_1.5     signal_0.7-6    
[13] RSQLite_1.1-1    stringi_1.1.2    brew_1.0-6       tools_3.3.2      stringr_1.1.0    tuneR_1.3.1     
[19] sendmailR_1.2-1  parallel_3.3.2   base64enc_0.1-4  memoise_1.0.0    fail_1.3        

@cfhammill
Copy link
Author

Amazing, thanks Henrik. Our package depends on CRAN BatchJobs, so I'll ignore the warnings in anticipation of 1.7's release.

Cheers,

Chris

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

No branches or pull requests

2 participants