GithubHelp home page GithubHelp logo

python-repository-hub / pipen Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pwwang/pipen

0.0 0.0 0.0 5.6 MB

pipen - A pipeline framework for python

Home Page: https://pwwang.github.io/pipen/

License: Apache License 2.0

Python 100.00%

pipen's Introduction

A pipeline framework for python


Pypi Github Building Docs and API Codacy Codacy coverage Deps

Documentation | ChangeLog | Examples | API

Features

  • Easy to use
  • Nearly zero-configuration
  • Nice logging
  • Highly extendable

Installation

pip install -U pipen

Quickstart

example.py

from pipen import Proc, Pipen

class P1(Proc):
    """Sort input file"""
    input = "infile"
    input_data = ["/tmp/data.txt"]
    output = "outfile:file:intermediate.txt"
    script = "cat {{in.infile}} | sort > {{out.outfile}}"

class P2(Proc):
    """Paste line number"""
    requires = P1
    input = "infile"
    output = "outfile:file:result.txt"
    script = "paste <(seq 1 3) {{in.infile}} > {{out.outfile}}"

Pipen().set_starts(P1).run()
> echo -e "3\n2\n1" > /tmp/data.txt
> python example.py
[09/13/21 04:23:37] I main                    _____________________________________   __
[09/13/21 04:23:37] I main                    ___  __ \___  _/__  __ \__  ____/__  | / /
[09/13/21 04:23:37] I main                    __  /_/ /__  / __  /_/ /_  __/  __   |/ /
[09/13/21 04:23:37] I main                    _  ____/__/ /  _  ____/_  /___  _  /|  /
[09/13/21 04:23:37] I main                    /_/     /___/  /_/     /_____/  /_/ |_/
[09/13/21 04:23:37] I main
[09/13/21 04:23:37] I main                                 version: 0.3.2
[09/13/21 04:23:37] I main
[09/13/21 04:23:37] I main    ╭══════════════════════════════ PIPEN-0 ════════════════════════════════╮
[09/13/21 04:23:37] I main    ║  # procs          = 2                                                 ║
[09/13/21 04:23:37] I main    ║  plugins          = ['main', 'verbose-0.0.1']                         ║
[09/13/21 04:23:37] I main    ║  profile          = default                                           ║
[09/13/21 04:23:37] I main    ║  outdir           = pipen-0_results                                   ║
[09/13/21 04:23:37] I main    ║  cache            = True                                              ║
[09/13/21 04:23:37] I main    ║  dirsig           = 1                                                 ║
[09/13/21 04:23:37] I main    ║  error_strategy   = ignore                                            ║
[09/13/21 04:23:37] I main    ║  forks            = 1                                                 ║
[09/13/21 04:23:37] I main    ║  lang             = bash                                              ║
[09/13/21 04:23:37] I main    ║  loglevel         = info                                              ║
[09/13/21 04:23:37] I main    ║  num_retries      = 3                                                 ║
[09/13/21 04:23:37] I main    ║  plugin_opts      = {}                                                ║
[09/13/21 04:23:37] I main    ║  plugins          = None                                              ║
[09/13/21 04:23:37] I main    ║  scheduler        = local                                             ║
[09/13/21 04:23:37] I main    ║  scheduler_opts   = {}                                                ║
[09/13/21 04:23:37] I main    ║  submission_batch = 8                                                 ║
[09/13/21 04:23:37] I main    ║  template         = liquid                                            ║
[09/13/21 04:23:37] I main    ║  template_opts    = {}                                                ║
[09/13/21 04:23:37] I main    ║  workdir          = ./.pipen                                          ║
[09/13/21 04:23:37] I main    ╰═══════════════════════════════════════════════════════════════════════╯
[09/13/21 04:23:37] I main
[09/13/21 04:23:37] I main    ╭───────────────────────────────── P1 ──────────────────────────────────╮
[09/13/21 04:23:37] I main    │ Sort input file                                                       │
[09/13/21 04:23:37] I main    ╰───────────────────────────────────────────────────────────────────────╯
[09/13/21 04:23:37] I main    P1: Workdir: '.pipen/pipen-0/p1'
[09/13/21 04:23:37] I main    P1: <<< [START]
[09/13/21 04:23:37] I main    P1: >>> ['P2']
[09/13/21 04:23:37] I verbose P1: size: 1
[09/13/21 04:23:37] I verbose P1: [0/0] in.infile: /tmp/data.txt
[09/13/21 04:23:37] I verbose P1: [0/0] out.outfile:
                      /home/pwwang/github/pipen/.pipen/pipen-0/p1/0/output/intermediate.txt
[09/13/21 04:23:38] I verbose P1: Time elapsed: 00:00:01.039s
[09/13/21 04:23:38] I main
[09/13/21 04:23:38] I main    ╭═════════════════════════════════ P2 ══════════════════════════════════╮
[09/13/21 04:23:38] I main    ║ Paste line number                                                     ║
[09/13/21 04:23:38] I main    ╰═══════════════════════════════════════════════════════════════════════╯
[09/13/21 04:23:38] I main    P2: Workdir: '.pipen/pipen-0/p2'
[09/13/21 04:23:38] I main    P2: <<< ['P1']
[09/13/21 04:23:38] I main    P2: >>> [END]
[09/13/21 04:23:38] I verbose P2: size: 1
[09/13/21 04:23:38] I verbose P2: [0/0] in.infile:
                      /home/pwwang/github/pipen/.pipen/pipen-0/p1/0/output/intermediate.txt
[09/13/21 04:23:38] I verbose P2: [0/0] out.outfile:
                      /home/pwwang/github/pipen/pipen-0_results/P2/result.txt
[09/13/21 04:23:40] I verbose P2: Time elapsed: 00:00:02.074s
[09/13/21 04:23:40] I main

                PIPEN-0: 100%|████████████████████████████████████████| 2/2 [00:04<00:00, 0.56 procs/s]
> cat ./pipen-0_results/P2/result.txt
1       1
2       2
3       3

Examples

See more examples at examples/ and a more realcase example at: https://github.com/pwwang/pipen-report/tree/master/example

Plugin gallery

Plugins make pipen even better.

pipen's People

Contributors

codacy-badger avatar gitbook-bot avatar marchon avatar osdaf avatar pwwang 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.