Skip to main content

DistPipe

DistPipe is a distributed framework to implement device-cloud collaborative workflow.

Usage

Step 0: Define connection

Specify the network topology using a JSON file:

{
    "client_addr": ["192.168.1.126", 6000],
    "server_addr": ["192.168.1.126", 6001],
    "role": "server"
}

Here, the field role indicates the current platform (server or client). Next, define a Router to connect the device and the cloud.

from distpipe.transport import Router

router = Router.from_json("node_map.client.json")

Step 1: Define custom tasks

from distpipe.distpipe import Task

class Identical(Task):

    def process(self, data):
        return data[0]

class Log(Task):

    def process(self, data):
        return data[0] + 1

class Add(Task):

    def process(self, data):
        return data[0] + data[1]

identical = Identical('identical', role='client')
log = Log('log', role='client')
add = Add('add', role='server')

Step 2: Define pipeline as DAG

from distpipe.distpipe import Pipe

pipe = Pipe(router=router)
pipe.add(srcs=[identical], tgt=log)
pipe.add(srcs=[identical, log], tgt=add)
pipe.set_io(identical, add)
pipe.start()

Step 3: Launch the pipeline

if router.role == "client":
    pipe.istream.put(1)
    print(pipe.ostream.get()[0])
    pipe.istream.put(2)
    print(pipe.ostream.get()[0])

Optional: Shutdown the system

router.shutdown()

Download files

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

Source Distribution

distpipe-0.0.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

distpipe-0.0.1-py3-none-any.whl (5.6 kB view details)

Uploaded Python 3

File details

Details for the file distpipe-0.0.1.tar.gz.

File metadata

  • Download URL: distpipe-0.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for distpipe-0.0.1.tar.gz
Algorithm Hash digest
SHA256 554915ea54d8ddf43271b5f383f5f4d9adc8e12bfca61f04eaa284998b5e13f8
MD5 f8c8e4ec8596727745ecd46528085034
BLAKE2b-256 969242dcdd9c2cb80ac18b175e4ab60c9da1d01bc720fa93e5d058b1198acad0

See more details on using hashes here.

File details

Details for the file distpipe-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: distpipe-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for distpipe-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4a21a853e96021c444723a444091c5e320abfd78d5d85c7287ce88748c70dc9
MD5 984a96d63d1d6e8c2383439d3e9a53f9
BLAKE2b-256 467e524566511909711df15c67751bc0147e890ac0923ee44a3b158b60e7cf9a

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 files

Supported by

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