Skip to main content

API for creating async workflows.

Project description

image

Qflow is a Python library tailored for asynchronous orchestration of machine learning pipelines. It allows users to define their pipelines declaratively, with the flexibility for processing at each stage to run either remotely or locally. The library supports a wide range of operations, which can be customized with user-defined Python functions.

Instalation

Install

clone repo and install requirements.txt in a Python>=3.7.0 environment.

pip install -r requirements.txt
Example

Simple wordcount example with no remote stages. We can define a qflow pipeline as follows:

from qflow import (
    QWorkflow,
    QFileSource,
    QFlatMap,
    QNativeMap,
    QAggregate
)
from qflow.functools import fst, snd, head


class WordCount(QWorkflow):

    def forward(self, input_text):
        
        results = (
            QFileSource(input_text) 
            | QFlatMap(
                lambda line: line.split()
                ) 
            | QNativeMap(
                lambda word: (word, 1)
                ) 
            | QAggregate(
                key_factory = fst
                )
            | QNativeMap(
                lambda words: ( fst(head(words)), sum(map(snd, words)) )
                )
        )

        return results

To use this pipeline we can run it as follows:

# create the processing pipeline.
workflow = WordCount()

# run the pipeline with the file "input.txt" as input.
results = workflow("input.txt")

print(results)

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

pyqflow-1.1.1.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

pyqflow-1.1.1-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file pyqflow-1.1.1.tar.gz.

File metadata

  • Download URL: pyqflow-1.1.1.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for pyqflow-1.1.1.tar.gz
Algorithm Hash digest
SHA256 e729fc26248565dadf6282e96deba535e399d90f30d409612098f6aaa6c058e7
MD5 452a12e9864d91448736f55de45d49ff
BLAKE2b-256 f947de9e7bd036aea8d56317c220045886863fcf113210331143c685350eb07c

See more details on using hashes here.

File details

Details for the file pyqflow-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyqflow-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.8.18

File hashes

Hashes for pyqflow-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4110f39db96bd91050afa1e8bec1715a8b74b8d87cbdcc9f4606a709a790ab3f
MD5 0891487a08e4468f4a63f59d5363c977
BLAKE2b-256 92ba83444a8ca7839ded8944a64da2203bdc72358dc583dab362a23fd2319201

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