-
Notifications
You must be signed in to change notification settings - Fork 66
Assignment of non-standard cache folder #747
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
Comments
The default behavior is for the cache to be at a location like this: server <- pins:::rsc_server(auth = "envvar")
pins:::board_cache_path(paste0("connect-", rlang::hash(server$url)))
#> ~/Library/Caches/pins/connect-31a399613ac85efda77ffe6ff20c105a Created on 2023-06-02 with reprex v2.0.2 The only piece that goes in here is the server URL so I imagine that value would be the same for all users on a Workbench server. They are going into your own home directories, though, because users have separate caches via Is there a directory or cache anywhere on your Workbench server that already is available to all your users? Let's say it is at What do you think about that? Does your server already have a directory like that available? |
Thank you for your quick reply. Exactly, we already have a folder on Posit Workbench which we use for server-wide and cross-user caches. For instance for {renv}. So the global state of projects renv manages is no longer stored in each user's directory but shared system wide. Setting this up was very easy by explicating a unified path for the renv cache via environment variables: I could imagine something like this for {pins} as well. I think only this way our code can be reproduced on different systems (e.g. also in production on Posit Connect), which would not necessarily be possible if we would hardcode the path. Would such a customization and the addition of a specific cache directory via an environment variable be possible? |
Gotcha! If you want to do this right now, you can use the env variable withr::local_envvar(list("R_USER_CACHE_DIR" = "~/Desktop"))
server <- pins:::rsc_server(auth = "envvar")
pins::board_cache_path(paste0("connect-", rlang::hash(server$url)))
#> ~/Desktop/pins/connect-31a399613ac85efda77ffe6ff20c105a Created on 2023-06-02 with reprex v2.0.2 I added some more documentation on this in #748, as well as a new env var withr::local_envvar(list("PINS_CACHE_DIR" = "~/Desktop"))
server <- pins:::rsc_server(auth = "envvar")
pins::board_cache_path(paste0("connect-", rlang::hash(server$url)))
#> ~/Desktop/connect-31a399613ac85efda77ffe6ff20c105a Created on 2023-06-02 with reprex v2.0.2 |
Excellent, I think that is exactly what we need! |
Glad to hear this will work for your use case! You can install the new version of pins from GitHub now via Let us know if you have further questions! 🙌 |
This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue. |
Uh oh!
There was an error while loading. Please reload this page.
Hey everybody,
we have been using this wonderful package for a long time in our team and since we moved to Posit Workbench we are wondering how to use a shared cache on the Workbench server for pins.
In the documentation of the package and in the source code I could not find any hints that the location where the caching takes place can be customized.
However, for us it would be important to be able to use a shared cache for our pins for performance reasons (cache only needs to be built once and is then available to everyone on the server) and for disk space reasons (pins duplicates in the respective user folders just take up a large amount of disk space).
Is there any possibility or is it planned (soon) to enable this or am I missing something?
Thanks and best regards,
Janis
The text was updated successfully, but these errors were encountered: