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

datasette publish cloudrun --cpu X option #1420

Closed
simonw opened this issue Aug 4, 2021 · 5 comments
Closed

datasette publish cloudrun --cpu X option #1420

simonw opened this issue Aug 4, 2021 · 5 comments

Comments

@simonw
Copy link
Owner

simonw commented Aug 4, 2021

For setting the number of vCPUs - current valid values are 1, 2 or 4: https://cloud.google.com/run/docs/configuring/cpu

Pass that through to gcloud run deploy --image IMAGE_URL --cpu CPU

@simonw
Copy link
Owner Author

simonw commented Aug 4, 2021

check_call(
"gcloud run deploy --allow-unauthenticated --platform=managed --image {} {}{}".format(
image_id, service, " --memory {}".format(memory) if memory else ""
),
shell=True,
)

@simonw
Copy link
Owner Author

simonw commented Aug 4, 2021

Testing this manually with:

datasette publish cloudrun fixtures.db --memory 8G --cpu 4 \
  --service fixtures-over-provisioned-issue-1420 --install datasette-psutil

And for comparison:

datasette publish cloudrun fixtures.db --service fixtures-default-issue-1420 \
  --install datasette-psutil

@simonw
Copy link
Owner Author

simonw commented Aug 4, 2021

I'll delete these services shortly afterwards. Right now:

https://fixtures-over-provisioned-issue-1420-j7hipcg4aq-uc.a.run.app/-/psutil (deployed with --memory 8G --cpu 4) returns:

process.memory_info()
  pmem(rss=60456960, vms=518930432, shared=0, text=0, lib=0, data=0, dirty=0)

...

psutil.cpu_times(True)
  scputimes(user=0.0, nice=0.0, system=0.0, idle=0.0, iowait=0.0, irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)
  scputimes(user=0.0, nice=0.0, system=0.0, idle=0.0, iowait=0.0, irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)
  scputimes(user=0.0, nice=0.0, system=0.0, idle=0.0, iowait=0.0, irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)
  scputimes(user=0.0, nice=0.0, system=0.0, idle=0.0, iowait=0.0, irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)

psutil.virtual_memory()
  svmem(total=2147483648, available=2092531712, percent=2.6, used=33103872, free=2092531712, active=44130304, inactive=10792960, buffers=0, cached=21848064, shared=262144, slab=0)

https://fixtures-default-issue-1420-j7hipcg4aq-uc.a.run.app/-/psutil returns:

process.memory_info()
  pmem(rss=49324032, vms=140595200, shared=0, text=0, lib=0, data=0, dirty=0)

...

psutil.cpu_times(True)
  scputimes(user=0.0, nice=0.0, system=0.0, idle=0.0, iowait=0.0, irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)
  scputimes(user=0.0, nice=0.0, system=0.0, idle=0.0, iowait=0.0, irq=0.0, softirq=0.0, steal=0.0, guest=0.0, guest_nice=0.0)

psutil.virtual_memory()
  svmem(total=2147483648, available=2091188224, percent=2.6, used=40071168, free=2091188224, active=41586688, inactive=7983104, buffers=0, cached=16224256, shared=262144, slab=0)

These numbers are different enough that I assume this works as advertised.

@simonw
Copy link
Owner Author

simonw commented Aug 4, 2021

In the Cloud Run console (before I deleted these services) when I click "Edit and deploy new revision" I see this for the default one:

Deploy_new_revision_–_Cloud_Run_–_datasette_–_Google_Cloud_Platform

And this for the big one:

Deploy_new_revision_–_Cloud_Run_–_datasette_–_Google_Cloud_Platform

@simonw simonw closed this as completed in a1f3830 Aug 4, 2021
sthagen added a commit to sthagen/simonw-datasette that referenced this issue Aug 4, 2021
--cpu option for datasette publish cloudrun, closes simonw#1420
simonw added a commit to simonw/project-pelican that referenced this issue Aug 5, 2021
Needed to increase memory to 8Gi

Refs simonw/datasette#1420
@simonw
Copy link
Owner Author

simonw commented Aug 5, 2021

Just saw this error:

ERROR: (gcloud.run.deploy) The --cpuflag is not supported on the fully managed version of Cloud Run. Specify--platform gkeor rungcloud config set run/platform gke to work with Cloud Run for Anthos deployed on Google Cloud.

Which is weird because I managed to run this successfully the other day. Maybe a region difference thing?

simonw added a commit that referenced this issue Aug 7, 2021
simonw added a commit that referenced this issue Oct 14, 2021
simonw added a commit that referenced this issue Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant