Jump to Content
Application Development

Your favorite runtimes, now generally available on Cloud Functions

April 30, 2019
https://storage.googleapis.com/gweb-cloudblog-publish/images/cloudai_solutions.max-2000x2000.jpg
Dustin Ingram

Senior Developer Advocate

Stewart Reichling

Product Manager, Traffic Director

When we ask developers why they choose Cloud Functions, "simplicity" comes up a lot: write a few lines of code, deploy and… voilà! You've got a serverless, auto-scaling, pay-per-use function running on Google Cloud.

A big part of that simplicity comes from being able to write Cloud Functions in your favorite programming language. That's why we’re excited about our recent language support announcements at Google Cloud Next ‘19:

  • Python 3.7, Go 1.11 and Node.js 8 runtimes are now generally available.

  • Node.js 10 runtime is now in public beta.

  • Go 1.12 and Java 8 runtimes are in private alpha (sign up to test Go 1.12 and Java 8).

Let’s take a closer look at one of the generally available runtimes:

Serverless + Python on Cloud Functions
Over the past six months, we've spoken to many established and up-and-coming customers who have used these runtimes to build on Cloud Functions. One customer, infarm, uses Cloud Functions and Python 3 to support its distributed network of efficient vertical farms:

The event driven interface was an especially good fit for our alerting stack, taking in more than 2.6 million plant- and farm-related measurements per day to prevent our crops from being affected by potential incidents. We rely on Google's monitoring and alerting capabilities to monitor 400+ farms across Europe. - Nicolas Delaby, Lead Engineer, infarm

By opting for serverless on Google Cloud, infarm can focus on its mission: to help cities develop self-sufficient food production while improving agricultural safety, quality, and lowering their environmental footprint. Notice how that mission doesn't include "managing my server infrastructure" or "learning new programming languages"?

Use Cloud Functions to process IoT data
Python and data processing go hand-in-hand. A common architectural pattern that we've observed among customers that use IoT devices is to have each device push sensor readings to a message bus. For example, one of infarm's modular farms might have multiple IoT devices, each sending sensor data as messages to a Cloud Pub/Sub topic. When a message is delivered to the topic, it triggers a function, which performs a task. That task can be as simple as redirecting messages to a persistent datastore like Cloud SQL, to enriching data before inserting it in BigQuery, to performing complex processing.

https://storage.googleapis.com/gweb-cloudblog-publish/images/Cloud_Functions_Post-Next_Runtimes.max-2200x2200.png

Cloud Functions is a great choice for single purpose, repeated data processing use cases. Because Cloud Functions scales automatically based on load, it's also a good fit for a project that will continue to grow into the future. As infarm adds new IoT devices, Cloud Functions scales up to meet that increased load.

A world of Python packages
Cloud Functions supports Python's rich ecosystem of packages, which unlocks a huge variety of use cases. The Cloud Functions Python 3.7 runtime uses the open-source Python distribution so you can easily add packages to your Cloud Functions using `pip`. These dependencies are installed automatically when you deploy your function. Customers use this functionality to access Google Cloud APIs from Cloud Functions using the idiomatic `google-cloud-python` package. Others are using packages like NumPy and SciPy to create data processing pipelines.

Try Python 3.7 on Cloud Functions today
You don’t need to be on a visionary mission to reinvent food production to start writing functions with Python 3.7 today—check out the docs to get started.

Posted in