Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App Engine Flex + Docker + R +Plumber does not work only when I use 'AI Platform Deep Learning Containers' #22

Open
ashishsr123 opened this issue Aug 31, 2019 · 0 comments

Comments

@ashishsr123
Copy link

ashishsr123 commented Aug 31, 2019

I want to serve R model using App Engine. I am following this example R with app engine, but stuck. everything works when I do not use 'AI Platform Deep Learning Containers' ,details below.

Please refer to my code app.yaml

service: caret-custom
runtime: custom
env: flex

readiness_check:
  app_start_timeout_sec: 1800

resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

Dockerfile

FROM gcr.io/deeplearning-platform-release/r-cpu  
#FROM gcr.io/gcer-public/plumber-appengine  <--  code works using this container


RUN R -e "install.packages(c('caret', 'xgboost', 'rjson', 'plumber','googleCloudStorageR','googleAuthR'), repos='http://cran.rstudio.com/')"

WORKDIR /payload/
COPY [".", "./"]

EXPOSE 8080
ENTRYPOINT ["R", "-e", "pr <- plumber::plumb(commandArgs()[4]); pr$run(host='0.0.0.0', port=8080,swagger=TRUE)"]
CMD ["main.R"]

main.R

print("in rest controller program")
#* @get /demoR
get_predict_length <- function(){
      
  dataset <- iris
  
  # create the model
  model <- lm(Petal.Length ~ Petal.Width, data = dataset)
  petal_width = "0.4"
  
  #petal_width = '0.4'
  # convert the input to a number
  petal_width <- as.numeric(petal_width)
  
  #create the prediction data frame
  prediction_data <- data.frame(Petal.Width=petal_width)
  
  # create the prediction
  predict(model,prediction_data)
}

I deploy using 'gcloud app deploy and its fails with below error
ERROR: (gcloud.app.deploy) Error Response: [4] Your deployment has failed to become healthy in the allotted time and therefore was rolled back. If you believe this was an error, try adjusting the 'app_start_timeout_sec' setting in the 'readiness_check' section.

I increased 'app_start_timeout_sec' gradually from 300 to 1800 and now I get below error:
Updating service [caret1-custom] (this may take several minutes)...failed.
ERROR: (gcloud.app.deploy) Operation [apps/my-project-id/operations/7db0da8f-213b-476f-a6ba-9c8102b21cd5] timed out. This operation may still be underway.

Issue:
If I use 'FROM gcr.io/gcer-public/plumber-appengine' in place of google provide container 'gcr.io/deeplearning-platform-release/r-cpu', everything is successful.

Please advice, as I am plan to use google provided containers only.

Ashishsr123

@ashishsr123 ashishsr123 changed the title App Engine Flex + Docker + R +Plumber once deployed get 'site cannot be reached' App Engine Flex + Docker + R +Plumber does not work only when I use 'AI Platform Deep Learning Containers' Sep 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant