NCC-CNC / wheretowork

Interactive application for systematic conservation planning
https://NCC-CNC.github.io/wheretowork
Other
8 stars 1 forks source link

install package for for asynchronous processing? #377

Closed DanWismer closed 2 months ago

DanWismer commented 3 months ago

@jeffreyhanson, do you recall why this is needed?

https://github.com/NCC-CNC/wheretowork/blob/316b2567ecc5a7d35572994490c34ec40d2403df/dev/run_dev.R#L11-L14

jeffreyhanson commented 3 months ago

If I recall correctly, when using asynchronous processing via the future package, it doesn't run R using same renv library/packages by default, and so something was needed to ensure that it would use the renv library/packages. I might have that wrong though?

DanWismer commented 3 months ago

Thanks Jeff.

?renv::install says it doesn't respect the lockfile, instead it installs the latest versions available from CRAN. I did update to renv 1.0.7, so I am wondering if that is a new behavior.

jeffreyhanson commented 3 months ago

Nah, I think renv::install() always did that. I think the reason I used renv::install() was because I had issues getting the the asynch worker to run with the renv version of R packages, so as a fallback, I was able to get it to at least try running with the CRAN version of the packages. This isn't ideal though.

DanWismer commented 2 months ago

@jeffreyhanson do you know why it requires wheretowork package to be installed?

image

jeffreyhanson commented 2 months ago

Yeah, we install the packages in renv into the default R package library because the async workers don't use the renv package library and instead use the default R package library. This is definitely not ideal, but I couldn't find another way to do this at the time. There has been some progress in improving async processing in R since I worked on this though. The mirai package (https://github.com/shikokuchuo/mirai) might have a solution for spawning async workers that load packages from a renv library.

DanWismer commented 2 months ago

Thanks @jeffreyhanson .

What seems to be happening is that every time a new package is updated on CRAN (data.table for example), it installs the newest version of the package. This would not happen before and rather just spin the app up. Any thoughts on this. I only noticed it when I updated all those package versions.

image

jeffreyhanson commented 2 months ago

Oh that's weird - must be an update to renv? Maybe see if there's some way to change the arguments to renv::install() to see if you can recover the old behavior?

DanWismer commented 2 months ago

PR #380