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

board_url cache is not cleared by cache_prune, or listed in cache_versions #607

Closed
machow opened this issue Mar 29, 2022 · 1 comment · Fixed by #734
Closed

board_url cache is not cleared by cache_prune, or listed in cache_versions #607

machow opened this issue Mar 29, 2022 · 1 comment · Fixed by #734

Comments

@machow
Copy link
Collaborator

machow commented Mar 29, 2022

Unlike other boards, board_url can point directly to to-be-downloaded files. In order to work with cache functions like cache_prune() and pins:::cache_versions(), this board runs this process when downloading a single file:

  • if url does not end with /, it is a single file
  • download the file, and put a download-cache.yaml in the cached pin version
  • run cache_touch, which creates an empty data.txt in cached pin version

Because functions like cache_versions look for the structure <cache_root>/<board_hash>/<pin>/<version>/data.txt, this should work okay. The only issue afaict is that the cache is using <pin>/data.txt, rather than <pin>/<version>/data.txt.

Example

github_raw <- "https://raw.githubusercontent.com/"
board <- board_url(c(
    files = paste0(github_raw, "rstudio/pins/master/tests/testthat/pin-files/"),
    rds = paste0(github_raw, "rstudio/pins/master/tests/testthat/pin-rds/"),
    raw = paste0(github_raw, "rstudio/pins/master/tests/testthat/pin-files/first.txt")
))

board %>% pin_download("files")
board %>% pin_download("raw")

# output: [1] "~/Library/Caches/pins/url/87473d3442e598f929b65b6630da6fd8/first.txt"
# note that the cached pin also has data.txt, and download-cache.yaml created in it

# looks for  <pin>/<version>/data.txt file, so doesn't find anything
pins:::cache_versions()
cache_prune(0)                       # no stale pins found
@github-actions
Copy link

github-actions bot commented May 4, 2023

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.

@github-actions github-actions bot locked and limited conversation to collaborators May 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant