Easily Schedule StarThinker Recipes On Google Cloud Functions

Paul Kenjora At Google
StarThinker
Published in
2 min readMay 17, 2021

A new StarThinker deployment is available on Google Cloud Functions combined with Cloud Scheduler. This allows recipes to be copied and pasted from Colaboratory Notebooks into a low cost server-less scheduled environment.

The Cloud Function

The setup consists of 5 lines of StarThinker Cloud Function code that runs one or more recipes. A single code deployment is easier to deploy, maintain, and update. The recipes themselves are defined in the scheduler.

Google Cloud Function requirements file for StarThinker.
5 lines of StarThinker code as a Google Cloud Function to run any number of recipes.

Both these files are created by the StarThinker Cloud Function Deployment.

The Scheduler

The cloud function can run any task from the StarThinker Gallery or Scripts sample library. Notice that the entire recipe is defined in the Cloud Scheduler body parameter…

Example configuration of a StarThinker recipe running on a scheduled Cloud Function.

The resulting recipe has its own schedule, logs, and ability to run and pause. Effectively the Google Cloud Scheduler becomes a job UI for the user.

The sample recipe is created by the StarThinker Cloud Function Deployment.

Credentials

The recipe itself can embed credentials such as service or user credentials in the { ‘setup’:’auth’:{…}} section. These values can be the actual JSON or string encoded JSON of a Service or user credential. For improved security, it is advised to create a custom Service Credential with its own permissions for the recipe that is independent of the Service account specified in the scheduler.

Parameters

The StarThinker Gallery or Scripts recipes are templates, remember to replace al { ‘field’’:{…}} sections of a recipe with actual values that your script will use. For example:

"say":{"field":{ "name":"say_first", "kind":"string", "order":1, "default":"Hello Once", "description":"Type in a greeting." }}

Becomes:

"say":"Hello World"

That’s it, you can now use scheduled workflows to solve really big problems…

--

--