Batch job queue for ML inference.
Project description
# dock
Wrapper around Redis for message queues.
## Installation
```bash
pip install dock # pypi
pip install git+https://github.com/vzhong/dock.git # github
```
## Usage
First, start your Redis server.
```python
# server.py
from dock import Dock
dock = Dock('test')
while True:
msg, respond = dock.recv()
print(msg, respond)
print('got message {}'.format(msg))
respond({
'ack': msg,
'msg': 'hello'
})
```
```python
# client.py
from dock import Dock
dock = Dock('test')
for i in range(5):
answer = dock.send('message{}'.format(i))
print(answer)
```
You can see how the server and client interact by running the two files:
```bash
python server.py # in one terminal
python client.py # in another terminal
```
Wrapper around Redis for message queues.
## Installation
```bash
pip install dock # pypi
pip install git+https://github.com/vzhong/dock.git # github
```
## Usage
First, start your Redis server.
```python
# server.py
from dock import Dock
dock = Dock('test')
while True:
msg, respond = dock.recv()
print(msg, respond)
print('got message {}'.format(msg))
respond({
'ack': msg,
'msg': 'hello'
})
```
```python
# client.py
from dock import Dock
dock = Dock('test')
for i in range(5):
answer = dock.send('message{}'.format(i))
print(answer)
```
You can see how the server and client interact by running the two files:
```bash
python server.py # in one terminal
python client.py # in another terminal
```
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 Distribution
dock-0.0.1.tar.gz
(4.0 kB
view details)
File details
Details for the file dock-0.0.1.tar.gz
.
File metadata
- Download URL: dock-0.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0da0695bef6e6951d49fb7dcdd3bcadb451ec92ae1f27c8137a9c5ab7c314be1 |
|
MD5 | 58c98379ad993057e5abe996e0a92a24 |
|
BLAKE2b-256 | da5b97c5bb6aac687651253f5c329f8780653096d2d8581823267585160d5a0b |