Git Product home page Git Product logo

airflow-zip-operator-plugin's Introduction

airflow-zip-operator-plugin

Description

A plugin to Apache Airflow (Documentation: https://pythonhosted.org/airflow/, Source Code: https://github.com/apache/incubator-airflow) to allow you to run Zip and UnZip commands as an Operator from Workflows

TODO List

  • Print out metrics about zip file (compression, size, etc)
  • Test extensively

How do Deploy

  1. Copy the zip_operator_plugin.py file into the Airflow Plugins directory

  2. Restart the Airflow Services

  3. Create or Deploy DAGs which utilize the Operator

  4. Your done!

ZipOperator

Operator Definition

class airflow.operators.ZipOperator(input_file_path, output_file_path, *args, **kwargs)

Bases: airflow.operators.BaseOperator

An operator which takes in a path to a file and zips the contents to a location you define.

Parameters:

  • path_to_file_to_zip (string) - Full path to the file you want to Zip
  • path_to_save_zip (string) - Full path to where you want to save the Zip file

Example

```
from airflow.operators import ZipOperator

zip_task = ZipOperator(
    task_id='zip_task',
    path_to_file_to_zip="/path/to/file",
    path_to_save_zip="/path/to/file.zip",
    dag=dag)
```

UnzipOperator

Operator Definition

class airflow.operators.UnzipOperator(input_file_path, output_file_path, *args, **kwargs)

Bases: airflow.operators.BaseOperator

An operator which takes in a path to a zip file and unzips the contents to a location you define.

Parameters:

  • path_to_zip_file (string) - Full path to the zip file you want to Unzip
  • path_to_unzip_contents (string) - Full path to where you want to save the contents of the Zip file you're Unzipping

Example

```
from airflow.operators import UnzipOperator

unzip_task = UnzipOperator(
    task_id='unzip_task',
    path_to_zip_file="/path/to/file.zip",
    path_to_unzip_contents="/path/to/unzip/to/",
    dag=dag)
```

airflow-zip-operator-plugin's People

Contributors

rssanders3 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.