A tutorial presents several practical examples of how to build DAGs in Apache Airflow

Overview

Apache Airflow - Python Brasil 2021

Este tutorial apresenta vários exemplos práticos de como construir DAGs no Apache Airflow.

Background

Apache Airflow é uma das principais ferramentas de orquestração de workflows, onde você define as tarefas como Directed Acyclic Graphs (DAGs). O Airflow permite que você construa pipelines de dados escrevendo apenas códigos Python. Quando os workflows são definidos como código, eles se tornam manuteníveis, versionáveis, testáveis e colaborativos.

Rodando localmente com Pyenv

Você vai precisar de um ambiente virtual com python 3.6+ (recomendamos o 3.9).

Pyenv

Caso não tenha instalado na maquina, você pode usar o pyenv para ter multiplas versoes do python e criar seu ambiente virtual com ele. Siga a documentação oficial para instalar o pyenv na sua máquina:

Instale o Pyhton 3.9:

$ pip install 3.9.7
$ pyenv virtualenv 3.9.7 pybr-airflow
$ pyenv local pybr-airflow

Caso você não tenha o pip instalado, instale ele na sua máquina seguindo o tutorial abaixo:

Instalando o Airflow

Depois do ambiente virtual instalado, você vai precisar do apache-airflow e do apache-airflow-providers-docker instalados. Você pode fazer assim:

$ pip install apache-airflow apache-airflow-providers-docker

Depois você precisa configurar o airflow; para isso siga estes passos:

$ airflow db init
$ airflow users create --username=admin --firstname test --lastname test --role Admin --email [email protected]

Agora você pode rodar o airflow; para isso execute o seguinte comando:

$ airflow webserver -p 8081

Agora acesse a seguinte URL: http://localhost:8081.

Troubleshooting: Airflow não sendo reconhecido

Caso o comando do airflow não tiver sendo reconhecido, verifique se o ~/.local/bin na sua variável de ambiente PATH está configurada corretamente:

PATH=$PATH:~/.local/bin

Você também pode iniciar o Airflow com:

$ python -m airflow

Rodando localmente com Docker Compose

Pré-requisitos

Para rodar localmente é necessário, você atender aos seguintes pré-requisitos:

  • Instalar o Docker Community Edition (CE) na sua máquina (link de instalação aqui). É recomendável que sua máquina tenha ao menos 4GB de RAM livres.
  • Instalar o Docker Compose v1.29.1 ou alguma versão mais nova na sua máquina (link de instalação aqui).

Iniciar o ambiente

Para iniciar o ambiente, basta executar o comando abaixo:

make start-airflow

Destruir o ambiente

Para limpar o ambiente, basta executar o seguinte comando:

make reset-airflow

You might also like...
A set of scripts for a two-step procedure to measure the value of access to destinations across several modes of travel within a geographic area.

A set of scripts for a two-step procedure to measure the value of access to destinations across several modes of travel within a geographic area.

We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them.
We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them.

We want to check several batch of web URLs (1~100 K) and find the phishing website/URL among them. This module is designed to do the URL/web attestation by using the API from NUS-Phishperida-Project.

Using Python to parse through email logs received through several backup systems.

outlook-automated-backup-control Backup monitoring on a mailbox: In this mailbox there will be backup logs. The identification will based on the follo

Graphene Metanode is a locally hosted node for one account and several trading pairs, which uses minimal RAM resources.

Graphene Metanode is a locally hosted node for one account and several trading pairs, which uses minimal RAM resources. It provides the necessary user stream data and order book data for trading in a format one would expect from a centralized exchange API.

《practical python programming》的中文翻译

欢迎光临 大约 25 年前,当我第一次学习 Python 时,发现 Python 竟然可以被高效地应用到各种混乱的工作项目上,我立即被震惊了。15 年前,我自己也将这种乐趣教授给别人。教学的结果就是本课程——一门实用的学习 Python的课程。

A fancy and practical functional tools

Funcy A collection of fancy functional tools focused on practicality. Inspired by clojure, underscore and my own abstractions. Keep reading to get an

Retrying is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just about anything.

Retrying Retrying is an Apache 2.0 licensed general-purpose retrying library, written in Python, to simplify the task of adding retry behavior to just

Apache Superset out of box version(Windows 64-bit)

superset_app Apache Superset out of box version (Windows 64bit) prepare job download 3 files python-3.8.10-embed-amd64.zip get-pip.py python_geohash‑0

The Python agent for Apache SkyWalking
The Python agent for Apache SkyWalking

SkyWalking Python Agent SkyWalking-Python: The Python Agent for Apache SkyWalking, which provides the native tracing abilities for Python project. Sky

Owner
Jusbrasil
Jusbrasil
Viewflow is an Airflow-based framework that allows data scientists to create data models without writing Airflow code.

Viewflow Viewflow is a framework built on the top of Airflow that enables data scientists to create materialized views. It allows data scientists to f

DataCamp 114 Oct 12, 2022
Yet another Airflow plugin using CLI command as RESTful api, supports Airflow v2.X.

中文版文档 Airflow Extended API Plugin Airflow Extended API, which export airflow CLI command as REST-ful API to extend the ability of airflow official API

Eric Cao 106 Nov 9, 2022
Project repository of Apache Airflow, deployed on Docker in Amazon EC2 via GitLab.

Airflow on Docker in EC2 + GitLab's CI/CD Personal project for simple data pipeline using Airflow. Airflow will be installed inside Docker container,

Ammar Chalifah 13 Nov 29, 2022
Backtest framework based on DAGs

MultitaskQueue It's a simple framework based on three composed concepts: Task: A task is the smaller unit of execution or simple a node in the DAG, ev

null 4 Dec 9, 2021
This repo presents you the official code of "VISTA: Boosting 3D Object Detection via Dual Cross-VIew SpaTial Attention"

VISTA VISTA: Boosting 3D Object Detection via Dual Cross-VIew SpaTial Attention Shengheng Deng, Zhihao Liang, Lin Sun and Kui Jia* (*) Corresponding a

null 104 Dec 29, 2022
Airflow Operator for running Soda SQL scans

Airflow Operator for running Soda SQL scans

Todd de Quincey 7 Oct 18, 2022
An Airflow operator to call the main function from the dbt-core Python package

airflow-dbt-python An Airflow operator to call the main function from the dbt-core Python package Motivation Airflow running in a managed environment

Tomás Farías Santana 93 Jan 8, 2023
Repositório para estudo do airflow

airflow-101 Repositório para estudo do airflow Docker criado baseado no tutorial Exemplo de API da pokeapi Para executar clone o repo execute as confi

Gabriel (Gabu) Bellon 1 Nov 23, 2021
A reproduction repo for a Scheduling bug in AirFlow 2.2.3

A reproduction repo for a Scheduling bug in AirFlow 2.2.3

Ilya Strelnikov 1 Feb 9, 2022
A data engineering project with Kafka, Spark Streaming, dbt, Docker, Airflow, Terraform, GCP and much more!

Streamify A data pipeline with Kafka, Spark Streaming, dbt, Docker, Airflow, Terraform, GCP and much more! Description Objective The project will stre

Ankur Chavda 206 Dec 30, 2022