Coder Social home page Coder Social logo

airflow_with_dataflow's Introduction

Airflow with Dataflow

Requirements

  • Python 2
  • Google Cloud with Composer and Dataflow activated

Setup

# this will create a virtual environment without affecting anything on your system
virtualenv -p python2 dataflow

# activate virual environment
source dataflow/bin/activate

# install necessary packages
pip install --upgrade setuptools apache-beam
pip install --upgrade apache-beam[gcp]
pip install -r requirements.txt

Running dataflow jobs

# build the exta package
python setup.py sdist --formats=gztar

# testing locally
python etl.py --runner=DirectRunner --setup-file=./setup.py --requirements-file=./requirements.txt --extra_package=./dist/Common-1.0.0.tar.gz --start_date=2018-01-01 --end_date:2018-01-02

# running on dataflow
python etl.py --runner=DataflowRunner --setup-file=./setup.py --requirements-file=./requirements.txt --extra_package=./dist/Common-1.0.0.tar.gz --start_date=2018-01-01 --end_date:2018-01-02

To run this from airflow

  • TODO: add details

Extra guides

Converting a local package for dataflow's extra_package

  • Create setup.py outside of local package directory with following content
from setuptools import setup, find_packages

setup(
    name="Common",
    version="1.0.0",
    install_requires=['pandas==0.22.0', 'numpy==1.14.2'],
    author="Vikram Tiwari",
    author_email="[email protected]",
    description=("Custom python utils needed for dataflow cloud runner"),
    packages=find_packages(),
    package_data={
        "Common": [".credentials/*.json"]
    },
    include_package_data=True)
  • Build package
python setup.py sdist --formats=gztar

airflow_with_dataflow's People

Contributors

vikramtiwari avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.