hatchet-sdk 1.2.0__py3-none-any.whl → 1.2.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/__init__.py +1 -2
- hatchet_sdk/context/context.py +9 -0
- hatchet_sdk/exceptions.py +2 -0
- hatchet_sdk/hatchet.py +4 -2
- hatchet_sdk/runnables/task.py +0 -4
- hatchet_sdk/worker/runner/runner.py +10 -8
- {hatchet_sdk-1.2.0.dist-info → hatchet_sdk-1.2.2.dist-info}/METADATA +2 -5
- {hatchet_sdk-1.2.0.dist-info → hatchet_sdk-1.2.2.dist-info}/RECORD +10 -9
- {hatchet_sdk-1.2.0.dist-info → hatchet_sdk-1.2.2.dist-info}/WHEEL +0 -0
- {hatchet_sdk-1.2.0.dist-info → hatchet_sdk-1.2.2.dist-info}/entry_points.txt +0 -0
hatchet_sdk/__init__.py
CHANGED
|
@@ -138,7 +138,7 @@ from hatchet_sdk.contracts.workflows_pb2 import (
|
|
|
138
138
|
)
|
|
139
139
|
from hatchet_sdk.features.runs import BulkCancelReplayOpts, RunFilter
|
|
140
140
|
from hatchet_sdk.hatchet import Hatchet
|
|
141
|
-
from hatchet_sdk.runnables.task import
|
|
141
|
+
from hatchet_sdk.runnables.task import Task
|
|
142
142
|
from hatchet_sdk.runnables.types import (
|
|
143
143
|
ConcurrencyExpression,
|
|
144
144
|
ConcurrencyLimitStrategy,
|
|
@@ -269,5 +269,4 @@ __all__ = [
|
|
|
269
269
|
"BulkCancelReplayOpts",
|
|
270
270
|
"RunFilter",
|
|
271
271
|
"V1TaskStatus",
|
|
272
|
-
"NonRetryableException",
|
|
273
272
|
]
|
hatchet_sdk/context/context.py
CHANGED
|
@@ -18,6 +18,7 @@ from hatchet_sdk.clients.durable_event_listener import (
|
|
|
18
18
|
)
|
|
19
19
|
from hatchet_sdk.clients.events import EventClient
|
|
20
20
|
from hatchet_sdk.context.worker_context import WorkerContext
|
|
21
|
+
from hatchet_sdk.features.runs import RunsClient
|
|
21
22
|
from hatchet_sdk.logger import logger
|
|
22
23
|
from hatchet_sdk.utils.timedelta_to_expression import Duration, timedelta_to_expr
|
|
23
24
|
from hatchet_sdk.utils.typing import JSONSerializableMapping, WorkflowValidator
|
|
@@ -52,6 +53,7 @@ class Context:
|
|
|
52
53
|
event_client: EventClient,
|
|
53
54
|
durable_event_listener: DurableEventListener | None,
|
|
54
55
|
worker: WorkerContext,
|
|
56
|
+
runs_client: RunsClient,
|
|
55
57
|
validator_registry: dict[str, WorkflowValidator] = {},
|
|
56
58
|
):
|
|
57
59
|
self.worker = worker
|
|
@@ -66,6 +68,7 @@ class Context:
|
|
|
66
68
|
self.dispatcher_client = dispatcher_client
|
|
67
69
|
self.admin_client = admin_client
|
|
68
70
|
self.event_client = event_client
|
|
71
|
+
self.runs_client = runs_client
|
|
69
72
|
self.durable_event_listener = durable_event_listener
|
|
70
73
|
|
|
71
74
|
# FIXME: this limits the number of concurrent log requests to 1, which means we can do about
|
|
@@ -135,6 +138,12 @@ class Context:
|
|
|
135
138
|
|
|
136
139
|
def cancel(self) -> None:
|
|
137
140
|
logger.debug("cancelling step...")
|
|
141
|
+
self.runs_client.cancel(self.step_run_id)
|
|
142
|
+
self.exit_flag = True
|
|
143
|
+
|
|
144
|
+
async def aio_cancel(self) -> None:
|
|
145
|
+
logger.debug("cancelling step...")
|
|
146
|
+
await self.runs_client.aio_cancel(self.step_run_id)
|
|
138
147
|
self.exit_flag = True
|
|
139
148
|
|
|
140
149
|
# done returns true if the context has been cancelled
|
hatchet_sdk/hatchet.py
CHANGED
|
@@ -56,7 +56,7 @@ class Hatchet:
|
|
|
56
56
|
self,
|
|
57
57
|
debug: bool = False,
|
|
58
58
|
client: Client | None = None,
|
|
59
|
-
config: ClientConfig =
|
|
59
|
+
config: ClientConfig | None = None,
|
|
60
60
|
):
|
|
61
61
|
"""
|
|
62
62
|
Initialize a new Hatchet instance.
|
|
@@ -74,7 +74,9 @@ class Hatchet:
|
|
|
74
74
|
if debug:
|
|
75
75
|
logger.setLevel(logging.DEBUG)
|
|
76
76
|
|
|
77
|
-
self._client =
|
|
77
|
+
self._client = (
|
|
78
|
+
client if client else Client(config=config or ClientConfig(), debug=debug)
|
|
79
|
+
)
|
|
78
80
|
|
|
79
81
|
@property
|
|
80
82
|
def cron(self) -> CronClient:
|
hatchet_sdk/runnables/task.py
CHANGED
|
@@ -30,6 +30,7 @@ from hatchet_sdk.contracts.dispatcher_pb2 import (
|
|
|
30
30
|
STEP_EVENT_TYPE_FAILED,
|
|
31
31
|
STEP_EVENT_TYPE_STARTED,
|
|
32
32
|
)
|
|
33
|
+
from hatchet_sdk.exceptions import NonRetryableException
|
|
33
34
|
from hatchet_sdk.logger import logger
|
|
34
35
|
from hatchet_sdk.runnables.contextvars import (
|
|
35
36
|
ctx_step_run_id,
|
|
@@ -38,7 +39,7 @@ from hatchet_sdk.runnables.contextvars import (
|
|
|
38
39
|
spawn_index_lock,
|
|
39
40
|
workflow_spawn_indices,
|
|
40
41
|
)
|
|
41
|
-
from hatchet_sdk.runnables.task import
|
|
42
|
+
from hatchet_sdk.runnables.task import Task
|
|
42
43
|
from hatchet_sdk.runnables.types import R, TWorkflowInput
|
|
43
44
|
from hatchet_sdk.utils.typing import WorkflowValidator
|
|
44
45
|
from hatchet_sdk.worker.action_listener_process import ActionEvent
|
|
@@ -287,13 +288,14 @@ class Runner:
|
|
|
287
288
|
constructor = DurableContext if is_durable else Context
|
|
288
289
|
|
|
289
290
|
return constructor(
|
|
290
|
-
action,
|
|
291
|
-
self.dispatcher_client,
|
|
292
|
-
self.admin_client,
|
|
293
|
-
self.client.event,
|
|
294
|
-
self.durable_event_listener,
|
|
295
|
-
self.worker_context,
|
|
291
|
+
action=action,
|
|
292
|
+
dispatcher_client=self.dispatcher_client,
|
|
293
|
+
admin_client=self.admin_client,
|
|
294
|
+
event_client=self.client.event,
|
|
295
|
+
durable_event_listener=self.durable_event_listener,
|
|
296
|
+
worker=self.worker_context,
|
|
296
297
|
validator_registry=self.validator_registry,
|
|
298
|
+
runs_client=self.client.runs,
|
|
297
299
|
)
|
|
298
300
|
|
|
299
301
|
## IMPORTANT: Keep this method's signature in sync with the wrapper in the OTel instrumentor
|
|
@@ -415,7 +417,7 @@ class Runner:
|
|
|
415
417
|
context = self.contexts.get(run_id)
|
|
416
418
|
|
|
417
419
|
if context:
|
|
418
|
-
context.
|
|
420
|
+
await context.aio_cancel()
|
|
419
421
|
|
|
420
422
|
await asyncio.sleep(1)
|
|
421
423
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: hatchet-sdk
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary:
|
|
5
5
|
Author: Alexander Belanger
|
|
6
6
|
Author-email: alexander@hatchet.run
|
|
@@ -18,7 +18,6 @@ Requires-Dist: grpcio (>=1.64.1,!=1.68.*) ; python_version < "3.13"
|
|
|
18
18
|
Requires-Dist: grpcio (>=1.69.0) ; python_version >= "3.13"
|
|
19
19
|
Requires-Dist: grpcio-tools (>=1.64.1,!=1.68.*) ; python_version < "3.13"
|
|
20
20
|
Requires-Dist: grpcio-tools (>=1.69.0) ; python_version >= "3.13"
|
|
21
|
-
Requires-Dist: nest-asyncio (>=1.6.0,<2.0.0)
|
|
22
21
|
Requires-Dist: opentelemetry-api (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
23
22
|
Requires-Dist: opentelemetry-distro (>=0.49b0) ; extra == "otel"
|
|
24
23
|
Requires-Dist: opentelemetry-exporter-otlp (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
@@ -29,9 +28,7 @@ Requires-Dist: prometheus-client (>=0.21.1,<0.22.0)
|
|
|
29
28
|
Requires-Dist: protobuf (>=5.29.1,<6.0.0)
|
|
30
29
|
Requires-Dist: pydantic (>=2.6.3,<3.0.0)
|
|
31
30
|
Requires-Dist: pydantic-settings (>=2.7.1,<3.0.0)
|
|
32
|
-
Requires-Dist: pytest-timeout (>=2.3.1,<3.0.0)
|
|
33
31
|
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
|
|
34
|
-
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
35
32
|
Requires-Dist: tenacity (>=8.4.1)
|
|
36
33
|
Requires-Dist: urllib3 (>=1.26.20)
|
|
37
34
|
Description-Content-Type: text/markdown
|
|
@@ -101,7 +98,7 @@ For detailed documentation, examples, and best practices, visit:
|
|
|
101
98
|
|
|
102
99
|
## Contributing
|
|
103
100
|
|
|
104
|
-
We welcome contributions! Please check out our [contributing guidelines](https://docs.hatchet.run/contributing) and join our [Discord community](https://
|
|
101
|
+
We welcome contributions! Please check out our [contributing guidelines](https://docs.hatchet.run/contributing) and join our [Discord community](https://hatchet.run/discord) for discussions and support.
|
|
105
102
|
|
|
106
103
|
## License
|
|
107
104
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
hatchet_sdk/__init__.py,sha256=
|
|
1
|
+
hatchet_sdk/__init__.py,sha256=o_06wLLKCKRq4uQuCF62yDRb8hTQYYcqPC3FIDNHxuQ,10002
|
|
2
2
|
hatchet_sdk/client.py,sha256=lApcV1-qlvIdiHyGrQJAIlT9qzP96I0mQ2STZ1ZV_2g,1940
|
|
3
3
|
hatchet_sdk/clients/admin.py,sha256=cc-TyZL6uLz3MGpdVKYziiZlmi29twP8MUJ66CboLtU,15160
|
|
4
4
|
hatchet_sdk/clients/dispatcher/action_listener.py,sha256=FogjHd6vhj4HeQs--Z-99kPwCfaETo1-EcotjdIkrig,16266
|
|
@@ -220,7 +220,7 @@ hatchet_sdk/clients/workflow_listener.py,sha256=x6FQ8d786MiubARPG0B92L3Jbs4Ve0CQ
|
|
|
220
220
|
hatchet_sdk/config.py,sha256=piNrTA4EuYNNl0FpsFWceOuIOps-6R95PWZomQWOMBA,3426
|
|
221
221
|
hatchet_sdk/connection.py,sha256=B5gT5NL9BBB5-l9U_cN6pMlraQk880rEYMnqaK_dgL0,2590
|
|
222
222
|
hatchet_sdk/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
223
|
-
hatchet_sdk/context/context.py,sha256=
|
|
223
|
+
hatchet_sdk/context/context.py,sha256=jxT4HHrocY9dftiXxob-f06JRIYENRLrSgXE-t8hgxY,9347
|
|
224
224
|
hatchet_sdk/context/worker_context.py,sha256=OVcEWvdT_Kpd0nlg61VAPUgIPSFzSLs0aSrXWj-1GX4,974
|
|
225
225
|
hatchet_sdk/contracts/dispatcher_pb2.py,sha256=SN4CIKeQwYkrbfRGhdhZo2uBn4nGzjUWIC1vvXdDeOQ,14503
|
|
226
226
|
hatchet_sdk/contracts/dispatcher_pb2.pyi,sha256=ZSGio5eYxkw-QuQx2C5ASTNcKzeMQn5JTnWaRiThafM,18455
|
|
@@ -240,6 +240,7 @@ hatchet_sdk/contracts/v1/workflows_pb2_grpc.py,sha256=XytYpV2kJQZT8iAs14z4SWsv-9
|
|
|
240
240
|
hatchet_sdk/contracts/workflows_pb2.py,sha256=9j6-YMrtgp2yxX-BePwyaqxuFhrI6OftoZSR53JPDWw,11739
|
|
241
241
|
hatchet_sdk/contracts/workflows_pb2.pyi,sha256=2r5d4DWaR0kwY8jKSzcffTAMMlWrusRXCziE_03SFYc,15434
|
|
242
242
|
hatchet_sdk/contracts/workflows_pb2_grpc.py,sha256=2V8E72DlJx5qlH2yiQpVCu5cQbKUba5X7T1yNrQDF_s,10819
|
|
243
|
+
hatchet_sdk/exceptions.py,sha256=HGmYSZy3bCY2rBDEOQfhYGRa7_j9GvYT9Pc0B8Ic5Ug,49
|
|
243
244
|
hatchet_sdk/features/cron.py,sha256=VRq5w15QpVYMkvkyIUgBO77IQpASbTxyplbgGukdmE8,9218
|
|
244
245
|
hatchet_sdk/features/logs.py,sha256=Fm3l0f2VUlQ_YqYrKqHYviK5g_j9_wUEW6J_Ax9cYzc,724
|
|
245
246
|
hatchet_sdk/features/metrics.py,sha256=Lmmu-3TITHyGGx5moA_emuzy-ZrbJhXLBDzR7Fm73pk,2897
|
|
@@ -248,7 +249,7 @@ hatchet_sdk/features/runs.py,sha256=th2czurM9uawOlcm48MBalvQTqSmfVhOMcAbHjPH_hk,
|
|
|
248
249
|
hatchet_sdk/features/scheduled.py,sha256=MfUrUOYNWewoX6GJ4YV2UWmKrxVJrgj4fX8wCxkkgv0,8900
|
|
249
250
|
hatchet_sdk/features/workers.py,sha256=HpUX8LyvFfseNn677tTvQukNqyD90-uWPhdf10znUkA,1589
|
|
250
251
|
hatchet_sdk/features/workflows.py,sha256=4hZgk7vhRhMK8wb2K3b9617TolnxRkeYL35aeLWHY2c,2143
|
|
251
|
-
hatchet_sdk/hatchet.py,sha256=
|
|
252
|
+
hatchet_sdk/hatchet.py,sha256=mVvUOovp_e6d0Z5GEHmz4AMKfsGePBK2b7BTQkhwD7U,22972
|
|
252
253
|
hatchet_sdk/labels.py,sha256=nATgxWE3lFxRTnfISEpoIRLGbMfAZsHF4lZTuG4Mfic,182
|
|
253
254
|
hatchet_sdk/logger.py,sha256=5uOr52T4mImSQm1QvWT8HvZFK5WfPNh3Y1cBQZRFgUQ,333
|
|
254
255
|
hatchet_sdk/metadata.py,sha256=XkRbhnghJJGCdVvF-uzyGBcNaTqpeQ3uiQvNNP1wyBc,107
|
|
@@ -257,7 +258,7 @@ hatchet_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
257
258
|
hatchet_sdk/rate_limit.py,sha256=TwbCuggiZaWpYuo4mjVLlE-z1OfQ2mRBiVvCSaG3lv4,3919
|
|
258
259
|
hatchet_sdk/runnables/contextvars.py,sha256=6MDocAMmlyiRW37oQ1jyx10tAlJs-xgDjR3xPoPz05g,426
|
|
259
260
|
hatchet_sdk/runnables/standalone.py,sha256=2jgUgILYIyHSYy3S6M6n2QAQ7UyvxfSQk0DDRar5RpI,5996
|
|
260
|
-
hatchet_sdk/runnables/task.py,sha256=
|
|
261
|
+
hatchet_sdk/runnables/task.py,sha256=jQiRPeE9EbIzNOxv6hkmJ8RqyVR7hMLXX4cnGRl_GF8,4832
|
|
261
262
|
hatchet_sdk/runnables/types.py,sha256=JWo4hkYb2XYoktIFVvnqud6Ywmo7AHMK_upYpdNmij0,4235
|
|
262
263
|
hatchet_sdk/runnables/workflow.py,sha256=eYIbpAAwlArhEZrd3NHDT4Yy8_GejgCzRG6TZomPugI,30681
|
|
263
264
|
hatchet_sdk/token.py,sha256=KjIiInwG5Kqd_FO4BSW1x_5Uc7PFbnzIVJqr50-ZldE,779
|
|
@@ -501,11 +502,11 @@ hatchet_sdk/waits.py,sha256=mBJVOjvTJfhXCngyIfNccYFtg7eiFM2B2n7lcg90S3A,3327
|
|
|
501
502
|
hatchet_sdk/worker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
502
503
|
hatchet_sdk/worker/action_listener_process.py,sha256=KxS7-wBpfKnsq0LNSvk-MG442Lh60iQMy3VpD1FW3mU,11703
|
|
503
504
|
hatchet_sdk/worker/runner/run_loop_manager.py,sha256=GKIH2ncGdM7nwtPn--8f6dAxQqBQv6O82mZYCEM5qnk,3971
|
|
504
|
-
hatchet_sdk/worker/runner/runner.py,sha256=
|
|
505
|
+
hatchet_sdk/worker/runner/runner.py,sha256=ZocvR7dDgEvSxcHAWDDaoTasSz3Wio70TbEbBRE3GFA,17175
|
|
505
506
|
hatchet_sdk/worker/runner/utils/capture_logs.py,sha256=nHRPSiDBqzhObM7i2X7t03OupVFnE7kQBdR2Ckgg-2w,2709
|
|
506
507
|
hatchet_sdk/worker/worker.py,sha256=qyHs64H-grF9HR1CgH7MlnoDmTQ8mm4d8basx-ZDyWc,14490
|
|
507
508
|
hatchet_sdk/workflow_run.py,sha256=Q1nTpnWNsFfjWWpx49xXYUHsVbqTnHL6JWnSKoFM3_I,1029
|
|
508
|
-
hatchet_sdk-1.2.
|
|
509
|
-
hatchet_sdk-1.2.
|
|
510
|
-
hatchet_sdk-1.2.
|
|
511
|
-
hatchet_sdk-1.2.
|
|
509
|
+
hatchet_sdk-1.2.2.dist-info/METADATA,sha256=EZhNtPSM0wpGH9Wy6CumXidREsozI01ht921I1d8xgU,3830
|
|
510
|
+
hatchet_sdk-1.2.2.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
511
|
+
hatchet_sdk-1.2.2.dist-info/entry_points.txt,sha256=5mTp_AsCWK5raiVxP_MU9eBCgkRGl4OsN6chpHcvm7o,1235
|
|
512
|
+
hatchet_sdk-1.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|