hatchet-sdk 1.2.0__py3-none-any.whl → 1.2.1__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.

@@ -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
@@ -287,13 +287,14 @@ class Runner:
287
287
  constructor = DurableContext if is_durable else Context
288
288
 
289
289
  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,
290
+ action=action,
291
+ dispatcher_client=self.dispatcher_client,
292
+ admin_client=self.admin_client,
293
+ event_client=self.client.event,
294
+ durable_event_listener=self.durable_event_listener,
295
+ worker=self.worker_context,
296
296
  validator_registry=self.validator_registry,
297
+ runs_client=self.client.runs,
297
298
  )
298
299
 
299
300
  ## IMPORTANT: Keep this method's signature in sync with the wrapper in the OTel instrumentor
@@ -415,7 +416,7 @@ class Runner:
415
416
  context = self.contexts.get(run_id)
416
417
 
417
418
  if context:
418
- context.cancel()
419
+ await context.aio_cancel()
419
420
 
420
421
  await asyncio.sleep(1)
421
422
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hatchet-sdk
3
- Version: 1.2.0
3
+ Version: 1.2.1
4
4
  Summary:
5
5
  Author: Alexander Belanger
6
6
  Author-email: alexander@hatchet.run
@@ -101,7 +101,7 @@ For detailed documentation, examples, and best practices, visit:
101
101
 
102
102
  ## Contributing
103
103
 
104
- We welcome contributions! Please check out our [contributing guidelines](https://docs.hatchet.run/contributing) and join our [Discord community](https://discord.gg/ZMeUafwH89) for discussions and support.
104
+ 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
105
 
106
106
  ## License
107
107
 
@@ -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=ViVd-aiKy-dIcCmjVegNFb_vEJhqQ-Q3Zh9llU7nlXY,9002
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
@@ -501,11 +501,11 @@ hatchet_sdk/waits.py,sha256=mBJVOjvTJfhXCngyIfNccYFtg7eiFM2B2n7lcg90S3A,3327
501
501
  hatchet_sdk/worker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
502
502
  hatchet_sdk/worker/action_listener_process.py,sha256=KxS7-wBpfKnsq0LNSvk-MG442Lh60iQMy3VpD1FW3mU,11703
503
503
  hatchet_sdk/worker/runner/run_loop_manager.py,sha256=GKIH2ncGdM7nwtPn--8f6dAxQqBQv6O82mZYCEM5qnk,3971
504
- hatchet_sdk/worker/runner/runner.py,sha256=ruDVu1NouU52xqe3Fgw9vZrvX7ljm-LDZWq-RstZhWI,17008
504
+ hatchet_sdk/worker/runner/runner.py,sha256=kO53akS6-a3_UPCj6V1nDL4V4hlUgElpS0vPE3gtvn4,17141
505
505
  hatchet_sdk/worker/runner/utils/capture_logs.py,sha256=nHRPSiDBqzhObM7i2X7t03OupVFnE7kQBdR2Ckgg-2w,2709
506
506
  hatchet_sdk/worker/worker.py,sha256=qyHs64H-grF9HR1CgH7MlnoDmTQ8mm4d8basx-ZDyWc,14490
507
507
  hatchet_sdk/workflow_run.py,sha256=Q1nTpnWNsFfjWWpx49xXYUHsVbqTnHL6JWnSKoFM3_I,1029
508
- hatchet_sdk-1.2.0.dist-info/METADATA,sha256=NeiqHrlBf1Kgy7TjcMrivyFyhySNESFO90HFb9xZ0YI,3963
509
- hatchet_sdk-1.2.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
510
- hatchet_sdk-1.2.0.dist-info/entry_points.txt,sha256=5mTp_AsCWK5raiVxP_MU9eBCgkRGl4OsN6chpHcvm7o,1235
511
- hatchet_sdk-1.2.0.dist-info/RECORD,,
508
+ hatchet_sdk-1.2.1.dist-info/METADATA,sha256=IA4Kbj31BDt_xxA2LYoTS-MOfJAYPzYP9m-EMCLvbd4,3961
509
+ hatchet_sdk-1.2.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
510
+ hatchet_sdk-1.2.1.dist-info/entry_points.txt,sha256=5mTp_AsCWK5raiVxP_MU9eBCgkRGl4OsN6chpHcvm7o,1235
511
+ hatchet_sdk-1.2.1.dist-info/RECORD,,