hatchet-sdk 1.6.0__py3-none-any.whl → 1.6.2__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.
Potentially problematic release.
This version of hatchet-sdk might be problematic. Click here for more details.
- hatchet_sdk/clients/dispatcher/action_listener.py +3 -4
- hatchet_sdk/clients/event_ts.py +8 -5
- hatchet_sdk/clients/listeners/pooled_listener.py +5 -3
- hatchet_sdk/utils/timedelta_to_expression.py +6 -5
- {hatchet_sdk-1.6.0.dist-info → hatchet_sdk-1.6.2.dist-info}/METADATA +1 -1
- {hatchet_sdk-1.6.0.dist-info → hatchet_sdk-1.6.2.dist-info}/RECORD +8 -8
- {hatchet_sdk-1.6.0.dist-info → hatchet_sdk-1.6.2.dist-info}/WHEEL +0 -0
- {hatchet_sdk-1.6.0.dist-info → hatchet_sdk-1.6.2.dist-info}/entry_points.txt +0 -0
|
@@ -7,7 +7,6 @@ from typing import Any, AsyncGenerator, cast
|
|
|
7
7
|
|
|
8
8
|
import grpc
|
|
9
9
|
import grpc.aio
|
|
10
|
-
from grpc._cython import cygrpc # type: ignore[attr-defined]
|
|
11
10
|
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
|
|
12
11
|
|
|
13
12
|
from hatchet_sdk.clients.event_ts import ThreadSafeEvent, read_with_interrupt
|
|
@@ -267,7 +266,6 @@ class ActionListener:
|
|
|
267
266
|
await self.interrupt.wait()
|
|
268
267
|
|
|
269
268
|
if not t.done():
|
|
270
|
-
# print a warning
|
|
271
269
|
logger.warning(
|
|
272
270
|
"Interrupted read_with_interrupt task of action listener"
|
|
273
271
|
)
|
|
@@ -277,9 +275,10 @@ class ActionListener:
|
|
|
277
275
|
|
|
278
276
|
break
|
|
279
277
|
|
|
280
|
-
assigned_action, _ = t.result()
|
|
278
|
+
assigned_action, _, is_eof = t.result()
|
|
281
279
|
|
|
282
|
-
if
|
|
280
|
+
if is_eof:
|
|
281
|
+
logger.debug("Handling EOF in Action Listener")
|
|
283
282
|
self.retries = self.retries + 1
|
|
284
283
|
break
|
|
285
284
|
|
hatchet_sdk/clients/event_ts.py
CHANGED
|
@@ -4,6 +4,8 @@ from typing import Callable, TypeVar, cast, overload
|
|
|
4
4
|
import grpc.aio
|
|
5
5
|
from grpc._cython import cygrpc # type: ignore[attr-defined]
|
|
6
6
|
|
|
7
|
+
from hatchet_sdk.logger import logger
|
|
8
|
+
|
|
7
9
|
|
|
8
10
|
class ThreadSafeEvent(asyncio.Event):
|
|
9
11
|
"""
|
|
@@ -32,7 +34,7 @@ async def read_with_interrupt(
|
|
|
32
34
|
listener: grpc.aio.UnaryStreamCall[TRequest, TResponse],
|
|
33
35
|
interrupt: ThreadSafeEvent,
|
|
34
36
|
key_generator: Callable[[TResponse], str],
|
|
35
|
-
) -> tuple[TResponse, str]: ...
|
|
37
|
+
) -> tuple[TResponse, str, bool]: ...
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
@overload
|
|
@@ -40,22 +42,23 @@ async def read_with_interrupt(
|
|
|
40
42
|
listener: grpc.aio.UnaryStreamCall[TRequest, TResponse],
|
|
41
43
|
interrupt: ThreadSafeEvent,
|
|
42
44
|
key_generator: None = None,
|
|
43
|
-
) -> tuple[TResponse, None]: ...
|
|
45
|
+
) -> tuple[TResponse, None, bool]: ...
|
|
44
46
|
|
|
45
47
|
|
|
46
48
|
async def read_with_interrupt(
|
|
47
49
|
listener: grpc.aio.UnaryStreamCall[TRequest, TResponse],
|
|
48
50
|
interrupt: ThreadSafeEvent,
|
|
49
51
|
key_generator: Callable[[TResponse], str] | None = None,
|
|
50
|
-
) -> tuple[TResponse, str | None]:
|
|
52
|
+
) -> tuple[TResponse, str | None, bool]:
|
|
51
53
|
try:
|
|
52
54
|
result = cast(TResponse, await listener.read())
|
|
53
55
|
|
|
54
56
|
if result is cygrpc.EOF:
|
|
55
|
-
|
|
57
|
+
logger.warning("Received EOF from engine")
|
|
58
|
+
return cast(TResponse, None), None, True
|
|
56
59
|
|
|
57
60
|
key = key_generator(result) if key_generator else None
|
|
58
61
|
|
|
59
|
-
return result, key
|
|
62
|
+
return result, key, False
|
|
60
63
|
finally:
|
|
61
64
|
interrupt.set()
|
|
@@ -5,7 +5,6 @@ from typing import Generic, Literal, TypeVar
|
|
|
5
5
|
|
|
6
6
|
import grpc
|
|
7
7
|
import grpc.aio
|
|
8
|
-
from grpc._cython import cygrpc # type: ignore[attr-defined]
|
|
9
8
|
|
|
10
9
|
from hatchet_sdk.clients.event_ts import ThreadSafeEvent, read_with_interrupt
|
|
11
10
|
from hatchet_sdk.config import ClientConfig
|
|
@@ -131,9 +130,12 @@ class PooledListener(Generic[R, T, L], ABC):
|
|
|
131
130
|
await asyncio.sleep(DEFAULT_LISTENER_RETRY_INTERVAL)
|
|
132
131
|
break
|
|
133
132
|
|
|
134
|
-
event, key = t.result()
|
|
133
|
+
event, key, is_eof = t.result()
|
|
135
134
|
|
|
136
|
-
if
|
|
135
|
+
if is_eof:
|
|
136
|
+
logger.debug(
|
|
137
|
+
f"Handling EOF in Pooled Listener {self.__class__.__name__}"
|
|
138
|
+
)
|
|
137
139
|
break
|
|
138
140
|
|
|
139
141
|
subscriptions = self.to_subscriptions.get(key, [])
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from datetime import timedelta
|
|
2
2
|
|
|
3
|
-
DAY = 86400
|
|
4
3
|
HOUR = 3600
|
|
5
4
|
MINUTE = 60
|
|
6
5
|
|
|
@@ -11,11 +10,13 @@ def timedelta_to_expr(td: Duration) -> str:
|
|
|
11
10
|
if isinstance(td, str):
|
|
12
11
|
return td
|
|
13
12
|
|
|
14
|
-
|
|
13
|
+
## `total_seconds` gives the entire duration,
|
|
14
|
+
## while `seconds` gives the seconds component of the timedelta
|
|
15
|
+
## e.g. 1 day and 1 second would give 86401 total seconds but 1 second
|
|
16
|
+
seconds = int(td.total_seconds())
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
elif seconds % HOUR == 0:
|
|
18
|
+
## IMPORTANT: We only support hours, minutes, and seconds on the engine
|
|
19
|
+
if seconds % HOUR == 0:
|
|
19
20
|
return f"{seconds // HOUR}h"
|
|
20
21
|
elif seconds % MINUTE == 0:
|
|
21
22
|
return f"{seconds // MINUTE}m"
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
hatchet_sdk/__init__.py,sha256=LUj6VyGVSHCYTQTaoyiVhjyJLOfv6gMCmb-s4hRyISM,10031
|
|
2
2
|
hatchet_sdk/client.py,sha256=tbOeMuaJmgpyYSQg8QUz_J4AdqRNvV9E0aEZpgsiZTE,2207
|
|
3
3
|
hatchet_sdk/clients/admin.py,sha256=zZKqjqjiq6_D2S5INuJBXdkyh5Owk65FMz6V6PC5Ta4,17692
|
|
4
|
-
hatchet_sdk/clients/dispatcher/action_listener.py,sha256=
|
|
4
|
+
hatchet_sdk/clients/dispatcher/action_listener.py,sha256=TUfIHaT68iCf0OGLX6qKVYC157kiQf2dXs1IIOezHng,16318
|
|
5
5
|
hatchet_sdk/clients/dispatcher/dispatcher.py,sha256=IL-hDXG8Lzas9FieVuNr47E_3Gvpc-aL4Xu_l385Vp8,8140
|
|
6
|
-
hatchet_sdk/clients/event_ts.py,sha256=
|
|
6
|
+
hatchet_sdk/clients/event_ts.py,sha256=YH2_rTtm8kFWiae-Otgb2MZujbCOp9ggDSIESyrWdhc,1797
|
|
7
7
|
hatchet_sdk/clients/events.py,sha256=sKqzGwkrW_AKWW0Q_rxfwo9jXV5EUpLx7fTQvCNHaVo,5443
|
|
8
8
|
hatchet_sdk/clients/listeners/durable_event_listener.py,sha256=jpqnbZsuouWk3XaOIYL9apaGtVk65eKKq66eBP9klBs,4085
|
|
9
|
-
hatchet_sdk/clients/listeners/pooled_listener.py,sha256=
|
|
9
|
+
hatchet_sdk/clients/listeners/pooled_listener.py,sha256=AAkIHR-RaiW42qwr-_nQuvfFPzUnHOcf8HYcxPUjL5g,8440
|
|
10
10
|
hatchet_sdk/clients/listeners/run_event_listener.py,sha256=rIjBLRF7d7FBoEq7RKbmbOA84lX_hHSU26trwnthqV8,10230
|
|
11
11
|
hatchet_sdk/clients/listeners/workflow_listener.py,sha256=EhBZZnHiidDLvAc4r54Re_LJXVypinbgTE9qKBybxj8,2054
|
|
12
12
|
hatchet_sdk/clients/rest/__init__.py,sha256=Bee4HPFiMGDHx5xbHkxxVbLBz_mDgSZUqh-nIhvsD1k,16511
|
|
@@ -265,7 +265,7 @@ hatchet_sdk/runnables/workflow.py,sha256=PvQeDglpyGhJdgOTqjRmIOHKmEhtmRcF3DWZqbr
|
|
|
265
265
|
hatchet_sdk/token.py,sha256=KjIiInwG5Kqd_FO4BSW1x_5Uc7PFbnzIVJqr50-ZldE,779
|
|
266
266
|
hatchet_sdk/utils/backoff.py,sha256=6B5Rb5nLKw_TqqgpJMYjIBV1PTTtbOMRZCveisVhg_I,353
|
|
267
267
|
hatchet_sdk/utils/proto_enums.py,sha256=0UybwE3s7TcqmzoQSO8YnhgAKOS8WZXsyPchB8-eksw,1247
|
|
268
|
-
hatchet_sdk/utils/timedelta_to_expression.py,sha256=
|
|
268
|
+
hatchet_sdk/utils/timedelta_to_expression.py,sha256=kwuYZ51JdDdc3h9Sw4vgBFmJBMPkgbGJA4v9uO4_NGk,660
|
|
269
269
|
hatchet_sdk/utils/typing.py,sha256=huflXWR7fvRfIFYdqQIrQmn9jtukzOWoTpW3AXGk5c0,427
|
|
270
270
|
hatchet_sdk/v0/__init__.py,sha256=YNh-0rPHS0rcphmykJ1N2NMfgvERF4oJpBtx3IH_E_M,9657
|
|
271
271
|
hatchet_sdk/v0/client.py,sha256=G1RDZln9Og7tRQulogXkZw8TsVlx7f0VvmtFI_VAe6E,3495
|
|
@@ -506,7 +506,7 @@ hatchet_sdk/worker/runner/runner.py,sha256=J-gTpoYF9WphB1zZhpPJryCv10VjU-MiCdJgM
|
|
|
506
506
|
hatchet_sdk/worker/runner/utils/capture_logs.py,sha256=nHRPSiDBqzhObM7i2X7t03OupVFnE7kQBdR2Ckgg-2w,2709
|
|
507
507
|
hatchet_sdk/worker/worker.py,sha256=m11u3QPyAqXJpF6Y3lTUEVqTKdIigGKTXTymNPqq6hw,16149
|
|
508
508
|
hatchet_sdk/workflow_run.py,sha256=ZwH0HLFGFVXz6jbiqSv4w0Om2XuR52Tzzw6LH4y65jQ,2765
|
|
509
|
-
hatchet_sdk-1.6.
|
|
510
|
-
hatchet_sdk-1.6.
|
|
511
|
-
hatchet_sdk-1.6.
|
|
512
|
-
hatchet_sdk-1.6.
|
|
509
|
+
hatchet_sdk-1.6.2.dist-info/METADATA,sha256=72ohc-_J3ViNh-QrgzKEQsdbT8ZaoPVshORzZkZ5Jok,3635
|
|
510
|
+
hatchet_sdk-1.6.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
511
|
+
hatchet_sdk-1.6.2.dist-info/entry_points.txt,sha256=uYc-ivF7fUATjrWnwHP32ojgMCmogIs6yFOU8lEA4mk,1276
|
|
512
|
+
hatchet_sdk-1.6.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|