Merged
Conversation
Closed
amart90
approved these changes
Apr 16, 2025
amart90
left a comment
There was a problem hiding this comment.
Thanks for humoring my request! I tested the new functionality out on a reproducible example targets pipeline.
library(sbtools)
library(targets)
# Log-in during interactive session
# Change username to valid ScienceBase username
sbtools::initialize_sciencebase_session(username = "USERNAME REDACTED")
# Create and execute targets pipeline in temp directory
tar_dir({
# Define targets pipeline
tar_script({
# Read ScienceBase token from cache
sbtools::initialize_sciencebase_session(
username = sbtools::get_username(),
token_text = sbtools::get_cached_token()
)
# Target list
list(
tar_target(is_logged_in, sbtools::is_logged_in()),
tar_target(
secured_file,
sbtools::item_list_files("66e05a7ed34ecba8b86765d5")[["fname"]][1]
)
)
})
# Execute targets pipeline
tar_make()
# Load targets into global environment
tar_load(c(is_logged_in, secured_file))
})
is_logged_in
#> [1] TRUE
secured_file
#> [1] "NYC_reservoir_monthly_storage_change-Domber-mgal.csv"Everything worked exactly how it was expected.
I had one very minor suggestion in the function documentation to keep the capitalization function with the rest of the documentation. In either case, approved! Thanks again!
| #' username is found and `interactive()` is FALSE | ||
| #' @export | ||
| #' | ||
| get_username <- function(username = NULL) { |
There was a problem hiding this comment.
The logic in this function all makes sense to me.
Co-authored-by: Anthony Martinez <ajmartinez@usgs.gov>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #329 pending review.