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.2.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyqflow-1.1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 94f208f0a9c4bee6e440d1b51c083ce1629640e5748d2232c1a1b8832452450c
MD5 5107195562cffcc8f228627d7e1ee287
BLAKE2b-256 12f0aea69313551b0eab26d3a80fe920812915a9a54e028a83f0b3ec7a08f207

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyqflow-1.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 7f1aca285f2581105b054fdc4de636d4b336275f35e4a83136e0a98281cade0e
MD5 ce2c8f8f9745f785fdfbe075fd49c187
BLAKE2b-256 3166cbfdfb130b29a6c3a85f0d58ae194069f93cbd4a5283bd2e194d918a0a91

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