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

Get each field of default resources from tar_option_get("resources") separately #892

Closed
2 of 5 tasks
wlandau opened this issue Aug 1, 2022 · 2 comments
Closed
2 of 5 tasks

Comments

@wlandau
Copy link
Member

wlandau commented Aug 1, 2022

Prework

Description

At the time of writing, target resources need to be supplied wholesale. That is, if you set tar_option_set(resources = tar_resources(aws = tar_resources_aws(bucket = a, endpoint = b), feather = c)) and then tar_target(x, .., resources = tar_resources(aws = tar_resources_aws(bucket = d)), the feather resource of target x will not be b and the AWS endpoint of target x will not be b. I have not heard any reports of confusion from this, but it could easily create confusion. The defaults of all tar_resources() functions should come from tar_option_set("resources")

@wlandau wlandau changed the title Get each field of default resources from tar_option_set("resources") Get each field of default resources from tar_option_get("resources") Aug 1, 2022
@wlandau wlandau changed the title Get each field of default resources from tar_option_get("resources") Get each field of default resources from tar_option_get("resources") separately Aug 1, 2022
@wlandau wlandau closed this as completed in 621efdc Aug 1, 2022
@wlandau
Copy link
Member Author

wlandau commented Aug 1, 2022

In targets version 0.12.2 and above, resources will be inherited one-by-one in nested fashion from tar_option_get("resources").For example, suppose you set tar_option_set(resources = tar_resources(aws = my_aws)), where my_aws equals tar_resources_aws(bucket = "x", prefix = "y").Then, tar_target(data, get_data() will have bucket "x" and prefix "y". In addition, if new_resources equals tar_resources(aws = tar_resources_aws(bucket = "z"))), then tar_target(data, get_data(), resources = new_resources) will use the new bucket "z", but it will still use the prefix "y" supplied through tar_option_set(). (In targets 0.12.1 and below, options like prefix do not carry over from tar_option_set() if you supply non-default resources to tar_target().)

@wlandau
Copy link
Member Author

wlandau commented Aug 1, 2022

I believe this change will eliminate potential confusion and pitfalls because of how deeply nested the resources option is. I am planning to allow an option for a scratch directory to be declared this way (#889, #891) so users may be relying on it more, which makes it extra important to make the default behavior agree with prior expectation.

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

1 participant