Skip to content

Commit

Permalink
working deployment #163
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkEdmondson1234 committed Jan 8, 2022
1 parent 90d4e86 commit f328540
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
1 change: 1 addition & 0 deletions R/docker.R
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,7 @@ cr_buildstep_docker <- function(
sprintf("--context=%s", build_context),
"--cache=true"
),
waitFor = "-",
...
)
},
Expand Down
2 changes: 1 addition & 1 deletion inst/vetiver/plumber/api.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ if(Sys.getenv("PORT") == "") Sys.setenv(PORT = 8000)
#' @get /
#' @html
function(){
"<html><h1>It works!</h1></html>"
"<html><h1>It works! Vetiver deployment</h1></html>"
}


Expand Down
3 changes: 2 additions & 1 deletion inst/vetiver/plumber/server.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pr <- plumber::plumb("api.R")
pr <- vetiver::vetiver_pr_predict()
v <- vetiver::vetiver_pin_read(pins::board_folder("pins"), name = "sacramento_rf")
pr <- vetiver::vetiver_pr_predict(pr, v, debug = TRUE)
pr$run(host = "0.0.0.0", port = as.numeric(Sys.getenv("PORT")), swagger = TRUE)
12 changes: 11 additions & 1 deletion inst/vetiver/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,14 @@ cr_deploy_docker_trigger(repo, "vetiver",
projectId_target = "gcer-public",
timeout = 3600)

cr_deploy_plumber(file.path(root,"plumber"), timeout = 3600)
run <- cr_deploy_plumber(file.path(root,"plumber"), remote = "vetiver")

# on succesful deployment
endpoint <- vetiver::vetiver_endpoint(paste0(jj$status$url, "/predict"))
library(tidyverse)
data(Sacramento, package = "modeldata")
new_sac <- Sacramento %>%
slice_sample(n = 20) %>%
select(type, sqft, beds, baths)


0 comments on commit f328540

Please sign in to comment.