Skip to content

Latest commit

 

History

History
 
 

rest

Google Cloud Composer Python Samples

https://gstatic.com/cloudssh/images/open-btn.png

This directory contains samples for Google Cloud Composer. Google Cloud Composer is a managed Apache Airflow service that helps you create, schedule, monitor and manage workflows. Cloud Composer automation helps you create Airflow environments quickly and use Airflow-native tools, such as the powerful Airflow web interface and command line tools, so you can focus on your workflows and not your infrastructure.

Setup

Authentication

This sample requires you to have authentication setup. Refer to the Authentication Getting Started Guide for instructions on setting up credentials for applications.

Install Dependencies

  1. Install pip and virtualenv if you do not already have them. You may want to refer to the Python Development Environment Setup Guide for Google Cloud Platform for instructions.
  1. Create a virtualenv. Samples are compatible with Python 2.7 and 3.4+.

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

    $ pip install -r requirements.txt

Samples

Determine Cloud Storage path for DAGs

https://gstatic.com/cloudssh/images/open-btn.png

To run this sample:

$ python get_dag_prefix.py

usage: get_dag_prefix.py [-h] project_id location composer_environment

Get a Cloud Composer environment via the REST API.

This code sample gets a Cloud Composer environment resource and prints the
Cloud Storage path used to store Apache Airflow DAGs.

positional arguments:
  project_id            Your Project ID.
  location              Region of the Cloud Composer environent.
  composer_environment  Name of the Cloud Composer environent.

optional arguments:
  -h, --help            show this help message and exit