Best way to rerun target after some time elapsed from last run? #337
Replies: 2 comments
-
This came up at #131. As discussed in the thread. A completely satisfying solution would require additions to the core metadata, and I hesitate because this sort of use case is not ubiquitous. I recommend something like |
Beta Was this translation helpful? Give feedback.
-
Many thanks - understand you don't want to burden every step with time checking as discussed in #131. It's the combination of |
Beta Was this translation helpful? Give feedback.
-
Use case: I have a remote resource which I want to update every few days, and I have no way to poll when it's changed (it cannot be collapsed into a URL). For instance, google sheets behind an auth procedure are like this.
What would be the most sensible way to trigger the target, say, every N days?
Currently, do the following:
tar_force()
) on the date being older than N days, which is calculated in the_targets.R
and stored in a global variable.This feels convoluted and I suspect I might be missing something obvious. (I am hesitant to check the file-modified date on the target file in
_targets/
, which feels more straightforward but fragile.)Intuitively, I would like something like
tar_refresh()
that does this in one step - but perhaps there is a simple way to achieve this with the existing functions. (I know I could write a target factory to collapse the two steps into one custom target, but I am not sure how best to do the checking of last-modified/last-run time.)Beta Was this translation helpful? Give feedback.
All reactions