Tap (Task Application)

tap n. to draw a supply from a resource

A configurable, distributable workflow framework.

Description

Tap allows the construction of imperative and dependency-based workflows that may be defined, configured, and run from the command line. The tasks and joins composing a workflow are easy to test, subclass, and distribute as gems.

Tap is the core of the Tap-Suite which provides a standard library of tasks, generators, test utilities, and a server to execute workflows via HTTP.

Usage

Tasks are defined as subclasses of Tap::Task.

[lib/goodnight.rb]
# Goodnight::task your basic goodnight moon task
# Says goodnight with a configurable message.
class Goodnight < Tap::Task
  config :message, 'goodnight'           # a goodnight message
  def process(name)
    "#{message} #{name}"
  end
end

Tap automatically discovers and pulls documentation out to generate manifests:

% tap run -T
  sample:
    goodnight   # your basic goodnight moon task
  tap:
    dump        # the default dump task
    load        # the default load task

And help:

% tap run -- goodnight --help
Goodnight -- your basic goodnight moon task
-------------------------------------------------------------------------------- 
  Says goodnight with a configurable message.
-------------------------------------------------------------------------------- 
usage: tap run -- goodnight NAME
configurations:
        --message MESSAGE            a goodnight message
options:
        --help                       Print this help
        --name NAME                  Specifies the task name
        --config FILE                Specifies a config file

Tasks are available immediately for use in workflows. The process method takes inputs from the command line and passes its result to other tasks.

% tap run -- goodnight moon --: dump
goodnight moon

Tasks may be configured as if they were individual executables:

% tap run -- goodnight world --message hello --: dump
hello world

Workflow Syntax

Workflows are specified on the command line using argument vectors separated by option breaks. The argument vectors define the tasks and modifications to the breaks (–: or –[i,j]) specify joins.

A simple sequence:

% tap run -- load 'goodnight moon' --: dump
goodnight moon

A more formal way of specifying a sequence:

% tap run -- load 'goodnight moon' -- dump --[0][1]
goodnight moon

A fork:

% tap run -- load 'goodnight moon' -- dump -- dump --[0][1,2]
goodnight moon
goodnight moon

A merge (note that dump receives the inputs in serial):

% tap run -- load goodnight -- load moon -- dump --[0,1][2]
goodnight
moon

A synchronized merge where the results of each input are collected into an array before being passed to dump. The printout is: [‘goodnight’, ‘moon’].to_s

% tap run -- load goodnight -- load moon -- dump --[0,1][2].sync
goodnightmoon

Known Issues

Tap::Env and Tap::Schema are still in flux and have poor documentation. Neither should be treated as stable.

Installation

Tap is available as a gem on RubyForge. Use:

% gem install tap

Tap requires an updated version of RubyGems (>= 1.2.0). To check the version and update RubyGems:

% gem --version
% gem --update system

Info

Copyright © 2006-2009, Regents of the University of Colorado.

Developer

Simon Chiang, Biomolecular Structure Program, Hansen Lab

Support

CU Denver School of Medicine Deans Academic Enrichment Fund

License

MIT-Style