flo-python 0.1.0.dev3__py3-none-any.whl → 0.1.0.dev4__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.
- flo/client.py +4 -2
- flo/worker.py +31 -3
- {flo_python-0.1.0.dev3.dist-info → flo_python-0.1.0.dev4.dist-info}/METADATA +1 -1
- {flo_python-0.1.0.dev3.dist-info → flo_python-0.1.0.dev4.dist-info}/RECORD +6 -6
- {flo_python-0.1.0.dev3.dist-info → flo_python-0.1.0.dev4.dist-info}/WHEEL +0 -0
- {flo_python-0.1.0.dev3.dist-info → flo_python-0.1.0.dev4.dist-info}/licenses/LICENSE +0 -0
flo/client.py
CHANGED
|
@@ -372,11 +372,13 @@ class FloClient:
|
|
|
372
372
|
Returns:
|
|
373
373
|
A new ActionWorker instance ready to register actions and start.
|
|
374
374
|
|
|
375
|
-
Example
|
|
375
|
+
Example::
|
|
376
|
+
|
|
376
377
|
async with FloClient("localhost:3000", namespace="myapp") as client:
|
|
377
378
|
worker = client.new_action_worker(concurrency=5)
|
|
378
379
|
worker.register_action("process-order", process_order)
|
|
379
|
-
|
|
380
|
+
async with worker:
|
|
381
|
+
await worker.start()
|
|
380
382
|
"""
|
|
381
383
|
from .worker import ActionWorker
|
|
382
384
|
|
flo/worker.py
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
Provides ActionWorker for executing actions and StreamWorker for
|
|
4
4
|
processing stream records via consumer groups.
|
|
5
5
|
|
|
6
|
-
Example
|
|
6
|
+
Example::
|
|
7
|
+
|
|
7
8
|
from flo import FloClient, ActionContext
|
|
8
9
|
|
|
9
10
|
async def process_order(ctx: ActionContext) -> bytes:
|
|
@@ -14,8 +15,9 @@ Example:
|
|
|
14
15
|
async def main():
|
|
15
16
|
async with FloClient("localhost:3000", namespace="myapp") as client:
|
|
16
17
|
worker = client.new_action_worker(concurrency=5)
|
|
17
|
-
worker.
|
|
18
|
-
|
|
18
|
+
worker.register_action("process-order", process_order)
|
|
19
|
+
async with worker:
|
|
20
|
+
await worker.start()
|
|
19
21
|
"""
|
|
20
22
|
|
|
21
23
|
import asyncio
|
|
@@ -626,6 +628,19 @@ class ActionWorker:
|
|
|
626
628
|
if self._client:
|
|
627
629
|
await self._client.close()
|
|
628
630
|
|
|
631
|
+
async def __aenter__(self) -> "ActionWorker":
|
|
632
|
+
"""Async context manager entry."""
|
|
633
|
+
return self
|
|
634
|
+
|
|
635
|
+
async def __aexit__(
|
|
636
|
+
self,
|
|
637
|
+
exc_type: type[BaseException] | None,
|
|
638
|
+
exc_val: BaseException | None,
|
|
639
|
+
exc_tb: object,
|
|
640
|
+
) -> None:
|
|
641
|
+
"""Async context manager exit — closes the worker."""
|
|
642
|
+
await self.close()
|
|
643
|
+
|
|
629
644
|
|
|
630
645
|
# =============================================================================
|
|
631
646
|
# Stream Worker
|
|
@@ -977,3 +992,16 @@ class StreamWorker:
|
|
|
977
992
|
self.stop()
|
|
978
993
|
if self._client:
|
|
979
994
|
await self._client.close()
|
|
995
|
+
|
|
996
|
+
async def __aenter__(self) -> "StreamWorker":
|
|
997
|
+
"""Async context manager entry."""
|
|
998
|
+
return self
|
|
999
|
+
|
|
1000
|
+
async def __aexit__(
|
|
1001
|
+
self,
|
|
1002
|
+
exc_type: type[BaseException] | None,
|
|
1003
|
+
exc_val: BaseException | None,
|
|
1004
|
+
exc_tb: object,
|
|
1005
|
+
) -> None:
|
|
1006
|
+
"""Async context manager exit — closes the stream worker."""
|
|
1007
|
+
await self.close()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flo-python
|
|
3
|
-
Version: 0.1.0.
|
|
3
|
+
Version: 0.1.0.dev4
|
|
4
4
|
Summary: Python SDK for the Flo distributed systems platform
|
|
5
5
|
Project-URL: Homepage, https://github.com/floruntime/flo-python
|
|
6
6
|
Project-URL: Documentation, https://github.com/floruntime/flo-python#readme
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
flo/__init__.py,sha256=7nQrfC6ge__E4scjMx5x-VwAiAKhsiRL-JEjC7cf0ZA,7039
|
|
2
2
|
flo/actions.py,sha256=b4cd5AAe6TRAU-_UZmenbek0h--T-C_PiiDFCHyYDTs,12258
|
|
3
|
-
flo/client.py,sha256=
|
|
3
|
+
flo/client.py,sha256=hS64RG4WA9qK_ISdIqDxmV-7DDTn3pAYvYGFRxOjq7U,15059
|
|
4
4
|
flo/exceptions.py,sha256=-3HUWvRGLe_4mSWxwZXk8CMpcfrRjFv0rRkTzu4kqP4,5868
|
|
5
5
|
flo/kv.py,sha256=2PgvoZylU8Clsx8yaYdTLzdCZmD8nCZgtrmJHhAAZlM,7344
|
|
6
6
|
flo/processing.py,sha256=_jOQZiSgyArOPOdnoARNy9x6QgzcYvt1R0wa0vLQfoc,10530
|
|
@@ -8,9 +8,9 @@ flo/queue.py,sha256=Nn6CkgUkbXgUuH9BOCWlRkjxTZLKRs0_iMyRmwkYK6k,10888
|
|
|
8
8
|
flo/streams.py,sha256=G_27-_cq6hru712olwImd4Yxuo8x4l8XuKljUk0Y1JA,12965
|
|
9
9
|
flo/types.py,sha256=g8yikYiiYxsjkUlSCZxKpLMdBv7jg-cWAGO-cnEnaEo,27808
|
|
10
10
|
flo/wire.py,sha256=TLCMXeA8VnUTzyyORM7G3zrsSZhyZymSGxU9jhCxmmI,29373
|
|
11
|
-
flo/worker.py,sha256=
|
|
11
|
+
flo/worker.py,sha256=flSLz7FIV_zmvLhyHjR39KqUXk5cr8MQVHFkswHv78o,35395
|
|
12
12
|
flo/workflows.py,sha256=8Z5mhq2UOAnjV_Ef261mcWlj4Z5yGCwrFbxjey0ICoU,15050
|
|
13
|
-
flo_python-0.1.0.
|
|
14
|
-
flo_python-0.1.0.
|
|
15
|
-
flo_python-0.1.0.
|
|
16
|
-
flo_python-0.1.0.
|
|
13
|
+
flo_python-0.1.0.dev4.dist-info/METADATA,sha256=oufJNR5tLKj7oUBiAoMsXx6eYzD7avnehWUAmC5o3ZA,14638
|
|
14
|
+
flo_python-0.1.0.dev4.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
15
|
+
flo_python-0.1.0.dev4.dist-info/licenses/LICENSE,sha256=mADRSuVhPxFNpZiy7zO0gBjGrNO24OtWO9VCX6wmCVU,1065
|
|
16
|
+
flo_python-0.1.0.dev4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|