Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 1.91 KB

File metadata and controls

55 lines (37 loc) · 1.91 KB

Google Cloud logo

Cloud Workflows Quickstart – Python

This sample shows how to execute Cloud Workflows and wait for the result of a workflow execution using the Python client libraries.

Setup

  1. Deploy the workflow, myFirstWorkflow:

    1. Copy the YAML from this file: https://github.com/GoogleCloudPlatform/python-docs-samples/blob/main/workflows/cloud-client/myFirstWorkflow.workflows.yaml
    2. Paste the YAML into a file called myFirstWorkflow.workflows.yaml.
    3. Run the command: gcloud workflows deploy myFirstWorkflow --source myFirstWorkflow.workflows.yaml

Run the Quickstart

Install pip and virtualenv if you do not already have them.

For more information, refer to the Python Development Environment Setup Guide for Google Cloud.

  1. Create a virtualenv. Samples are compatible with Python 3.9+.

    virtualenv env
    source env/bin/activate
  2. Install the dependencies needed to run the samples.

    pip install -r requirements.txt
  3. Start the application, setting your project name in an environment variable, GOOGLE_CLOUD_PROJECT:

    export GOOGLE_CLOUD_PROJECT=your-project-id
    python main.py
  4. Observe the results:

    In stdout, you should see a JSON response from your workflow like the following, depending on the current weekday in Amsterdam.

    ["Wednesday","Wednesday Night Wars","Wednesday 13","Wednesday Addams","Wednesday Campanella","Wednesdayite","Wednesday Martin","Wednesday Campanella discography","Wednesday Night Hockey (American TV program)","Wednesday Morning, 3 A.M."]