Pierre56
Pierre56

Reputation: 567

Run AI Platform Notebook with Cloud Run

I have a python script generate_trends.py stored with the instance name python-20201013-153823 as a notebook inside the AI Platform. What would be the best way to run that script directly from a cloud run using Flask?

Upvotes: 1

Views: 192

Answers (1)

guillaume blaquiere
guillaume blaquiere

Reputation: 75705

Cloud Run can serve stateless container that answers to HTTP request.

If you create a Flask server, with an entry point which trigger your script (call the processing function in your generate_trends.py file), package this in a container and deploy.

Take care of this:

  • No GPU are attachable to a Cloud Run instance
  • No dist can be attached to a Cloud Run instance. You have a in-memory writable directory /tmp, but it's not persistent and in memory. Use databases or cloud Storage to persist states
  • Only 4 CPUs and up to 4 Gb of memory. You can't add more on an instance
  • The request must be responded in less than 60 minutes
  • You can't perform processing outside request handling (batch processing for example). CPU is throttled outside request processing period.

Upvotes: 4

Related Questions