-
Notifications
You must be signed in to change notification settings - Fork 129
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
Cancel targets mid-build #1131
Comments
I am not sure this approach is logically comprehensive enough to replace triggers, but it's a start. It is worth thinking about what it would take to replace triggers. Triggers, especially |
Triggers were originally proposed in #131 to deal with slowness. These days, |
#1132 could help implement (1) and (2). If we can reach the calling environment of |
I've got it! We just throw a custom error condition. Yet another trick I learned from following @richfitz' work: https://github.com/richfitz/storr/blob/27508231b3c061afed9bb243d4422f81291f2e94/R/exceptions.R#L1-L19 |
Prework
drake
's code of conduct.Problem
drake
does not support dynamic file-oriented workflows. If the whole point of a target is to produce a file and you do not know the path in advance,drake
cannot track the file in the general case.This limitation creates frustration (example here) and workarounds like #1127 are not a good fit for the package. Clever workarounds with triggers are sometimes possible, e.g. #1127 (comment), but triggers are a static-branching-only feature and will not help with dynamic branching.
Proposal
In situations like these, it could be convenient to cancel a target mid-build if some condition is met. Below,
cancel_if()
(and possiblyfile_ok()
andfile_value()
) would be newdrake
functions.cancel_if(TRUE)
should immediately return from the build and telldrake
to not store a new value for the target.Challenges and decisions
cancel_if()
to return to right place from anywhere in the call stack?file_ok()
be part ofdrake
or an external package as suggested in Special format for files? #1127 (comment)?file_value()
really the right name for the function?The text was updated successfully, but these errors were encountered: