MarkEdmondson1234 / googleCloudRunner

Easy R scripts on Google Cloud Platform via Cloud Run, Cloud Build and Cloud Scheduler
https://code.markedmondson.me/googleCloudRunner/
Other
81 stars 26 forks source link

deploy cloudrun error: invalid value specified for memory #137

Open dcaud opened 2 years ago

dcaud commented 2 years ago

cr_setup_test() passed with flying colors, but with a custom plumber deploy, I get the following error:

starting build "f0asdf6ea9-8174-4052-ab0f-9d4f912asdf108a"

FETCHSOURCE
BUILD
Starting Step #0 - "deploy cloudrun"
Step #0 - "deploy cloudrun": Already have image (with digest): gcr.io/cloud-builders/gcloud
Step #0 - "deploy cloudrun": Deploying container to Cloud Run service [name] in project [name] region [us-east1]
Step #0 - "deploy cloudrun": Deploying...
Step #0 - "deploy cloudrun": failed
Step #0 - "deploy cloudrun": Deployment failed
Step #0 - "deploy cloudrun": ERROR: (gcloud.beta.run.deploy) Invalid value specified for memory with gen2 execution environment. For 1.0 CPU, memory must be between 512Mi and 4Gi inclusive.
Finished Step #0 - "deploy cloudrun"
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gcloud" failed: step exited with non-zero status: 1

Any ideas how to troubleshoot this?

dcaud commented 2 years ago

The error here stems from the fact that in the Cloud Run UI (after a prior successful deployment using cr_deploy_plumber) I went to EDIT & DEPLOY NEW VERSION and selected this option:

"Second generation PREVIEW File system access, full Linux compatibility, faster CPU performance, slower cold starts."

When I went to redeploy using cr_deploy_plumber it didn't like the second generation. So, I changed it back to first generation and then everything worked.

MarkEdmondson1234 commented 2 years ago

Can I see the code that you built with? It's saying the CPU/Memory configuration is not the right syntax.

dcaud commented 2 years ago

I don't think it was a syntax problem (see my comment above that I posted just before you did). But a problem with "Second Generation."

This works:

cr <- cr_deploy_plumber(my_plumber_folder,
                        cpu = 4,
                        memory= "8Gi",
                        timeout = 3500,
                        max_instances = 20
                        )

(Note that in order for the above to work I changed cr_deploy_plumber according to #126)

MarkEdmondson1234 commented 2 years ago

Ok interesting looks like I'll need to keep an eye on this new version to see how it affects deployments. Thanks for info!

MarkEdmondson1234 commented 2 years ago

Existing gcloud run docs: https://cloud.google.com/sdk/gcloud/reference/run/deploy Beta gcloud run docs: https://cloud.google.com/sdk/gcloud/reference/beta/run/deploy

I guess perhaps original error was because "8Gi" was too big when max was "4Gi" according to error message?