Code Monkey home page Code Monkey logo

dea-airflow's Introduction

Geoscience Australia DEA Airflow DAGs repository

Deployment Workflow

This repository contains two branches, master and develop.

The master branch requires Pull Requests and code reviews to merge code into it. It deploys automatically to the Production (Sandbox) Airflow deployment.

The develop branch accepts pushes directly, or via Pull Request, and deploys automatically to the Development Airflow.

We're not happy with this strategy, and are looking for an alternative that doesn't have us deploying and inadvertently running code in multiple places by accident, but haven't come up with anything yet.

Development Using Docker

If you have Docker available, by far the easiest development setup is to use Docker Compose. Full instruction is available from here: https://airflow.apache.org/docs/apache-airflow/stable/start/docker.html

First, initialise some environment variables:

mkdir ./dags ./logs ./plugins # you will notice plugins and dags folder already exist
echo -e "AIRFLOW_UID=$(id -u)\nAIRFLOW_GID=0" >> .env

Then start up docker-compose:

docker-compose up airflow-init
docker-compose up

Connect to the Local Airflow Webserver in your browser, and login with Username: airflow, Password: airflow.

Troubleshooting

if you are experiencing issues with the docker-compose file, please ensure to check your docker-compose version, it is confirmed to work with version 1.29.2

ubuntu@:~/dea-airflow$ docker-compose version
docker-compose version 1.29.2, build 5becea4c
docker-py version: 5.0.0
CPython version: 3.7.10
OpenSSL version: OpenSSL 1.1.0l  10 Sep 2019

Local Editing of DAG's

DAGs can be locally edited and validated. Development can be done in conda or venv according to developer preference. Grab everything airflow and write DAGs. Use autopep8 and pylint to achieve import validation and consistent formatting as the CI pipeline for this repository matures.

pip install apache-airflow[aws,kubernetes,postgres,redis,ssh,celery] -c constraints.txt
pip install pylint pylint-airflow

pylint dags plugins

Pre-commit setup

A pre-commit config is provided to automatically format and check your code changes. This allows you to immediately catch and fix issues before you raise a failing pull request (which run the same checks under Travis).

If you don't use Conda, install pre-commit from pip:

pip install pre-commit

If you do use Conda, install from conda-forge (required because the pip version uses virtualenvs which are incompatible with Conda's environments)

conda install pre_commit

Now install the pre-commit hook to the current repository:

pre-commit install

Your code will now be formatted and validated before each commit. You can also invoke it manually by running pre-commit run --all-files

dea-airflow's People

Contributors

alexgleith avatar bluetyson avatar dunkgray avatar jellis avatar jm-ga avatar kieranricardo avatar nikitagandhi avatar omad avatar pindge avatar tmcadam avatar uchchwhash avatar whatnick avatar

Watchers

 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.