Closed joscani closed 10 months ago
I am predicting that you are seeing this error from here in the paws package, which is building up a signature for an AWS service when it is called. Both the S3 backend for the pins board and the smdocker R package use paws, so that doesn't help narrow it down a whole ton.
Can you walk through what vetiver_sm_build()
does internally, step by step, and find out in more detail where the error is happening? If it is during vetiver_prepare_docker()
I can definitely help debug but if it is from smdocker::sm_build()
I may need to point you to that repo instead.
Hello,
my guess would be that the repository name is not valid. In AWS I experienced that I'm not allowed to use "" (underscores) in names. So maybe try repository = glue::glue("joscani-irlanda-{name}:{strftime(Sys.time(), '%Y-%m-%d')}")
instead. Maybe that already fixes your issue. Same for the name
argument btw (I would in general try to avoid ).
If you make it run on your local computer, please let me know, as I'm also struggling, but at a different point (see #253) :)
@stefanlinner I don't think that the "_" is the problem.
. I have a docker image with a plumber inside this registry . A plumber api created to predict using a brms model, (without vetiver package) and it works fine, usin apprunner service.
Hi, again. I'm trying to run step by step. In vetiver_prepare_docker
I don't understand the plumber.R generated file.
# Generated by the vetiver package; edit with care
library(pins)
library(plumber)
library(rapidoc)
library(vetiver)
c("b <- board_s3(bucket = \"taller-barna-ireland\", region = structure(\"eu-west-1\", tags = list(", "b <- type = \"scalar\")))")
v <- vetiver_pin_read(b, "btxgboost", version = "20231105T075959Z-0f297")
#* @plumber
function(pr) {
pr %>% vetiver_api(v, path = "/invocations")
}
How the objects defined inside the c function are passed to vetiver_pin? If I run this in my R console, it doesn't work
c("b <- board_s3(bucket = \"taller-barna-ireland\", region = structure(\"eu-west-1\", tags = list(", "b <- type = \"scalar\")))")
Later I found that my error is in smdocker:::upload_zip_file
and maybe in config <- smdocker:::smdocker_config()
where I get
$credentials
$credentials$anonymous
[1] FALSE
$region
[1] "us-east-1"
$disable_ssl
[1] FALSE
Instead of the correct credentials. I'm going to check how smdocker_config works .
@joscani if the error is coming from smdocker:::upload_zip_file
please raise the ticket at https://github.com/DyfanJones/sm-docker/tree/main. I am more than happy to debug this.
config <- smdocker::smdocker_config()
set and keep a consistent config for paws (for example: https://www.paws-r-sdk.com/docs/s3/). However we can work it out in the same smdocker
ticket if that is ok :) I don't want to clog vetiver tickets with an error on my end :P
@joscani Oh, that would definitely be the problem! I am not currently able to reproduce this and would love some help tracking it down. Can you run this code with reprex(session_info = TRUE)
?
library(vetiver)
library(pins)
tmp_plumber <- tempfile()
b <- board_temp(versioned = TRUE)
cars_lm <- lm(mpg ~ ., data = mtcars)
v <- vetiver_model(cars_lm, "cars_linear")
vetiver_pin_write(b, v)
#> Creating new version '20231106T171138Z-a34d4'
#> Writing to pin 'cars_linear'
#>
#> Create a Model Card for your published model
#> • Model Cards provide a framework for transparent, responsible reporting
#> • Use the vetiver `.Rmd` template as a place to start
vetiver_write_plumber(b, "cars_linear", file = tmp_plumber)
cat(readr::read_lines(tmp_plumber), sep = "\n")
#> # Generated by the vetiver package; edit with care
#>
#> library(pins)
#> library(plumber)
#> library(rapidoc)
#> library(vetiver)
#> b <- board_folder(path = "/var/folders/hv/hzsmmyk9393_m7q3nscx1slc0000gn/T/RtmprtXpz4/pins-59ba732f7ef5")
#> v <- vetiver_pin_read(b, "cars_linear", version = "20231106T171138Z-a34d4")
#>
#> #* @plumber
#> function(pr) {
#> pr %>% vetiver_api(v)
#> }
Created on 2023-11-06 with reprex v2.0.2
Turns out this is a bug in the latest version of vetiver! 🐛 😬
I believe I have a fix set up in #257 but if you are needing to deploy to SageMaker very immediately, I recommend installing back to vetiver 0.2.3 which is from before this bug was introduced:
pak::pak("vetiver@0.2.3")
You can now also install the development version of vetiver via pak::pak("rstudio/vetiver-r")
to get this fix. Let me know if this does not fix the problem or you run into any further troubles!
Thanks @juliasilge . I'll check next weekend
Hi. I've created a role with all sagemaker permissions . And I try to write docker using vetiver_sm_build. I've created an Ecr registry and in fact I've update a docker (not related with vetiver model) and use this docker in app runner. I've read this issue https://github.com/rstudio/vetiver-r/issues/215 but I have problems. My problem is with this when I try to use this from my local computer. My ecr is joscani-irlanda
The role has been created using sagemakerfullaccess policy. Any idea. Thanks