https://github.com/daguich/ipcbroker
Interprocess communication framework for python
https://github.com/daguich/ipcbroker
Last synced: 5 months ago
JSON representation
Interprocess communication framework for python
- Host: GitHub
- URL: https://github.com/daguich/ipcbroker
- Owner: DaGuich
- License: mit
- Created: 2017-11-07T20:59:38.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-04T11:16:44.000Z (over 8 years ago)
- Last Synced: 2025-04-08T19:50:13.840Z (about 1 year ago)
- Language: Python
- Homepage:
- Size: 26.4 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Python IPC-Broker
| Branch | Status |
| ------ | ------ |
| master | [](https://www.codacy.com/app/matthias.gilch.mg/ipcbroker?utm_source=github.com&utm_medium=referral&utm_content=DaGuich/ipcbroker&utm_campaign=Badge_Grade) [](https://circleci.com/gh/DaGuich/ipcbroker/tree/master) |
The IPC-Broker manages the communication between python multiprocessing processes. It provides an interface
to call methods that are provided in another process. The usage is very simple.
```python
import ipcbroker
# in main process
broker = ipcbroker.Broker().start()
# create clients before starting all processes
alice = ipcbroker.Client(broker)
bob = ipcbroker.Client(broker)
```
```python
import time
# in child process (with a client as parameter)
def add(a, b):
return a + b
alice.start()
alice.register_function('add', add)
# wait for registering of other process
time.sleep(2)
# call own add function
alice.add(2, 3) # returns 5
# or bobs sub function
alice.sub(5, 2) # return 3
```
```python
import time
# in another child process
def sub(a, b):
return a - b
bob.start()
bob.register_function('sub', sub)
time.sleep(2)
# call alice's add function
bob.add(2, 3) # returns 5
```