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

RCACHE.DIR setting #35

Open
vreuter opened this issue Feb 15, 2018 · 4 comments
Open

RCACHE.DIR setting #35

vreuter opened this issue Feb 15, 2018 · 4 comments
Labels

Comments

@vreuter
Copy link
Member

vreuter commented Feb 15, 2018

I'd be interested to have the following capability, and am putting this out to see if others would find similar use, or if this could be supported regardless.

"RCACHE.DIR" is sought as an option, with getOption, and I think it's mentioned at least once in the docs that there's often the desire to have a different "RCACHE.DIR" on a per-project basis. The caveat mentioned is sharing caches between projects. For that use and for general use, I'd like to set a more general "RCACHE.DIR". I tend to use things like cacheSubDir for getting the project-specificity that's often desirable.

I could configure "RCACHE.DIR" in a .Rprofile, but I'd like several members of a group to be able to share the same "RCACHE.DIR" setting by having a common, environment variable that's managed separately and (I think?) more easily shareable than a .Rprofile.

So I guess this is sort of a two-part question:

  1. Is there a way to share .Rprofile as easily as an environment variable (through a module). I guess R_HOME could do be common, and then there could be a group .Rprofile, but that costs each individual user a layer of control by forcing the R_HOME to be reserved for the group.
  2. If there's not a great way to share a RCACHE.DIR via .Rprofile, could logic be added to support the notion of "get the RCACHE.DIR option, but use a similarly named environment variable if it's set?" Maybe the function could call getOption, then fall back to Sys.getenv?
@nsheff
Copy link
Member

nsheff commented Feb 16, 2018

How is what you're suggesting different from the shared cache dir capability?

http://code.databio.org/simpleCache/articles/sharingCaches.html

This is the way I share caches across projects and people; I typically use cacheSubDir for within-project organization.

@nsheff
Copy link
Member

nsheff commented Feb 16, 2018

BTW, there is a site-level .Rprofile as well: https://www.statmethods.net/interface/customizing.html

I wouldn't use this to set RCACHE.DIR, though. I would use it, however, to setSharedCacheDir(cacheDir)

@vreuter
Copy link
Member Author

vreuter commented Feb 16, 2018

Cool, I didn't know about SHARE.RCACHE.DIR!
The main difference I think, though, is that I don't want myself or others to have to call anything when R is started. If simpleCache is loaded, I'd like RCACHE.DIR or SHARE.RCACHE.DIR to already be available, and to be constant for any user that wishes to opt into this short of setting sharing, ideally without any additional action on his/her part (other than, say--hypothetically--loading a group modulefile).

@nsheff
Copy link
Member

nsheff commented Feb 16, 2018

My approach to this has been to do these calls in projectInit

https://github.com/databio/projectInit/blob/8471394fb5c3cd9e7b98c665ef2b98bd936444a4/R/utils.R#L109

I can't remember where at the moment the shared cache dir is set, though... no reason it couldn't happen there, based on an environment variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants