Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/d-chambers/srpo
simple remote python objects
https://github.com/d-chambers/srpo
Last synced: about 1 month ago
JSON representation
simple remote python objects
- Host: GitHub
- URL: https://github.com/d-chambers/srpo
- Owner: d-chambers
- License: other
- Created: 2019-07-21T04:24:58.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-09-11T01:15:27.000Z (2 months ago)
- Last Synced: 2024-09-12T05:15:00.455Z (2 months ago)
- Language: Python
- Size: 62.5 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# srpo
Simple Remote Python Objects (SRPO) enables the sharing of objects between
processes. It works by forking the process and allowing proxies to interact with
the objects in a synchronous way. It was made for solving problems related to
concurrent writes to HDF5 files as implemented by
[obsplus](www.github.com/niosh-mining/obsplus).## Quickstart
```python
import srpo# Define an object we want to share between processes (a dict) and "transcend" it,
# meaning it is transfer to its own process. A proxy is returned.
proxy1 = srpo.transcend({'shared': 2}, 'obj')# From any process on the same machine we can access the object with its id like so
proxy2 = srpo.get_proxy('obj')# Then manipulate the object as if it was (almost) local.
assert proxy1['shared'] == proxy2['shared'] == 2proxy2['another_attr'] = 3
assert proxy1['another_attr'] == 3
```## Note
When the main process exists the process in which the transcended object lives
will be terminated.