Hello. I'm having an error with using the GitHub actions R-CMD-check on this package: Workflow runs · INCEPTdk/adaptr · GitHub
It only occurs on Windows-latest (release) - not on other platforms, not locally on my Windows computer, not when using devtools::check_win_release(), and not on the CRAN Servers.
The error is seemed to be caused by this vignette (adaptr/vignettes/Overview.Rmd at main · INCEPTdk/adaptr · GitHub), which now includes parallel computation, which I think may be the reason.
In short, the Vignette calls setup_cluster(2)
(adaptr/R/setup_cluster.R at main · INCEPTdk/adaptr · GitHub), using the parallel
package to set up a cluster of two workers (2 intentionally used, as CRAN does not allow more, so this is also used in the tests in the package etc). The package later calls this function: calibrate_trial (adaptr/R/calibrate_trial.R at main · INCEPTdk/adaptr · GitHub), which calls run_trials (adaptr/R/run_trials.R at main · INCEPTdk/adaptr · GitHub). In this script, the main function calls the function dispatch_trial_runs(), which creates a temporary function (run_trial_seeds) that calls the run_trial-function (adaptr/R/run_trial.R at main · INCEPTdk/adaptr · GitHub) which does most of the calculations.
The issue seems to be that on Windows-latest (release) this function cannot be found, even though it is part of the package (and an exported function). See output here:
Run r-lib/actions/check-r-package@v2
Run ## --------------------------------------------------------------------
Setting NOT_CRAN option to "true"
── R CMD build ─────────────────────────────────────────────────────────────────
* checking for file 'D:\a\adaptr\adaptr/DESCRIPTION' ... OK
* preparing 'adaptr':
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... ERROR
Error: --- re-building 'Advanced-example.Rmd' using rmarkdown
--- finished re-building 'Advanced-example.Rmd'
--- re-building 'Basic-examples.Rmd' using rmarkdown
--- finished re-building 'Basic-examples.Rmd'
--- re-building 'Overview.Rmd' using rmarkdown
Quitting from lines at lines 137-150 [unnamed-chunk-5] (Overview.Rmd)
Error: Error: processing vignette 'Overview.Rmd' failed with diagnostics:
2 nodes produced errors; first error: could not find function "run_trial"
--- failed re-building 'Overview.Rmd'
SUMMARY: processing the following file failed:
'Overview.Rmd'
Error: Error: Vignette re-building failed.
Execution halted
Error: Error in proc$get_built_file() : Build process failed
Calls: <Anonymous> ... build_package -> with_envvar -> force -> <Anonymous>
Execution halted
Error: Process completed with exit code 1.
Run ## --------------------------------------------------------------------
Show testthat output
Run actions/upload-artifact@v4
Warning: No files were found with the provided path: D:/a/adaptr/adaptr/check. No artifacts will be uploaded.
We (me and the primary co-developer) cannot figure out why this error is occuring. We briefly considered adding a library call to explicitly load the package on each cluster when setting them up, but this seems odds to do, given that it should not be necessary - and I am unsure if it would fix the problem, given that the run_trial function subsequently calls other (internal, unexported) functions in the package.
If anybody can see what's wrong here, help would be appreciated. Workflow file located here: adaptr/.github/workflows/R-CMD-check.yaml at main · INCEPTdk/adaptr · GitHub