Skip to main content

No project description provided

Project description

Checkpointed - A library for management of nonlinear processing pipelines.


Introduction

The Checkpointed library provides a small interface for chaining pipelines of different operations. The main functionality of the library is the ability to maintain checkpoints for every performed operation.


Examples

from checkpointed import Pipeline, NoopStep

pipeline = Pipeline('example-pipeline')

# A regular input 
input1 = pipeline.add_source(
    NoopStep, name='input-1'
)

# An input whose result is also stored as an output in the file 
# 'input-2-output.txt'
input2 = pipeline.add_source(
    NoopStep, name='input-2', is_sink=True, filename='input-2-output.txt'
)

# A processing step which depends on input1 
node3 = pipeline.add_step(NoopStep, name='node-3')
pipeline.connect(input1, node3)

# A processing step which depends on both input2 and node3
node4 = pipeline.add_step(NoopStep, name='node-4')
pipeline.connect(input2, node4)
pipeline.connect(node3, node4)

# Output step which depends on node4
out5 = pipeline.add_sink(NoopStep, name='out-5', filename='out-5-output.txt')
pipeline.connect(node4, out5)

# Build the execution plan
plan = pipeline.build()

# Configuration information for all the steps.
# Empty because NoopStep does not require configuration.
config = {
    input1: {},
    input2: {},
    node3: {},
    node4: {},
    out5: {}
}

# (optional) setup a logger 
import logging

logger = logging.getLogger('example-pipeline')
logger.addHandler(logging.StreamHandler())

# Run the pipeline
plan.execute(
    # Configuration used to instantiate the steps in the pipeline.
    # Must have one entry for every step.
    config_by_step=config,

    # Store `input-2-output.txt' and `out-5-output.txt' 
    # in directory ./out/example-pipeline
    output_directory='out',

    # Store checkpoints for every pipeline step 
    # in directory ./checkpoints/example-pipeline
    checkpoint_directory='checkpoints',

    # Pass in a logger object in order to enable logging.
    logger=logger
)

With some actual arguments applied:

from checkpointed import Pipeline, NoopStep

pipeline = Pipeline('example-pipeline')

node = pipeline.add_source(NoopStep, is_sink=True, filename='out.txt')

plan = pipeline.build()

import logging

logger = logging.getLogger('example-pipeline')
logger.addHandler(logging.StreamHandler())

plan.execute(
    config_by_step={
        node: {'echo-io': True}
    },
    output_directory='out',
    checkpoint_directory='checkpoints',
    logger=logger
)

You will get an error on an invalid argument:

from checkpointed import Pipeline, NoopStep

pipeline = Pipeline('example-pipeline')

node = pipeline.add_source(NoopStep, is_sink=True, filename='out.txt')

plan = pipeline.build()

import logging

logger = logging.getLogger('example-pipeline')
logger.addHandler(logging.StreamHandler())

plan.execute(
    config_by_step={
        node: {'echo-execute': True, 'echo-io': False}
    },
    output_directory='out',
    checkpoint_directory='checkpoints',
    logger=logger
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

checkpointed-core-1.0.0.tar.gz (57.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

checkpointed_core-1.0.0-py3-none-any.whl (50.3 kB view details)

Uploaded Python 3

File details

Details for the file checkpointed-core-1.0.0.tar.gz.

File metadata

  • Download URL: checkpointed-core-1.0.0.tar.gz
  • Upload date:
  • Size: 57.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for checkpointed-core-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d29fc22855560245413d7ba302dd375e75054405b185ea9cabf2e632be930035
MD5 77474d76aaa72452ed082ab841b8ace5
BLAKE2b-256 8dd5f8534bbc23208849fc7379bf1c5d0d2bf16f8f0d68a5d91e61ca0e821a25

See more details on using hashes here.

File details

Details for the file checkpointed_core-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for checkpointed_core-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6b7f4d6155a5d911470bf9361c49f6f225bc8733da81005db9f6b86a3b651e50
MD5 130ee32c5ba28f636228cd7febafaed0
BLAKE2b-256 14b970932036c2deb52d0b72cf3237d4e93f4879a5448069a3624091e106712e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page