parallelazy 0.0.3__tar.gz → 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {parallelazy-0.0.3 → parallelazy-0.0.6}/PKG-INFO +15 -4
- {parallelazy-0.0.3 → parallelazy-0.0.6}/README.md +13 -3
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy/plugin_data.py +0 -1
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy/plugin_manager.py +16 -3
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy/plugin_rpc.py +10 -3
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy/plugin_worker.py +5 -2
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy.egg-info/PKG-INFO +15 -4
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy.egg-info/requires.txt +1 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/pyproject.toml +3 -2
- {parallelazy-0.0.3 → parallelazy-0.0.6}/LICENSE +0 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy/__init__.py +0 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy/environment_manager.py +0 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy/plugin.py +0 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy/plugin_transport.py +0 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy/utils.py +0 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy.egg-info/SOURCES.txt +0 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy.egg-info/dependency_links.txt +0 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/parallelazy.egg-info/top_level.txt +0 -0
- {parallelazy-0.0.3 → parallelazy-0.0.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: parallelazy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: A lightweight multiprocess worker-plugin framework. Topic-based pub/sub, global enviroment, using process spawn and pipes, pytorch and CUDA ready.
|
|
5
5
|
Author: Cesare Montresor
|
|
6
6
|
Project-URL: Homepage, https://github.com/cesare-montresor/parallelazy
|
|
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
|
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
Requires-Dist: debugpy
|
|
13
13
|
Requires-Dist: torch
|
|
14
|
+
Requires-Dist: numpy
|
|
14
15
|
Dynamic: license-file
|
|
15
16
|
|
|
16
17
|
# parallelazy
|
|
@@ -26,16 +27,26 @@ A lightweight Python plugin/worker framework with:
|
|
|
26
27
|
## Install
|
|
27
28
|
|
|
28
29
|
```bash
|
|
29
|
-
|
|
30
|
+
pip install parallelazy
|
|
30
31
|
```
|
|
31
32
|
|
|
33
|
+
*for development*
|
|
34
|
+
```bash
|
|
35
|
+
pip install -e .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Debug in VSCode
|
|
39
|
+
|
|
40
|
+
Due to a known issue with debugpy and spawn ( as opposite to fork ) processes, a small companion vscode extension has been developed in order to enable debugging.
|
|
41
|
+
|
|
42
|
+
https://marketplace.visualstudio.com/items?itemName=CesareMontresor.parallelazy-vscode
|
|
43
|
+
|
|
32
44
|
## Quick start
|
|
33
45
|
|
|
34
46
|
```python
|
|
35
47
|
import time
|
|
36
48
|
|
|
37
|
-
from parallelazy
|
|
38
|
-
from parallelazy.plugin_manager import PluginManager
|
|
49
|
+
from parallelazy import Plugin, PluginManager
|
|
39
50
|
|
|
40
51
|
|
|
41
52
|
class Worker(Plugin):
|
|
@@ -11,16 +11,26 @@ A lightweight Python plugin/worker framework with:
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
13
|
```bash
|
|
14
|
-
|
|
14
|
+
pip install parallelazy
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
*for development*
|
|
18
|
+
```bash
|
|
19
|
+
pip install -e .
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Debug in VSCode
|
|
23
|
+
|
|
24
|
+
Due to a known issue with debugpy and spawn ( as opposite to fork ) processes, a small companion vscode extension has been developed in order to enable debugging.
|
|
25
|
+
|
|
26
|
+
https://marketplace.visualstudio.com/items?itemName=CesareMontresor.parallelazy-vscode
|
|
27
|
+
|
|
17
28
|
## Quick start
|
|
18
29
|
|
|
19
30
|
```python
|
|
20
31
|
import time
|
|
21
32
|
|
|
22
|
-
from parallelazy
|
|
23
|
-
from parallelazy.plugin_manager import PluginManager
|
|
33
|
+
from parallelazy import Plugin, PluginManager
|
|
24
34
|
|
|
25
35
|
|
|
26
36
|
class Worker(Plugin):
|
|
@@ -17,7 +17,6 @@ Message Flows:
|
|
|
17
17
|
No Commands/Responses wrappers, no double indirection. Just Request and Response.
|
|
18
18
|
"""
|
|
19
19
|
from typing import Any, Callable, Optional, TYPE_CHECKING
|
|
20
|
-
from enum import Enum
|
|
21
20
|
import logging
|
|
22
21
|
from concurrent.futures import Future
|
|
23
22
|
from torch import multiprocessing as mp
|
|
@@ -52,7 +52,8 @@ class PluginManager:
|
|
|
52
52
|
def __init__(
|
|
53
53
|
self,
|
|
54
54
|
timeout_request: float = 5.0,
|
|
55
|
-
timeout_start: float =
|
|
55
|
+
timeout_start: float = 10.0,
|
|
56
|
+
timeout_start_debug: float = 30.0,
|
|
56
57
|
worker_pydebug: bool = None
|
|
57
58
|
):
|
|
58
59
|
"""
|
|
@@ -61,6 +62,7 @@ class PluginManager:
|
|
|
61
62
|
Args:
|
|
62
63
|
timeout_request: Default timeout for sync requests (seconds)
|
|
63
64
|
timeout_start: Timeout for start command (seconds)
|
|
65
|
+
timeout_start_debug: Timeout for start command in debug mode (seconds)
|
|
64
66
|
worker_pydebug: Whether to enable pydebug for worker processes (optional, for debugging plugins)
|
|
65
67
|
"""
|
|
66
68
|
self._plugins: Dict[str, PluginInfo] = {} # plugin_id -> PluginInfo
|
|
@@ -73,8 +75,9 @@ class PluginManager:
|
|
|
73
75
|
self._env = EnvironmentManager()
|
|
74
76
|
|
|
75
77
|
self.timeout_request = timeout_request
|
|
76
|
-
self.timeout_start = timeout_start
|
|
77
78
|
self.worker_pydebug = False if worker_pydebug is None else bool(worker_pydebug)
|
|
79
|
+
self.timeout_start = timeout_start if not self.worker_pydebug else timeout_start_debug
|
|
80
|
+
|
|
78
81
|
|
|
79
82
|
|
|
80
83
|
def load_plugins(self, descriptors: List[PluginDescriptor], parallel: bool = True) -> None:
|
|
@@ -150,7 +153,17 @@ class PluginManager:
|
|
|
150
153
|
)
|
|
151
154
|
|
|
152
155
|
process.start()
|
|
153
|
-
|
|
156
|
+
is_ready = False
|
|
157
|
+
while process.is_alive():
|
|
158
|
+
is_ready = initialized.wait(timeout=self.timeout_start)
|
|
159
|
+
if is_ready: break
|
|
160
|
+
# If we get here, wait() timed out but the process is still alive
|
|
161
|
+
logger.info(f"Plugin {plugin_id} is still initializing (waiting...)")
|
|
162
|
+
|
|
163
|
+
# If the loop exited and is_ready is False, the process died before setting the event
|
|
164
|
+
if not is_ready:
|
|
165
|
+
logger.error(f"Plugin {plugin_id} failed to initialize (process terminated unexpectedly).")
|
|
166
|
+
return False
|
|
154
167
|
|
|
155
168
|
logger.info(f"Plugin {plugin_id} loaded")
|
|
156
169
|
return True
|
|
@@ -52,7 +52,7 @@ class PluginCoreRPC:
|
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
def __init__(self, plugin_id: str, channel: Channel=None, timeout: float = 5.0):
|
|
55
|
+
def __init__(self, plugin_id: str, channel: Channel=None, timeout: float = 5.0, start_listener: bool = True):
|
|
56
56
|
"""
|
|
57
57
|
Initialize manager proxy.
|
|
58
58
|
|
|
@@ -77,7 +77,7 @@ class PluginCoreRPC:
|
|
|
77
77
|
|
|
78
78
|
# Reader thread routes Responses to reply slots
|
|
79
79
|
self._reader = threading.Thread(target=self._channel_listener, daemon=False)
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
|
|
82
82
|
# Persistent pool for executing incoming requests — avoids spawning
|
|
83
83
|
# a fresh OS thread per RPC call (was the source of the stutter).
|
|
@@ -85,6 +85,13 @@ class PluginCoreRPC:
|
|
|
85
85
|
max_workers=8, thread_name_prefix=f"rpc-{plugin_id}"
|
|
86
86
|
)
|
|
87
87
|
|
|
88
|
+
if start_listener:
|
|
89
|
+
self.start_listener()
|
|
90
|
+
|
|
91
|
+
def start_listener(self):
|
|
92
|
+
if not self._reader.is_alive():
|
|
93
|
+
self._reader.start()
|
|
94
|
+
|
|
88
95
|
def shutdown(self):
|
|
89
96
|
"""Clean up resources."""
|
|
90
97
|
# Step 1: Signal reader to stop
|
|
@@ -220,7 +227,7 @@ class PluginCoreRPC:
|
|
|
220
227
|
|
|
221
228
|
self._executor.submit(self._execute_command, req)
|
|
222
229
|
except Exception as e:
|
|
223
|
-
logger.error(f"Request handler error: {e}", exc_info=True)
|
|
230
|
+
logger.error(f"Request handler error: {req} {e}", exc_info=True)
|
|
224
231
|
self.respond(req, error=e)
|
|
225
232
|
|
|
226
233
|
def _handle_response(self, resp: Response) -> bool:
|
|
@@ -128,11 +128,14 @@ class PluginWorker:
|
|
|
128
128
|
|
|
129
129
|
# Create manager proxy for direct manager access+
|
|
130
130
|
channel = Channel(queue_descriptor)
|
|
131
|
-
self.rpc = PluginRPC(self.plugin_id, channel)
|
|
131
|
+
self.rpc = PluginRPC(self.plugin_id, channel, start_listener=False)
|
|
132
132
|
|
|
133
|
-
self._init_plugin()
|
|
134
133
|
self._init_rpc()
|
|
135
134
|
|
|
135
|
+
self._init_plugin()
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
self.rpc.start_listener() # Start the RPC listener after initialization
|
|
136
139
|
|
|
137
140
|
|
|
138
141
|
## ========================================================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: parallelazy
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.6
|
|
4
4
|
Summary: A lightweight multiprocess worker-plugin framework. Topic-based pub/sub, global enviroment, using process spawn and pipes, pytorch and CUDA ready.
|
|
5
5
|
Author: Cesare Montresor
|
|
6
6
|
Project-URL: Homepage, https://github.com/cesare-montresor/parallelazy
|
|
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
|
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
Requires-Dist: debugpy
|
|
13
13
|
Requires-Dist: torch
|
|
14
|
+
Requires-Dist: numpy
|
|
14
15
|
Dynamic: license-file
|
|
15
16
|
|
|
16
17
|
# parallelazy
|
|
@@ -26,16 +27,26 @@ A lightweight Python plugin/worker framework with:
|
|
|
26
27
|
## Install
|
|
27
28
|
|
|
28
29
|
```bash
|
|
29
|
-
|
|
30
|
+
pip install parallelazy
|
|
30
31
|
```
|
|
31
32
|
|
|
33
|
+
*for development*
|
|
34
|
+
```bash
|
|
35
|
+
pip install -e .
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Debug in VSCode
|
|
39
|
+
|
|
40
|
+
Due to a known issue with debugpy and spawn ( as opposite to fork ) processes, a small companion vscode extension has been developed in order to enable debugging.
|
|
41
|
+
|
|
42
|
+
https://marketplace.visualstudio.com/items?itemName=CesareMontresor.parallelazy-vscode
|
|
43
|
+
|
|
32
44
|
## Quick start
|
|
33
45
|
|
|
34
46
|
```python
|
|
35
47
|
import time
|
|
36
48
|
|
|
37
|
-
from parallelazy
|
|
38
|
-
from parallelazy.plugin_manager import PluginManager
|
|
49
|
+
from parallelazy import Plugin, PluginManager
|
|
39
50
|
|
|
40
51
|
|
|
41
52
|
class Worker(Plugin):
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "parallelazy"
|
|
7
|
-
version = "0.0.
|
|
7
|
+
version = "0.0.6"
|
|
8
8
|
description = "A lightweight multiprocess worker-plugin framework. Topic-based pub/sub, global enviroment, using process spawn and pipes, pytorch and CUDA ready."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.8"
|
|
@@ -14,7 +14,8 @@ authors = [
|
|
|
14
14
|
|
|
15
15
|
dependencies = [
|
|
16
16
|
"debugpy",
|
|
17
|
-
"torch"
|
|
17
|
+
"torch",
|
|
18
|
+
"numpy"
|
|
18
19
|
]
|
|
19
20
|
|
|
20
21
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|