10
10
# # Example fetching external scores from the forecasting bucket
11
11
# library(aws.s3)
12
12
#
13
+ # # We recommend setting these in your user config files such as ~/.zprofile.
13
14
# Sys.setenv(
14
15
# AWS_ACCESS_KEY_ID = "",
15
16
# AWS_SECRET_ACCESS_KEY = ""
25
26
# # Save to disk
26
27
# saveRDS(scorecards, "exploration-scorecards-2023-10-04.RDS")
27
28
28
- print(" Reading environment variables (TAR_PROJECT, EXTERNAL_SCORES_PATH, DEBUG_MODE, USE_SHINY)..." )
29
29
tar_project <- Sys.getenv(" TAR_PROJECT" , " covid_hosp_explore" )
30
30
external_scores_path <- Sys.getenv(" EXTERNAL_SCORES_PATH" , " " )
31
31
debug_mode <- as.logical(Sys.getenv(" DEBUG_MODE" , TRUE ))
32
32
use_shiny <- as.logical(Sys.getenv(" USE_SHINY" , FALSE ))
33
-
34
- cat(" Using project: " , tar_project , " \n " )
35
- if (external_scores_path != " " ) cat(" Using external scores from " , external_scores_path , " \n " )
36
- if (debug_mode ) cat(" Debug mode is on." )
37
- if (use_shiny ) cat(" Running shiny server after results." )
38
-
33
+ use_aws_s3 <- as.logical(Sys.getenv(" USE_AWS_S3" , FALSE ))
34
+ aws_s3_prefix <- Sys.getenv(" AWS_S3_PREFIX" , " exploration" )
35
+ cli :: cli_inform(
36
+ c(
37
+ " i" = " Reading environment variables..." ,
38
+ " *" = " TAR_PROJECT = {tar_project}" ,
39
+ " *" = " EXTERNAL_SCORES_PATH = {external_scores_path}" ,
40
+ " *" = " DEBUG_MODE = {debug_mode}" ,
41
+ " *" = " USE_SHINY = {use_shiny}" ,
42
+ " *" = " USE_AWS_S3 = {use_aws_s3}" ,
43
+ " *" = " AWS_S3_PREFIX = {aws_s3_prefix}"
44
+ )
45
+ )
39
46
40
47
suppressPackageStartupMessages({
41
48
library(targets )
@@ -46,6 +53,18 @@ suppressPackageStartupMessages({
46
53
store_dir <- tar_path_store()
47
54
if (! dir.exists(store_dir )) dir.create(store_dir )
48
55
56
+ if (use_aws_s3 ) {
57
+ tar_option_set(
58
+ repository = " aws" ,
59
+ resources = tar_resources(
60
+ aws = tar_resources_aws(
61
+ bucket = " forecasting-team-data" ,
62
+ prefix = aws_s3_prefix
63
+ )
64
+ )
65
+ )
66
+ }
67
+
49
68
tar_manifest()
50
69
if (debug_mode ) {
51
70
tar_make(callr_function = NULL )
0 commit comments