appose 0.6.0__py3-none-any.whl → 0.7.0__py3-none-any.whl
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.
- appose/python_worker.py +10 -2
- {appose-0.6.0.dist-info → appose-0.7.0.dist-info}/METADATA +1 -1
- {appose-0.6.0.dist-info → appose-0.7.0.dist-info}/RECORD +6 -6
- {appose-0.6.0.dist-info → appose-0.7.0.dist-info}/WHEEL +0 -0
- {appose-0.6.0.dist-info → appose-0.7.0.dist-info}/licenses/LICENSE.txt +0 -0
- {appose-0.6.0.dist-info → appose-0.7.0.dist-info}/top_level.txt +0 -0
appose/python_worker.py
CHANGED
@@ -51,7 +51,10 @@ from appose.types import Args, _set_worker, decode, encode
|
|
51
51
|
|
52
52
|
|
53
53
|
class Task:
|
54
|
-
def __init__(
|
54
|
+
def __init__(
|
55
|
+
self, worker: "Worker", uuid: str, script: str, inputs: Args | None = None
|
56
|
+
) -> None:
|
57
|
+
self._worker = worker
|
55
58
|
self._uuid = uuid
|
56
59
|
self._script = script
|
57
60
|
self._inputs = inputs
|
@@ -62,6 +65,9 @@ class Task:
|
|
62
65
|
self.outputs = {}
|
63
66
|
self.cancel_requested = False
|
64
67
|
|
68
|
+
def export(self, **kwargs):
|
69
|
+
self._worker.exports.update(kwargs)
|
70
|
+
|
65
71
|
def update(
|
66
72
|
self,
|
67
73
|
message: str | None = None,
|
@@ -96,6 +102,7 @@ class Task:
|
|
96
102
|
try:
|
97
103
|
# Populate script bindings.
|
98
104
|
binding = {"task": self}
|
105
|
+
binding.update(self._worker.exports)
|
99
106
|
if self._inputs is not None:
|
100
107
|
binding.update(self._inputs)
|
101
108
|
|
@@ -184,6 +191,7 @@ class Worker:
|
|
184
191
|
def __init__(self):
|
185
192
|
self.tasks = {}
|
186
193
|
self.queue: list[Task] = []
|
194
|
+
self.exports = {}
|
187
195
|
self.running = True
|
188
196
|
|
189
197
|
# Flag this process as a worker, not a service.
|
@@ -223,7 +231,7 @@ class Worker:
|
|
223
231
|
script = request.get("script")
|
224
232
|
inputs = request.get("inputs")
|
225
233
|
queue = request.get("queue")
|
226
|
-
task = Task(uuid, script, inputs)
|
234
|
+
task = Task(self, uuid, script, inputs)
|
227
235
|
self.tasks[uuid] = task
|
228
236
|
if queue == "main":
|
229
237
|
# Add the task to the main thread queue.
|
@@ -1,11 +1,11 @@
|
|
1
1
|
appose/__init__.py,sha256=SRXmNEqFIAajVlwVCSAdhHQytRKZJiWI5Y5-xwioW0w,7544
|
2
2
|
appose/environment.py,sha256=Kg-MfAcmVPDltwqvmrcvus-pP01SNUdn4bE2kdkIVuk,7597
|
3
3
|
appose/paths.py,sha256=WgBHwnZdS3Ot8_hssFqUiTGnunolYRrHLf9rAfEU5r4,2182
|
4
|
-
appose/python_worker.py,sha256=
|
4
|
+
appose/python_worker.py,sha256=r3BLkbQ7_U1jcsoieUbveUt1LU5wQNRjSDMNKFF21fw,10281
|
5
5
|
appose/service.py,sha256=jdtGOOoWjut9eZj441fL8t_P_ln2mfgilBvJdH0bDus,14750
|
6
6
|
appose/types.py,sha256=uidbt2JwWJ2D3Mbtc4Vl2sRP6WNgKjmfcHjJ9QLWkcs,10557
|
7
|
-
appose-0.
|
8
|
-
appose-0.
|
9
|
-
appose-0.
|
10
|
-
appose-0.
|
11
|
-
appose-0.
|
7
|
+
appose-0.7.0.dist-info/licenses/LICENSE.txt,sha256=ZedidA6NyZclNlsx-vl9IVBWRAQSqXdNsCWgtFcwzIE,1313
|
8
|
+
appose-0.7.0.dist-info/METADATA,sha256=KHaC6fWhJca77-zZmbMnZA2UtjPAr7bl8uTzU1TG5rU,5598
|
9
|
+
appose-0.7.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
10
|
+
appose-0.7.0.dist-info/top_level.txt,sha256=oqHhw2QGlaFfH3jMR9H5Cd6XYHdEv5DvK1am0iEFPW0,7
|
11
|
+
appose-0.7.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|