hatchet-sdk 1.4.0__py3-none-any.whl → 1.4.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.

hatchet_sdk/waits.py CHANGED
@@ -1,4 +1,5 @@
1
1
  from abc import ABC, abstractmethod
2
+ from datetime import datetime
2
3
  from enum import Enum
3
4
  from typing import TYPE_CHECKING
4
5
  from uuid import uuid4
@@ -58,10 +59,13 @@ class Condition(ABC):
58
59
 
59
60
 
60
61
  class SleepCondition(Condition):
61
- def __init__(self, duration: Duration) -> None:
62
+ def __init__(
63
+ self, duration: Duration, readable_data_key: str | None = None
64
+ ) -> None:
62
65
  super().__init__(
63
66
  BaseCondition(
64
- readable_data_key=f"sleep:{timedelta_to_expr(duration)}",
67
+ readable_data_key=readable_data_key
68
+ or f"sleep:{timedelta_to_expr(duration)}",
65
69
  )
66
70
  )
67
71
 
@@ -75,10 +79,15 @@ class SleepCondition(Condition):
75
79
 
76
80
 
77
81
  class UserEventCondition(Condition):
78
- def __init__(self, event_key: str, expression: str | None = None) -> None:
82
+ def __init__(
83
+ self,
84
+ event_key: str,
85
+ expression: str | None = None,
86
+ readable_data_key: str | None = None,
87
+ ) -> None:
79
88
  super().__init__(
80
89
  BaseCondition(
81
- readable_data_key=event_key,
90
+ readable_data_key=readable_data_key or event_key,
82
91
  expression=expression,
83
92
  )
84
93
  )
@@ -95,10 +104,22 @@ class UserEventCondition(Condition):
95
104
 
96
105
  class ParentCondition(Condition):
97
106
  def __init__(
98
- self, parent: "Task[TWorkflowInput, R]", expression: str | None = None
107
+ self,
108
+ parent: "Task[TWorkflowInput, R]",
109
+ expression: str | None = None,
110
+ readable_data_key: str | None = None,
99
111
  ) -> None:
100
112
  super().__init__(
101
- BaseCondition(readable_data_key=parent.name, expression=expression)
113
+ BaseCondition(
114
+ readable_data_key=readable_data_key
115
+ or (
116
+ parent.name
117
+ + (f":{expression}" if expression else "")
118
+ + ":"
119
+ + datetime.now().isoformat()
120
+ ),
121
+ expression=expression,
122
+ )
102
123
  )
103
124
 
104
125
  self.parent = parent
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: hatchet-sdk
3
- Version: 1.4.0
3
+ Version: 1.4.1
4
4
  Summary:
5
5
  License: MIT
6
6
  Author: Alexander Belanger
@@ -498,7 +498,7 @@ hatchet_sdk/v0/worker/runner/utils/error_with_traceback.py,sha256=Iih_s8JNqrinXE
498
498
  hatchet_sdk/v0/worker/worker.py,sha256=0yU0z-0si7NzG0U9et9J0tiwfVBSHl4QSiOW-WNmTQM,13027
499
499
  hatchet_sdk/v0/workflow.py,sha256=d4o425efk7J3JgLIge34MW_A3pzwnwSRtwEOgIqM2pc,9387
500
500
  hatchet_sdk/v0/workflow_run.py,sha256=jsEZprXshrSV7i_TtL5uoCL03D18zQ3NeJCq7mp97Dg,1752
501
- hatchet_sdk/waits.py,sha256=dTrelK8Lk0W5anq3TlpJwAK5z8TJ0FW7XgoSg8bf8fA,3351
501
+ hatchet_sdk/waits.py,sha256=L2xZUcmrQX-pTVXWv1W8suMoYU_eA0uowpollauQmOM,3893
502
502
  hatchet_sdk/worker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
503
503
  hatchet_sdk/worker/action_listener_process.py,sha256=KxS7-wBpfKnsq0LNSvk-MG442Lh60iQMy3VpD1FW3mU,11703
504
504
  hatchet_sdk/worker/runner/run_loop_manager.py,sha256=RNWKDCjR57nJ0LCoLUMi0_3pnmpqyo80mz_RaxHYGIc,3812
@@ -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.4.0.dist-info/METADATA,sha256=4-0m7YVw0La3uVvIk9d2OpuCwZAoVuA1XOAZ9vhtnC0,3635
510
- hatchet_sdk-1.4.0.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
511
- hatchet_sdk-1.4.0.dist-info/entry_points.txt,sha256=uYc-ivF7fUATjrWnwHP32ojgMCmogIs6yFOU8lEA4mk,1276
512
- hatchet_sdk-1.4.0.dist-info/RECORD,,
509
+ hatchet_sdk-1.4.1.dist-info/METADATA,sha256=vACzxEl9nCc_VuqANxq7gsEgrDHrEdOT_2Xsa6YIha8,3635
510
+ hatchet_sdk-1.4.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
511
+ hatchet_sdk-1.4.1.dist-info/entry_points.txt,sha256=uYc-ivF7fUATjrWnwHP32ojgMCmogIs6yFOU8lEA4mk,1276
512
+ hatchet_sdk-1.4.1.dist-info/RECORD,,