Skip to content

Aci Deployment failed with exception: Error in entry script #417

@csetzkorn

Description

@csetzkorn

My use case is to deploy a locally trained model - perfectly valid use case AFIK. For reproducibility I trained this simple model:

library(datasets)
library(caret)

setwd("C:/Data")

index <- createDataPartition(iris$Species, p=0.80, list=FALSE)
testset <- iris[-index,]
trainset <- iris[index,]

model = train(Species ~ ., 
                  data=trainset, 
                  method="rpart", 
                  trControl = trainControl(method = "cv"))

saveRDS(model, "model.rds")

The model can be deployed using code, which is great:

image

I try to use this scoring script:

library(jsonlite)

init <- function()
{
  model_path <- Sys.getenv("AZUREML_MODEL_DIR")
  model <- readRDS(file.path(model_path, "model.rds"))
  message("iris classfication model loaded")
  
  function(data)
  {
    vars <- as.data.frame(fromJSON(data))
    prediction <- predict(model, newdata=vars)
    toJSON(prediction)
  }
}

and deploy a web service to score the model (or you call it infer these days):

library(azuremlsdk)

interactive_auth <- interactive_login_authentication(tenant_id="xxx")

ws <- get_workspace(
        name = "amazing_work_space", 
        subscription_id = "xxx", 
        resource_group ="xxx", 
        auth = interactive_auth
)

model <- get_model(ws, name = "iris_classification")

r_env <- r_environment(name = 'myr_env',
                       version = '1')

inference_config <- inference_config(
  entry_script = "score.R",
  source_directory = ".",
  environment = r_env)

aci_config <- aci_webservice_deployment_config(cpu_cores = 1, memory_gb = 0.5)

aci_service <- deploy_model(ws, 
                            'xxx', 
                            list(model), 
                            inference_config, 
                            aci_config)

wait_for_deployment(aci_service, show_output = TRUE)

I get:

Running.................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................. Failed Service deployment polling reached non-successful terminal state, current service state: Failed Operation ID: 6f62fc59-6b42-4b1e-957b-b0460de9e49e More information can be found using '.get_logs()' Error: { "code": "AciDeploymentFailed", "statusCode": 400, "message": "Aci Deployment failed with exception: Error in entry script, RuntimeError: Error in file(filename, \"r\", encoding = encoding) : , please run print(service.get_logs()) to get details.", "details": [ { "code": "CrashLoopBackOff", "message": "Error in entry script, RuntimeError: Error in file(filename, \"r\", encoding = encoding) : , please run print(service.get_logs()) to get details." } ] }

So there is something wrong with my scoring script? Any help would be very much appreciated please! Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions