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 hashes)

Uploaded Python 3

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