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

Owner
Jusbrasil
Jusbrasil
Back-end API for the reternal framework

RE:TERNAL RE:TERNAL is a centralised purple team simulation platform. Reternal uses agents installed on a simulation network to execute various known

Joey Dreijer 7 Apr 15, 2022
Blender 2.80+ Timelapse Capture Tool Addon

SimpleTimelapser Blender 2.80+ Timelapse Capture Tool Addon Developed for Blender 3.0.0, tested working on 2.80.0 It's no ZBrush undo history but it's

4 Jan 19, 2022
Runtime Type Checking in Python 3

typo This package intends to provide run-time type checking for functions annotated with argument type hints (standard library typing module in Python

Ivan Smirnov 26 Dec 13, 2022
Simple Python API for the Ergo Platform Explorer

Ergo is a "Resilient Platform for Contractual Money." It is designed to be a platform for applications with the main focus to provide an efficient, se

7 Jul 06, 2021
Python library for creating PEG parsers

PyParsing -- A Python Parsing Module Introduction The pyparsing module is an alternative approach to creating and executing simple grammars, vs. the t

Pyparsing 1.7k Jan 03, 2023
Improving the Transferability of Adversarial Examples with Resized-Diverse-Inputs, Diversity-Ensemble and Region Fitting

Improving the Transferability of Adversarial Examples with Resized-Diverse-Inputs, Diversity-Ensemble and Region Fitting

Junhua Zou 7 Oct 20, 2022
RDFLib is a Python library for working with RDF, a simple yet powerful language for representing information.

RDFLib RDFLib is a pure Python package for working with RDF. RDFLib contains most things you need to work with RDF, including: parsers and serializers

RDFLib 1.8k Jan 02, 2023
Python Common things by Problem Fighter Library, (Exception, Debug Log, etc.)

In the name of God, the Most Gracious, the Most Merciful. PF-PY-Common Documentation Install and update using pip: pip install -U xxxx Please find the

Problem Fighter 3 Jan 15, 2022
Your self-hosted bookmark archive. Free and open source.

Your self-hosted bookmark archive. Free and open source. Contents About LinkAce Support Setup Contribution About LinkAce LinkAce is a self-hosted arch

Kevin Woblick 1.7k Jan 03, 2023
Nextstrain build targeted to Omicron

About This repository analyzes viral genomes using Nextstrain to understand how SARS-CoV-2, the virus that is responsible for the COVID-19 pandemic, e

Bedford Lab 9 May 25, 2022
Automator anble you to create automations on your system

WELCOME TO AUTOMATOR BETA This programm is able to create automations on your system. This programm is only an experimantal release; infact it works v

Davide 1 Jan 12, 2022
Bookmarkarchiver - Python script that archives all of your bookmarks on the Internet Archive

bookmarkarchiver Python script that archives all of your bookmarks on the Internet Archive. Supports all major browsers. bookmarkarchiver uses the off

Anthony Chen 3 Oct 09, 2022
Percolation simulation using python

PythonPercolation Percolation simulation using python Exemple de percolation : Etude statistique sur le pourcentage de remplissage jusqu'à percolation

Tony Chouteau 1 Sep 08, 2022
Let’s Play with Python3

Python3-FirstEdition a bunch of python programs and stuff Super Important Notice THIS IS LICENSED UNDER GNU PUBLIC LICENSE V3 also, refer to Contribut

Jym Patel 2 Nov 24, 2022
Old versions of Deadcord that are problematic or used as reference.

⚠️ Unmaintained and broken. We have decided to release the old version of Deadcord before our v1.0 rewrite. (which will be equiped with much more feat

Galaxzy 1 Feb 10, 2022
A inspector to be able to view and edit Qt style sheet while an application is running

Qt Style Sheet Inspector An inspector widget to view and modify the style sheet of a Qt app at runtime. Usage In order to use the inspector widget on

ESSS 46 Dec 10, 2022
This script is written with Python for selling steam community items automatically.

SteamCommunityItemAutoSell Description This script is written with Python for selling steam community items automatically. Install git clone https://g

14 Oct 26, 2022
Fly DCS without a joystick

Intro Usage Delete all mouse view axis Install DCSEasyControlExports to your "Saved Games/DCS/" Path python DCSEasyControl/main.py Set DCS to F12 view

XuHao 36 Dec 27, 2022
A small project of two newbies, who wanted to learn something about Python language programming, via fun way.

HaveFun A small project of two newbies, who wanted to learn something about Python language programming, via fun way. What's this project about? Well.

Patryk Sobczak 2 Nov 24, 2021