Skip to content

Commit

Permalink
fixup update
Browse files Browse the repository at this point in the history
  • Loading branch information
tanho63 committed Feb 8, 2022
1 parent 5332d23 commit 4173afb
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions update/ep_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
# zip(file.path(folder_path,paste0(version,".zip")),files = file.path(version))
# zip(file.path(folder_path,"latest.zip"), files = file.path(version))
#
# try(piggyback::pb_new_release(repo = "ffverse/ffexpectedpoints",tag = paste0(version, "-model")))
# try(piggyback::pb_new_release(repo = "ffverse/ffopportunity",tag = paste0(version, "-model")))
# piggyback::pb_upload(file = file.path(folder_path,paste0(version,".zip")),
# repo = "ffverse/ffexpectedpoints",
# repo = "ffverse/ffopportunity",
# tag = paste0(version, "-model"))
#
# try(piggyback::pb_new_release(repo = "ffverse/ffexpectedpoints",tag = "latest-model"))
# try(piggyback::pb_new_release(repo = "ffverse/ffopportunity",tag = "latest-model"))
# piggyback::pb_upload(file = file.path(folder_path,"latest.zip"),
# repo = "ffverse/ffexpectedpoints",
# repo = "ffverse/ffopportunity",
# tag = "latest-model")
#
# setwd(wd)
13 changes: 8 additions & 5 deletions update/ep_update.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ pkgload::load_all()

save_ep_data <- function(season, folder_path, version){

ep_object <- ffexpectedpoints::ep_build(season,version = version)
ep_object <- ffopportunity::ep_build(season,version = version)

# rds
saveRDS(ep_object$ep_weekly, file.path(folder_path, glue::glue('ep_weekly_{season}.rds')))
Expand All @@ -25,18 +25,21 @@ save_ep_data <- function(season, folder_path, version){

upload_ep_data <- function(folder_path, version){
list.files(folder_path, pattern = "csv$|rds$|parquet$|txt$", full.names = TRUE) %>%
purrr::walk(piggyback::pb_upload, repo = "ffverse/ffexpectedpoints", tag = "latest-data", overwrite = TRUE) %>%
purrr::walk(piggyback::pb_upload, repo = "ffverse/ffexpectedpoints", tag = glue::glue("{version}-data"), overwrite = TRUE)
piggyback::pb_upload(repo = "ffverse/ffopportunity", tag = "latest-data", overwrite = TRUE)

list.files(folder_path, pattern = "csv$|rds$|parquet$|txt$", full.names = TRUE) %>%
piggyback::pb_upload(repo = "ffverse/ffopportunity", tag = glue::glue("{version}-data"), overwrite = TRUE)

cli::cli_alert_success("Completed ep upload! {Sys.time()}")
}

update_ep <- function(season, version = "v1.0.0", folder_path){
try(piggyback::pb_new_release(repo = "ffverse/ffexpectedpoints", tag = "latest-data"))
try(piggyback::pb_new_release(repo = "ffverse/ffexpectedpoints", tag = glue::glue("{version}-data")))
purrr::walk(season, save_ep_data, folder_path = folder_path, version = version)
upload_ep_data(folder_path, version)
invisible(NULL)
}
try(piggyback::pb_new_release(repo = "ffverse/ffopportunity", tag = "latest-data"))
try(piggyback::pb_new_release(repo = "ffverse/ffopportunity", tag = glue::glue("{version}-data")))
temp <- tempdir()
update_ep(nflreadr:::most_recent_season(), version = "latest", folder_path = temp)
update_ep(nflreadr:::most_recent_season(), version = "v1.0.0", folder_path = temp)
Expand Down

0 comments on commit 4173afb

Please sign in to comment.