Skip to main content

Rats Processors

Project description

rats-processors

In you python project or Jupyter notebook, you can compose a pipeline as follows:

from typing import NamedTuple

import pandas as pd
from rats.apps import PipelineContainer
from rats.processors import CombinedPipeline, ExecutablePipeline, task, pipeline


class DataOut(NamedTuple):
    data: pd.DataFrame


class MyContainer(PipelineContainer):
    @task
    def load_data(self) -> DataOut:
        return DataOut(data=pd.read_csv("data.csv"))

    @task
    def train_model(self, data: pd.DataFrame):
        return {"model": "trained"}

    @pipeline
    def my_pipeline(self) -> ExecutablePipeline:
        load_data = self.load_data()
        train_model = self.get(train_model)
        return self.combine(
            pipelines=[load_data, train_model],
            dependencies=(train_model.inputs.data << load_data.outputs.data),
        )

and run it like this:

container = MyContainer()  # initialize your container
p = container.get("my_pipeline")  # public method to get a service from a container
container.draw(p)
container.run(p)

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

rats_processors-0.1.3.dev18-py3-none-any.whl (82.3 kB view details)

Uploaded Python 3

File details

Details for the file rats_processors-0.1.3.dev18-py3-none-any.whl.

File metadata

File hashes

Hashes for rats_processors-0.1.3.dev18-py3-none-any.whl
Algorithm Hash digest
SHA256 027410e0d2408a01b2f91610526020f72e41b482b536e5db45e0a0b1c8247be0
MD5 b9dc2c227198336bad4755293a419a43
BLAKE2b-256 e781fcf2da542adb7bc487e667dc3c414eae63f62688eaab57752621df46e829

See more details on using hashes here.

Supported by

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