https://github.com/marella/external
Run tasks on external processes to overcome Python's global interpreter lock.
https://github.com/marella/external
multiprocessing python
Last synced: 11 months ago
JSON representation
Run tasks on external processes to overcome Python's global interpreter lock.
- Host: GitHub
- URL: https://github.com/marella/external
- Owner: marella
- License: mit
- Created: 2019-12-14T16:47:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2019-12-14T16:48:16.000Z (over 6 years ago)
- Last Synced: 2025-07-08T21:43:44.517Z (11 months ago)
- Topics: multiprocessing, python
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Run tasks on external processes to overcome Python's global interpreter lock.
> Inspired by [google-research/batch-ppo](https://github.com/google-research/batch-ppo) [`ExternalProcess`](https://github.com/google-research/batch-ppo/blob/3d09705977bae4e7c3eb20339a3b384d2a5531e4/agents/tools/wrappers.py#L303)
## Installation
```sh
pip install external
```
## Usage
```py
import external
@external
class Counter():
def __init__(self, count=0):
self.count = count
def increment(self):
self.count += 1
with Counter(count=1) as c:
assert c.count.get() == 1
c.increment()
assert c.count.get() == 2
try:
c.decrement()
except AttributeError as e:
print(e) # 'Counter' object has no attribute 'decrement'
assert c.count.get() == 2
```