hatchet-sdk 1.0.2__py3-none-any.whl → 1.0.3__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/admin.py +6 -1
- hatchet_sdk/clients/dispatcher/action_listener.py +3 -1
- hatchet_sdk/clients/run_event_listener.py +7 -26
- hatchet_sdk/context/context.py +9 -0
- {hatchet_sdk-1.0.2.dist-info → hatchet_sdk-1.0.3.dist-info}/METADATA +1 -1
- {hatchet_sdk-1.0.2.dist-info → hatchet_sdk-1.0.3.dist-info}/RECORD +8 -8
- {hatchet_sdk-1.0.2.dist-info → hatchet_sdk-1.0.3.dist-info}/entry_points.txt +1 -0
- {hatchet_sdk-1.0.2.dist-info → hatchet_sdk-1.0.3.dist-info}/WHEEL +0 -0
hatchet_sdk/clients/admin.py
CHANGED
|
@@ -36,6 +36,7 @@ class ScheduleTriggerWorkflowOptions(BaseModel):
|
|
|
36
36
|
child_index: int | None = None
|
|
37
37
|
child_key: str | None = None
|
|
38
38
|
namespace: str | None = None
|
|
39
|
+
additional_metadata: JSONSerializableMapping = Field(default_factory=dict)
|
|
39
40
|
|
|
40
41
|
|
|
41
42
|
class TriggerWorkflowOptions(ScheduleTriggerWorkflowOptions):
|
|
@@ -153,7 +154,11 @@ class AdminClient:
|
|
|
153
154
|
name=name,
|
|
154
155
|
schedules=[self._parse_schedule(schedule) for schedule in schedules],
|
|
155
156
|
input=json.dumps(input),
|
|
156
|
-
|
|
157
|
+
parent_id=options.parent_id,
|
|
158
|
+
parent_step_run_id=options.parent_step_run_id,
|
|
159
|
+
child_index=options.child_index,
|
|
160
|
+
child_key=options.child_key,
|
|
161
|
+
additional_metadata=json.dumps(options.additional_metadata),
|
|
157
162
|
)
|
|
158
163
|
|
|
159
164
|
@tenacity_retry
|
|
@@ -298,7 +298,9 @@ class ActionListener:
|
|
|
298
298
|
)
|
|
299
299
|
)
|
|
300
300
|
except (ValueError, json.JSONDecodeError) as e:
|
|
301
|
-
|
|
301
|
+
logger.error(f"Error decoding payload: {e}")
|
|
302
|
+
|
|
303
|
+
action_payload = ActionPayload()
|
|
302
304
|
|
|
303
305
|
action = Action(
|
|
304
306
|
tenant_id=assigned_action.tenantId,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
import json
|
|
3
2
|
from enum import Enum
|
|
4
3
|
from typing import Any, AsyncGenerator, Callable, Generator, cast
|
|
5
4
|
|
|
@@ -128,18 +127,10 @@ class RunEventListener:
|
|
|
128
127
|
raise Exception(
|
|
129
128
|
f"Unknown event type: {workflow_event.eventType}"
|
|
130
129
|
)
|
|
131
|
-
payload = None
|
|
132
130
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
except Exception:
|
|
137
|
-
payload = workflow_event.eventPayload
|
|
138
|
-
pass
|
|
139
|
-
|
|
140
|
-
assert isinstance(payload, str)
|
|
141
|
-
|
|
142
|
-
yield StepRunEvent(type=eventType, payload=payload)
|
|
131
|
+
yield StepRunEvent(
|
|
132
|
+
type=eventType, payload=workflow_event.eventPayload
|
|
133
|
+
)
|
|
143
134
|
elif workflow_event.resourceType == RESOURCE_TYPE_WORKFLOW_RUN:
|
|
144
135
|
if workflow_event.eventType in step_run_event_type_mapping:
|
|
145
136
|
workflowRunEventType = step_run_event_type_mapping[
|
|
@@ -150,17 +141,10 @@ class RunEventListener:
|
|
|
150
141
|
f"Unknown event type: {workflow_event.eventType}"
|
|
151
142
|
)
|
|
152
143
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
payload = json.loads(workflow_event.eventPayload)
|
|
158
|
-
except Exception:
|
|
159
|
-
pass
|
|
160
|
-
|
|
161
|
-
assert isinstance(payload, str)
|
|
162
|
-
|
|
163
|
-
yield StepRunEvent(type=workflowRunEventType, payload=payload)
|
|
144
|
+
yield StepRunEvent(
|
|
145
|
+
type=workflowRunEventType,
|
|
146
|
+
payload=workflow_event.eventPayload,
|
|
147
|
+
)
|
|
164
148
|
|
|
165
149
|
if workflow_event.hangup:
|
|
166
150
|
listener = None
|
|
@@ -236,9 +220,6 @@ class RunEventListenerClient:
|
|
|
236
220
|
return self.stream(workflow_run_id)
|
|
237
221
|
|
|
238
222
|
def stream(self, workflow_run_id: str) -> RunEventListener:
|
|
239
|
-
if not isinstance(workflow_run_id, str) and hasattr(workflow_run_id, "__str__"):
|
|
240
|
-
workflow_run_id = str(workflow_run_id)
|
|
241
|
-
|
|
242
223
|
if not self.client:
|
|
243
224
|
aio_conn = new_conn(self.config, True)
|
|
244
225
|
self.client = DispatcherStub(aio_conn) # type: ignore[no-untyped-call]
|
hatchet_sdk/context/context.py
CHANGED
|
@@ -113,6 +113,14 @@ class Context:
|
|
|
113
113
|
|
|
114
114
|
return parent_step_data
|
|
115
115
|
|
|
116
|
+
def aio_task_output(self, task: "Task[TWorkflowInput, R]") -> "R":
|
|
117
|
+
if task.is_async_function:
|
|
118
|
+
return self.task_output(task)
|
|
119
|
+
|
|
120
|
+
raise ValueError(
|
|
121
|
+
f"Task '{task.name}' is not an async function. Use `task_output` instead."
|
|
122
|
+
)
|
|
123
|
+
|
|
116
124
|
@property
|
|
117
125
|
def was_triggered_by_event(self) -> bool:
|
|
118
126
|
return self.data.triggered_by == "event"
|
|
@@ -157,6 +165,7 @@ class Context:
|
|
|
157
165
|
|
|
158
166
|
def handle_result(future: Future[tuple[bool, Exception | None]]) -> None:
|
|
159
167
|
success, exception = future.result()
|
|
168
|
+
|
|
160
169
|
if not success and exception:
|
|
161
170
|
if raise_on_error:
|
|
162
171
|
raise exception
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
hatchet_sdk/__init__.py,sha256=o_06wLLKCKRq4uQuCF62yDRb8hTQYYcqPC3FIDNHxuQ,10002
|
|
2
2
|
hatchet_sdk/client.py,sha256=nfLv2jzv7XlL9VzQSnfyCdtK4ew0zanUgsoXC0KEtY0,2255
|
|
3
|
-
hatchet_sdk/clients/admin.py,sha256=
|
|
4
|
-
hatchet_sdk/clients/dispatcher/action_listener.py,sha256=
|
|
3
|
+
hatchet_sdk/clients/admin.py,sha256=C-a1kkF2OCR4LOj489uIg_vHAEPiiG3LjyKxU7Y085w,16638
|
|
4
|
+
hatchet_sdk/clients/dispatcher/action_listener.py,sha256=8enip982Fkb_8blco1ixahmuaKwxsahx06wDWte_4MU,16595
|
|
5
5
|
hatchet_sdk/clients/dispatcher/dispatcher.py,sha256=GMb4ljE-gSTf5RkpmRboPXCMncJKAJ6KKERGcf1nz48,6993
|
|
6
6
|
hatchet_sdk/clients/durable_event_listener.py,sha256=XzXECjulUWSsu6wiWYKogqKPGa1gwcrKFtr2SJ4xSok,11850
|
|
7
7
|
hatchet_sdk/clients/event_ts.py,sha256=tbWLz3NXrwMyIoEm0Q2TfitF5cNEpo3k42jWKciOK8A,1082
|
|
@@ -214,13 +214,13 @@ hatchet_sdk/clients/rest/models/workflow_version_meta.py,sha256=TW4R7bAuYAg_LraN
|
|
|
214
214
|
hatchet_sdk/clients/rest/models/workflow_workers_count.py,sha256=qhzqfvjjIDyARkiiLGluMIqEmqO-diHTsjlu0Doi0yg,2875
|
|
215
215
|
hatchet_sdk/clients/rest/rest.py,sha256=NbmK_NvoL3-g6Oul6dsZgJO3XvCWtw2V0qAbr8pGfQE,6967
|
|
216
216
|
hatchet_sdk/clients/rest/tenacity_utils.py,sha256=n6QvwuGwinLQpiWNU5GxrDNhFBE8_wZdg3WNur21rJ0,1055
|
|
217
|
-
hatchet_sdk/clients/run_event_listener.py,sha256=
|
|
217
|
+
hatchet_sdk/clients/run_event_listener.py,sha256=12o2P8bi3NUGhzPi7UM9d9D-FX94cr5qyNIEWIweFD0,9960
|
|
218
218
|
hatchet_sdk/clients/v1/api_client.py,sha256=0FmhJIjN5Y4CWEsIWt0XzoOmIFUjPwFOAG0TI-fVqHI,2412
|
|
219
219
|
hatchet_sdk/clients/workflow_listener.py,sha256=sdeCN3z1kMurG_5rLoT3-rVUJKrd3XJerVPnMfR6U4U,10470
|
|
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=ViVd-aiKy-dIcCmjVegNFb_vEJhqQ-Q3Zh9llU7nlXY,9002
|
|
224
224
|
hatchet_sdk/context/worker_context.py,sha256=OVcEWvdT_Kpd0nlg61VAPUgIPSFzSLs0aSrXWj-1GX4,974
|
|
225
225
|
hatchet_sdk/contracts/dispatcher_pb2.py,sha256=B35F3XQQkk05UA84nuZOIFtiydgPbB8gA5FhvNvSqb0,14414
|
|
226
226
|
hatchet_sdk/contracts/dispatcher_pb2.pyi,sha256=JLtc615N9vNDRtQoUVynclPBbgIsRhbikcrT8b7Z-TM,18336
|
|
@@ -505,7 +505,7 @@ hatchet_sdk/worker/runner/runner.py,sha256=IIvjrE1sJlF1oEdMTk7s15-CjTyCu8om6yEFi
|
|
|
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=JTLOuGyEat4OvMM3h55WrX0aFFpqs5YtK7YJxTMC92I,1428
|
|
508
|
-
hatchet_sdk-1.0.
|
|
509
|
-
hatchet_sdk-1.0.
|
|
510
|
-
hatchet_sdk-1.0.
|
|
511
|
-
hatchet_sdk-1.0.
|
|
508
|
+
hatchet_sdk-1.0.3.dist-info/METADATA,sha256=Ltt_FG3crdnhRIB2CZLjTSKSpM6ca06QiylFWgBHQfM,1876
|
|
509
|
+
hatchet_sdk-1.0.3.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
510
|
+
hatchet_sdk-1.0.3.dist-info/entry_points.txt,sha256=5mTp_AsCWK5raiVxP_MU9eBCgkRGl4OsN6chpHcvm7o,1235
|
|
511
|
+
hatchet_sdk-1.0.3.dist-info/RECORD,,
|
|
@@ -23,6 +23,7 @@ pydantic=examples.pydantic.worker:main
|
|
|
23
23
|
rate_limit=examples.rate_limit.worker:main
|
|
24
24
|
retries_with_backoff=examples.retries_with_backoff.worker:main
|
|
25
25
|
simple=examples.simple.worker:main
|
|
26
|
+
streaming=examples.streaming.worker:main
|
|
26
27
|
timeout=examples.timeout.worker:main
|
|
27
28
|
v2_simple=examples.v2.simple.worker:main
|
|
28
29
|
waits=examples.waits.worker:main
|
|
File without changes
|