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

dry-run option for clean() #1014

Closed
2 tasks done
pat-s opened this issue Sep 19, 2019 · 6 comments
Closed
2 tasks done

dry-run option for clean() #1014

pat-s opened this issue Sep 19, 2019 · 6 comments

Comments

@pat-s
Copy link
Member

pat-s commented Sep 19, 2019

Prework

Description

Would it makes sense to have a dry_run argument to clean() to be able to check which targets will be removed from the cache? Especially when using tidyselect helpers it is unclear which targets will be affected.

@wlandau
Copy link
Member

wlandau commented Sep 20, 2019

Something like it, sure. make() has outdated() and recoverable(), and unmaking targets is high-stakes too. Trying to decide between clean(dry_run = TRUE) and cleanable()...

@wlandau
Copy link
Member

wlandau commented Sep 20, 2019

Hmm... the word "cleanable" does not actually get at the idea, and dry_run would make the return value of clean() less consistent than I would like. Some other possible names:

  • dry_clean()
  • mock_clean()
  • predict_clean()
  • list_clean()
  • peek_clean()

Any sound good to you? Got a better idea for a name?

@wlandau
Copy link
Member

wlandau commented Sep 20, 2019

Let's go with which_clean().

@pat-s
Copy link
Member Author

pat-s commented Sep 20, 2019

I am used to clean(dry_run = TRUE) from other tools but I am fine with any. 👍

I even thought if this might server as a default to prevent undesirable events of people deleting important things - but I vaguely remember there is another option to undo cache cleaning, isn't it?

@wlandau
Copy link
Member

wlandau commented Sep 20, 2019

Yes, to undo clean(garbage_collection = FALSE), run make(recover = TRUE). It's not a perfect inverse transformation (it could recover additional targets and build others) but it does the job.

What other tools support clean(dry_run = TRUE)? It would be nice to be consistent with what other developers do, but I just feel like clean(dry_run = TRUE) would return a character vector and have no side effects whereas regular clean() has large side effects and an empty return value. I would rather be internally consistent than externally consistent. The alternative to returning a character vector seems to be printing to the console, and that does not seem ideal.

@pat-s
Copy link
Member Author

pat-s commented Sep 20, 2019

What other tools support clean(dry_run = TRUE)?

Some shell and python tools AFAIR. Not sure if I've seen this in R before.

I would rather be internally consistent than externally consistent.

Totally understandable! I am totally fine with an extra function for it.

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

No branches or pull requests

2 participants