This part of the documentation covers all the interfaces of pypette.

Gate Object

class pypette.Gate(value)[source]

Different kinds of gating allowed for pipes.

EXECUTE_ALL = 1
FAIL_FAST = 0

BashJob Object

class pypette.BashJob(cmd: List[str])[source]

Class to format bash commands as pipeline jobs.

Job Object

class pypette.Job(function: Callable[[...], Any], args: Union[Tuple, Tuple[Any]] = (), kwargs: Union[Dict, Dict[Any, Any]] = {})[source]

Class to format python methods as pipeline jobs.

Pipe Object

class pypette.Pipe(name: str, gate: pypette.pipes.Gate = Gate.FAIL_FAST)[source]

Class to define the pipeline structure.

add_dependency(*args)[source]

Method to add dependency of one pipe on another.

Parameters

args – Pipes to be added as dependency for this pipeline.

add_jobs(jobs: List[Union[pypette.jobs.Job, pypette.jobs.BashJob, pypette.pipes.Pipe]], run_in_parallel: bool = False)[source]

Method to add jobs to pipeline.

Parameters
  • jobs – List of jobs/pipes to run.

  • run_in_parallel – This flag when set to False(default) runs the list of jobs given one after another. This flag if set to True runs the jobs/pipes submitted in parallel threads.

add_stage(*args)[source]

Method to add stages of pipeline. Jobs are to be given comma separated and all the jobs given form a single stage. Another way to add jobs to a pipeline in builder pattern.

Parameters

args – Jobs to be added. Adds comma separated list in parallel or a single job as a stage.

dependency()[source]

Method to check for success of pipelines listed as dependency.

graph() None[source]

Method to print the structure of the pipeline.

report() None[source]

Method to pretty print the report.

run()[source]

Method to run the pipeline.

ThreadState Object

class pypette.ThreadState(value)[source]

State in which a thread can be in.

FAILED = 1
INIT = 2
RUNNING = 3
SUCCESS = 4

ThreadWrapper Object

class pypette.ThreadWrapper(job: Any)[source]

Wrapper around a thread to allow for exception handling and safe job execution.

property exception: Optional[Exception]

Exception thrown by thread if any.

property job: Any

Job being run by the thread.

run() None[source]

Runs the thread in an exception free way.

property state: pypette.threadwrapper.ThreadState

Thread’s current state.