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

Add an option to always build some selected targets (add an "always" trigger) #166

Closed
wlandau-lilly opened this issue Nov 23, 2017 · 2 comments

Comments

@wlandau-lilly
Copy link
Collaborator

Related: #131, richfitz/remake#95

@wlandau-lilly
Copy link
Collaborator Author

wlandau-lilly commented Nov 23, 2017

Fixed. For a complete demo on triggers, see this section of the "debug" vignette. Here is a demo of the "always" trigger.

load_basic_example()
make(my_plan, verbose = FALSE) # Make everything up to date.
make(my_plan) # Nothing is rebuilt because everything is already up to date.
## ...
## All targets are already up to date.

# Use the "always" trigger for one of the targets
my_plan$trigger <- "any"
my_plan$trigger[2] <- "always"

make(my_plan)
## ... 
## target small: trigger "always"
## ...
## Used non-default triggers. Some targets may be not be up to date.

# The "small" target is already up to date, but it is rebuilt every time.
make(my_plan)
## ... 
## target small: trigger "always"
## ...
## Used non-default triggers. Some targets may be not be up to date.

By the way: the outdated() function responds to triggers. For example, even if outdated(my_plan) shows all targets up to date, outdated(my_plan, trigger = "always") will claim that all the targets are outdated.

@wlandau-lilly wlandau-lilly changed the title Add an "always" trigger. Add an option to always build some selected targets (add an "always" trigger) Nov 23, 2017
@wlandau-lilly
Copy link
Collaborator Author

wlandau-lilly commented Nov 23, 2017

It just occurred to me: this feature does not directly cover @RemkoDuursma's point about flexible check rules: for example, defining custom functions like has_remote_changed() or is_it_tuesday() as triggers. In drake, the only available triggers are these.

drake::triggers()
## [1] "always"  "any"     "command" "depends" "file"    "missing"

However, in drake's case, this is not so bad. We are working with data frames instead of YAML files, so it's easy for the user to take care of this in the workflow plan data frame programmatically:

load_basic_example()
my_plan$trigger <- default_trigger()
if (is_it_tuesday()){
  my_plan$trigger[2] <- "always"
}
# Always build the target 'my_plan$target[2]' if it is Tuesday.
# Revert to the default behavior on all other days.
make(my_plan)

So drake will not go as far as richfitz/remake#95, but because of the data frame interface, there is no need.

wlandau-lilly added a commit that referenced this issue Nov 23, 2017
Related: #166
0: nothing
1: targets and checks
2: +missing
3: +imports
@wlandau wlandau removed the type: faq label Jul 24, 2018
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