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()
Metadata
Release files for distpipe 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| distpipe-0.0.1.tar.gz | 4.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| distpipe-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.4 kB
Release files / distpipe-0.0.1.tar.gz
| Download URL | distpipe-0.0.1.tar.gz |
|---|---|
| Size | 4.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
554915ea54d8ddf43271b5f383f5f4d9adc8e12bfca61f04eaa284998b5e13f8
|
|
BLAKE2b-256 checksum How to use checksums |
969242dcdd9c2cb80ac18b175e4ab60c9da1d01bc720fa93e5d058b1198acad0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|
Release files / distpipe-0.0.1-py3-none-any.whl
| Download URL | distpipe-0.0.1-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b4a21a853e96021c444723a444091c5e320abfd78d5d85c7287ce88748c70dc9
|
|
BLAKE2b-256 checksum How to use checksums |
467e524566511909711df15c67751bc0147e890ac0923ee44a3b158b60e7cf9a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.21
|