hatchet-sdk 1.1.0__py3-none-any.whl → 1.2.0__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 +2 -1
- hatchet_sdk/clients/dispatcher/dispatcher.py +15 -3
- hatchet_sdk/contracts/dispatcher_pb2.py +46 -46
- hatchet_sdk/contracts/dispatcher_pb2.pyi +4 -2
- hatchet_sdk/runnables/task.py +4 -0
- hatchet_sdk/runnables/workflow.py +28 -0
- hatchet_sdk/worker/action_listener_process.py +7 -1
- hatchet_sdk/worker/runner/runner.py +21 -5
- hatchet_sdk-1.2.0.dist-info/METADATA +109 -0
- {hatchet_sdk-1.1.0.dist-info → hatchet_sdk-1.2.0.dist-info}/RECORD +12 -12
- hatchet_sdk-1.1.0.dist-info/METADATA +0 -42
- {hatchet_sdk-1.1.0.dist-info → hatchet_sdk-1.2.0.dist-info}/WHEEL +0 -0
- {hatchet_sdk-1.1.0.dist-info → hatchet_sdk-1.2.0.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 Task
|
|
141
|
+
from hatchet_sdk.runnables.task import NonRetryableException, Task
|
|
142
142
|
from hatchet_sdk.runnables.types import (
|
|
143
143
|
ConcurrencyExpression,
|
|
144
144
|
ConcurrencyLimitStrategy,
|
|
@@ -269,4 +269,5 @@ __all__ = [
|
|
|
269
269
|
"BulkCancelReplayOpts",
|
|
270
270
|
"RunFilter",
|
|
271
271
|
"V1TaskStatus",
|
|
272
|
+
"NonRetryableException",
|
|
272
273
|
]
|
|
@@ -76,10 +76,16 @@ class DispatcherClient:
|
|
|
76
76
|
return ActionListener(self.config, response.workerId)
|
|
77
77
|
|
|
78
78
|
async def send_step_action_event(
|
|
79
|
-
self,
|
|
79
|
+
self,
|
|
80
|
+
action: Action,
|
|
81
|
+
event_type: StepActionEventType,
|
|
82
|
+
payload: str,
|
|
83
|
+
should_not_retry: bool,
|
|
80
84
|
) -> grpc.aio.UnaryUnaryCall[StepActionEvent, ActionEventResponse] | None:
|
|
81
85
|
try:
|
|
82
|
-
return await self._try_send_step_action_event(
|
|
86
|
+
return await self._try_send_step_action_event(
|
|
87
|
+
action, event_type, payload, should_not_retry
|
|
88
|
+
)
|
|
83
89
|
except Exception as e:
|
|
84
90
|
# for step action events, send a failure event when we cannot send the completed event
|
|
85
91
|
if (
|
|
@@ -90,13 +96,18 @@ class DispatcherClient:
|
|
|
90
96
|
action,
|
|
91
97
|
STEP_EVENT_TYPE_FAILED,
|
|
92
98
|
"Failed to send finished event: " + str(e),
|
|
99
|
+
should_not_retry=True,
|
|
93
100
|
)
|
|
94
101
|
|
|
95
102
|
return None
|
|
96
103
|
|
|
97
104
|
@tenacity_retry
|
|
98
105
|
async def _try_send_step_action_event(
|
|
99
|
-
self,
|
|
106
|
+
self,
|
|
107
|
+
action: Action,
|
|
108
|
+
event_type: StepActionEventType,
|
|
109
|
+
payload: str,
|
|
110
|
+
should_not_retry: bool,
|
|
100
111
|
) -> grpc.aio.UnaryUnaryCall[StepActionEvent, ActionEventResponse]:
|
|
101
112
|
if not self.aio_client:
|
|
102
113
|
aio_conn = new_conn(self.config, True)
|
|
@@ -116,6 +127,7 @@ class DispatcherClient:
|
|
|
116
127
|
eventType=event_type,
|
|
117
128
|
eventPayload=payload,
|
|
118
129
|
retryCount=action.retry_count,
|
|
130
|
+
shouldNotRetry=should_not_retry,
|
|
119
131
|
)
|
|
120
132
|
|
|
121
133
|
return cast(
|
|
@@ -15,7 +15,7 @@ _sym_db = _symbol_database.Default()
|
|
|
15
15
|
from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x64ispatcher.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"V\n\x0cWorkerLabels\x12\x15\n\x08strValue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08intValue\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x0b\n\t_strValueB\x0b\n\t_intValue\"\xc8\x01\n\x0bRuntimeInfo\x12\x17\n\nsdkVersion\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1c\n\x08language\x18\x02 \x01(\x0e\x32\x05.SDKSH\x01\x88\x01\x01\x12\x1c\n\x0flanguageVersion\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x0f\n\x02os\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x12\n\x05\x65xtra\x18\x05 \x01(\tH\x04\x88\x01\x01\x42\r\n\x0b_sdkVersionB\x0b\n\t_languageB\x12\n\x10_languageVersionB\x05\n\x03_osB\x08\n\x06_extra\"\xc0\x02\n\x15WorkerRegisterRequest\x12\x12\n\nworkerName\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x63tions\x18\x02 \x03(\t\x12\x10\n\x08services\x18\x03 \x03(\t\x12\x14\n\x07maxRuns\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12\x32\n\x06labels\x18\x05 \x03(\x0b\x32\".WorkerRegisterRequest.LabelsEntry\x12\x16\n\twebhookId\x18\x06 \x01(\tH\x01\x88\x01\x01\x12&\n\x0bruntimeInfo\x18\x07 \x01(\x0b\x32\x0c.RuntimeInfoH\x02\x88\x01\x01\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\x42\n\n\x08_maxRunsB\x0c\n\n_webhookIdB\x0e\n\x0c_runtimeInfo\"P\n\x16WorkerRegisterResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\x12\x12\n\nworkerName\x18\x03 \x01(\t\"\xa3\x01\n\x19UpsertWorkerLabelsRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\x36\n\x06labels\x18\x02 \x03(\x0b\x32&.UpsertWorkerLabelsRequest.LabelsEntry\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\"@\n\x1aUpsertWorkerLabelsResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\x86\x04\n\x0e\x41ssignedAction\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x15\n\rworkflowRunId\x18\x02 \x01(\t\x12\x18\n\x10getGroupKeyRunId\x18\x03 \x01(\t\x12\r\n\x05jobId\x18\x04 \x01(\t\x12\x0f\n\x07jobName\x18\x05 \x01(\t\x12\x10\n\x08jobRunId\x18\x06 \x01(\t\x12\x0e\n\x06stepId\x18\x07 \x01(\t\x12\x11\n\tstepRunId\x18\x08 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\t \x01(\t\x12\x1f\n\nactionType\x18\n \x01(\x0e\x32\x0b.ActionType\x12\x15\n\ractionPayload\x18\x0b \x01(\t\x12\x10\n\x08stepName\x18\x0c \x01(\t\x12\x12\n\nretryCount\x18\r \x01(\x05\x12 \n\x13\x61\x64\x64itional_metadata\x18\x0e \x01(\tH\x00\x88\x01\x01\x12!\n\x14\x63hild_workflow_index\x18\x0f \x01(\x05H\x01\x88\x01\x01\x12\x1f\n\x12\x63hild_workflow_key\x18\x10 \x01(\tH\x02\x88\x01\x01\x12#\n\x16parent_workflow_run_id\x18\x11 \x01(\tH\x03\x88\x01\x01\x42\x16\n\x14_additional_metadataB\x17\n\x15_child_workflow_indexB\x15\n\x13_child_workflow_keyB\x19\n\x17_parent_workflow_run_id\"\'\n\x13WorkerListenRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\",\n\x18WorkerUnsubscribeRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\"?\n\x19WorkerUnsubscribeResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\xe1\x01\n\x13GroupKeyActionEvent\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\x15\n\rworkflowRunId\x18\x02 \x01(\t\x12\x18\n\x10getGroupKeyRunId\x18\x03 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\x04 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\teventType\x18\x06 \x01(\x0e\x32\x18.GroupKeyActionEventType\x12\x14\n\x0c\x65ventPayload\x18\x07 \x01(\t\"\
|
|
18
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x64ispatcher.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"V\n\x0cWorkerLabels\x12\x15\n\x08strValue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08intValue\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x0b\n\t_strValueB\x0b\n\t_intValue\"\xc8\x01\n\x0bRuntimeInfo\x12\x17\n\nsdkVersion\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1c\n\x08language\x18\x02 \x01(\x0e\x32\x05.SDKSH\x01\x88\x01\x01\x12\x1c\n\x0flanguageVersion\x18\x03 \x01(\tH\x02\x88\x01\x01\x12\x0f\n\x02os\x18\x04 \x01(\tH\x03\x88\x01\x01\x12\x12\n\x05\x65xtra\x18\x05 \x01(\tH\x04\x88\x01\x01\x42\r\n\x0b_sdkVersionB\x0b\n\t_languageB\x12\n\x10_languageVersionB\x05\n\x03_osB\x08\n\x06_extra\"\xc0\x02\n\x15WorkerRegisterRequest\x12\x12\n\nworkerName\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x63tions\x18\x02 \x03(\t\x12\x10\n\x08services\x18\x03 \x03(\t\x12\x14\n\x07maxRuns\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12\x32\n\x06labels\x18\x05 \x03(\x0b\x32\".WorkerRegisterRequest.LabelsEntry\x12\x16\n\twebhookId\x18\x06 \x01(\tH\x01\x88\x01\x01\x12&\n\x0bruntimeInfo\x18\x07 \x01(\x0b\x32\x0c.RuntimeInfoH\x02\x88\x01\x01\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\x42\n\n\x08_maxRunsB\x0c\n\n_webhookIdB\x0e\n\x0c_runtimeInfo\"P\n\x16WorkerRegisterResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\x12\x12\n\nworkerName\x18\x03 \x01(\t\"\xa3\x01\n\x19UpsertWorkerLabelsRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\x36\n\x06labels\x18\x02 \x03(\x0b\x32&.UpsertWorkerLabelsRequest.LabelsEntry\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\"@\n\x1aUpsertWorkerLabelsResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\x86\x04\n\x0e\x41ssignedAction\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x15\n\rworkflowRunId\x18\x02 \x01(\t\x12\x18\n\x10getGroupKeyRunId\x18\x03 \x01(\t\x12\r\n\x05jobId\x18\x04 \x01(\t\x12\x0f\n\x07jobName\x18\x05 \x01(\t\x12\x10\n\x08jobRunId\x18\x06 \x01(\t\x12\x0e\n\x06stepId\x18\x07 \x01(\t\x12\x11\n\tstepRunId\x18\x08 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\t \x01(\t\x12\x1f\n\nactionType\x18\n \x01(\x0e\x32\x0b.ActionType\x12\x15\n\ractionPayload\x18\x0b \x01(\t\x12\x10\n\x08stepName\x18\x0c \x01(\t\x12\x12\n\nretryCount\x18\r \x01(\x05\x12 \n\x13\x61\x64\x64itional_metadata\x18\x0e \x01(\tH\x00\x88\x01\x01\x12!\n\x14\x63hild_workflow_index\x18\x0f \x01(\x05H\x01\x88\x01\x01\x12\x1f\n\x12\x63hild_workflow_key\x18\x10 \x01(\tH\x02\x88\x01\x01\x12#\n\x16parent_workflow_run_id\x18\x11 \x01(\tH\x03\x88\x01\x01\x42\x16\n\x14_additional_metadataB\x17\n\x15_child_workflow_indexB\x15\n\x13_child_workflow_keyB\x19\n\x17_parent_workflow_run_id\"\'\n\x13WorkerListenRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\",\n\x18WorkerUnsubscribeRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\"?\n\x19WorkerUnsubscribeResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\xe1\x01\n\x13GroupKeyActionEvent\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\x15\n\rworkflowRunId\x18\x02 \x01(\t\x12\x18\n\x10getGroupKeyRunId\x18\x03 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\x04 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\teventType\x18\x06 \x01(\x0e\x32\x18.GroupKeyActionEventType\x12\x14\n\x0c\x65ventPayload\x18\x07 \x01(\t\"\xc4\x02\n\x0fStepActionEvent\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\r\n\x05jobId\x18\x02 \x01(\t\x12\x10\n\x08jobRunId\x18\x03 \x01(\t\x12\x0e\n\x06stepId\x18\x04 \x01(\t\x12\x11\n\tstepRunId\x18\x05 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\x06 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\teventType\x18\x08 \x01(\x0e\x32\x14.StepActionEventType\x12\x14\n\x0c\x65ventPayload\x18\t \x01(\t\x12\x17\n\nretryCount\x18\n \x01(\x05H\x00\x88\x01\x01\x12\x1b\n\x0eshouldNotRetry\x18\x0b \x01(\x08H\x01\x88\x01\x01\x42\r\n\x0b_retryCountB\x11\n\x0f_shouldNotRetry\"9\n\x13\x41\x63tionEventResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\xc0\x01\n SubscribeToWorkflowEventsRequest\x12\x1a\n\rworkflowRunId\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11\x61\x64\x64itionalMetaKey\x18\x02 \x01(\tH\x01\x88\x01\x01\x12 \n\x13\x61\x64\x64itionalMetaValue\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_workflowRunIdB\x14\n\x12_additionalMetaKeyB\x16\n\x14_additionalMetaValue\"7\n\x1eSubscribeToWorkflowRunsRequest\x12\x15\n\rworkflowRunId\x18\x01 \x01(\t\"\xb2\x02\n\rWorkflowEvent\x12\x15\n\rworkflowRunId\x18\x01 \x01(\t\x12#\n\x0cresourceType\x18\x02 \x01(\x0e\x32\r.ResourceType\x12%\n\teventType\x18\x03 \x01(\x0e\x32\x12.ResourceEventType\x12\x12\n\nresourceId\x18\x04 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0c\x65ventPayload\x18\x06 \x01(\t\x12\x0e\n\x06hangup\x18\x07 \x01(\x08\x12\x18\n\x0bstepRetries\x18\x08 \x01(\x05H\x00\x88\x01\x01\x12\x17\n\nretryCount\x18\t \x01(\x05H\x01\x88\x01\x01\x42\x0e\n\x0c_stepRetriesB\r\n\x0b_retryCount\"\xa8\x01\n\x10WorkflowRunEvent\x12\x15\n\rworkflowRunId\x18\x01 \x01(\t\x12(\n\teventType\x18\x02 \x01(\x0e\x32\x15.WorkflowRunEventType\x12\x32\n\x0e\x65ventTimestamp\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1f\n\x07results\x18\x04 \x03(\x0b\x32\x0e.StepRunResult\"\x8a\x01\n\rStepRunResult\x12\x11\n\tstepRunId\x18\x01 \x01(\t\x12\x16\n\x0estepReadableId\x18\x02 \x01(\t\x12\x10\n\x08jobRunId\x18\x03 \x01(\t\x12\x12\n\x05\x65rror\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06output\x18\x05 \x01(\tH\x01\x88\x01\x01\x42\x08\n\x06_errorB\t\n\x07_output\"W\n\rOverridesData\x12\x11\n\tstepRunId\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t\x12\x16\n\x0e\x63\x61llerFilename\x18\x04 \x01(\t\"\x17\n\x15OverridesDataResponse\"U\n\x10HeartbeatRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12/\n\x0bheartbeatAt\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x13\n\x11HeartbeatResponse\"F\n\x15RefreshTimeoutRequest\x12\x11\n\tstepRunId\x18\x01 \x01(\t\x12\x1a\n\x12incrementTimeoutBy\x18\x02 \x01(\t\"G\n\x16RefreshTimeoutResponse\x12-\n\ttimeoutAt\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\'\n\x12ReleaseSlotRequest\x12\x11\n\tstepRunId\x18\x01 \x01(\t\"\x15\n\x13ReleaseSlotResponse*7\n\x04SDKS\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x06\n\x02GO\x10\x01\x12\n\n\x06PYTHON\x10\x02\x12\x0e\n\nTYPESCRIPT\x10\x03*N\n\nActionType\x12\x12\n\x0eSTART_STEP_RUN\x10\x00\x12\x13\n\x0f\x43\x41NCEL_STEP_RUN\x10\x01\x12\x17\n\x13START_GET_GROUP_KEY\x10\x02*\xa2\x01\n\x17GroupKeyActionEventType\x12 \n\x1cGROUP_KEY_EVENT_TYPE_UNKNOWN\x10\x00\x12 \n\x1cGROUP_KEY_EVENT_TYPE_STARTED\x10\x01\x12\"\n\x1eGROUP_KEY_EVENT_TYPE_COMPLETED\x10\x02\x12\x1f\n\x1bGROUP_KEY_EVENT_TYPE_FAILED\x10\x03*\xac\x01\n\x13StepActionEventType\x12\x1b\n\x17STEP_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1b\n\x17STEP_EVENT_TYPE_STARTED\x10\x01\x12\x1d\n\x19STEP_EVENT_TYPE_COMPLETED\x10\x02\x12\x1a\n\x16STEP_EVENT_TYPE_FAILED\x10\x03\x12 \n\x1cSTEP_EVENT_TYPE_ACKNOWLEDGED\x10\x04*e\n\x0cResourceType\x12\x19\n\x15RESOURCE_TYPE_UNKNOWN\x10\x00\x12\x1a\n\x16RESOURCE_TYPE_STEP_RUN\x10\x01\x12\x1e\n\x1aRESOURCE_TYPE_WORKFLOW_RUN\x10\x02*\xfe\x01\n\x11ResourceEventType\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_STARTED\x10\x01\x12!\n\x1dRESOURCE_EVENT_TYPE_COMPLETED\x10\x02\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_FAILED\x10\x03\x12!\n\x1dRESOURCE_EVENT_TYPE_CANCELLED\x10\x04\x12!\n\x1dRESOURCE_EVENT_TYPE_TIMED_OUT\x10\x05\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_STREAM\x10\x06*<\n\x14WorkflowRunEventType\x12$\n WORKFLOW_RUN_EVENT_TYPE_FINISHED\x10\x00\x32\xf8\x06\n\nDispatcher\x12=\n\x08Register\x12\x16.WorkerRegisterRequest\x1a\x17.WorkerRegisterResponse\"\x00\x12\x33\n\x06Listen\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x35\n\x08ListenV2\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x34\n\tHeartbeat\x12\x11.HeartbeatRequest\x1a\x12.HeartbeatResponse\"\x00\x12R\n\x19SubscribeToWorkflowEvents\x12!.SubscribeToWorkflowEventsRequest\x1a\x0e.WorkflowEvent\"\x00\x30\x01\x12S\n\x17SubscribeToWorkflowRuns\x12\x1f.SubscribeToWorkflowRunsRequest\x1a\x11.WorkflowRunEvent\"\x00(\x01\x30\x01\x12?\n\x13SendStepActionEvent\x12\x10.StepActionEvent\x1a\x14.ActionEventResponse\"\x00\x12G\n\x17SendGroupKeyActionEvent\x12\x14.GroupKeyActionEvent\x1a\x14.ActionEventResponse\"\x00\x12<\n\x10PutOverridesData\x12\x0e.OverridesData\x1a\x16.OverridesDataResponse\"\x00\x12\x46\n\x0bUnsubscribe\x12\x19.WorkerUnsubscribeRequest\x1a\x1a.WorkerUnsubscribeResponse\"\x00\x12\x43\n\x0eRefreshTimeout\x12\x16.RefreshTimeoutRequest\x1a\x17.RefreshTimeoutResponse\"\x00\x12:\n\x0bReleaseSlot\x12\x13.ReleaseSlotRequest\x1a\x14.ReleaseSlotResponse\"\x00\x12O\n\x12UpsertWorkerLabels\x12\x1a.UpsertWorkerLabelsRequest\x1a\x1b.UpsertWorkerLabelsResponse\"\x00\x42GZEgithub.com/hatchet-dev/hatchet/internal/services/dispatcher/contractsb\x06proto3')
|
|
19
19
|
|
|
20
20
|
_globals = globals()
|
|
21
21
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -27,20 +27,20 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
27
27
|
_globals['_WORKERREGISTERREQUEST_LABELSENTRY']._serialized_options = b'8\001'
|
|
28
28
|
_globals['_UPSERTWORKERLABELSREQUEST_LABELSENTRY']._loaded_options = None
|
|
29
29
|
_globals['_UPSERTWORKERLABELSREQUEST_LABELSENTRY']._serialized_options = b'8\001'
|
|
30
|
-
_globals['_SDKS']._serialized_start=
|
|
31
|
-
_globals['_SDKS']._serialized_end=
|
|
32
|
-
_globals['_ACTIONTYPE']._serialized_start=
|
|
33
|
-
_globals['_ACTIONTYPE']._serialized_end=
|
|
34
|
-
_globals['_GROUPKEYACTIONEVENTTYPE']._serialized_start=
|
|
35
|
-
_globals['_GROUPKEYACTIONEVENTTYPE']._serialized_end=
|
|
36
|
-
_globals['_STEPACTIONEVENTTYPE']._serialized_start=
|
|
37
|
-
_globals['_STEPACTIONEVENTTYPE']._serialized_end=
|
|
38
|
-
_globals['_RESOURCETYPE']._serialized_start=
|
|
39
|
-
_globals['_RESOURCETYPE']._serialized_end=
|
|
40
|
-
_globals['_RESOURCEEVENTTYPE']._serialized_start=
|
|
41
|
-
_globals['_RESOURCEEVENTTYPE']._serialized_end=
|
|
42
|
-
_globals['_WORKFLOWRUNEVENTTYPE']._serialized_start=
|
|
43
|
-
_globals['_WORKFLOWRUNEVENTTYPE']._serialized_end=
|
|
30
|
+
_globals['_SDKS']._serialized_start=3572
|
|
31
|
+
_globals['_SDKS']._serialized_end=3627
|
|
32
|
+
_globals['_ACTIONTYPE']._serialized_start=3629
|
|
33
|
+
_globals['_ACTIONTYPE']._serialized_end=3707
|
|
34
|
+
_globals['_GROUPKEYACTIONEVENTTYPE']._serialized_start=3710
|
|
35
|
+
_globals['_GROUPKEYACTIONEVENTTYPE']._serialized_end=3872
|
|
36
|
+
_globals['_STEPACTIONEVENTTYPE']._serialized_start=3875
|
|
37
|
+
_globals['_STEPACTIONEVENTTYPE']._serialized_end=4047
|
|
38
|
+
_globals['_RESOURCETYPE']._serialized_start=4049
|
|
39
|
+
_globals['_RESOURCETYPE']._serialized_end=4150
|
|
40
|
+
_globals['_RESOURCEEVENTTYPE']._serialized_start=4153
|
|
41
|
+
_globals['_RESOURCEEVENTTYPE']._serialized_end=4407
|
|
42
|
+
_globals['_WORKFLOWRUNEVENTTYPE']._serialized_start=4409
|
|
43
|
+
_globals['_WORKFLOWRUNEVENTTYPE']._serialized_end=4469
|
|
44
44
|
_globals['_WORKERLABELS']._serialized_start=53
|
|
45
45
|
_globals['_WORKERLABELS']._serialized_end=139
|
|
46
46
|
_globals['_RUNTIMEINFO']._serialized_start=142
|
|
@@ -68,35 +68,35 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
68
68
|
_globals['_GROUPKEYACTIONEVENT']._serialized_start=1655
|
|
69
69
|
_globals['_GROUPKEYACTIONEVENT']._serialized_end=1880
|
|
70
70
|
_globals['_STEPACTIONEVENT']._serialized_start=1883
|
|
71
|
-
_globals['_STEPACTIONEVENT']._serialized_end=
|
|
72
|
-
_globals['_ACTIONEVENTRESPONSE']._serialized_start=
|
|
73
|
-
_globals['_ACTIONEVENTRESPONSE']._serialized_end=
|
|
74
|
-
_globals['_SUBSCRIBETOWORKFLOWEVENTSREQUEST']._serialized_start=
|
|
75
|
-
_globals['_SUBSCRIBETOWORKFLOWEVENTSREQUEST']._serialized_end=
|
|
76
|
-
_globals['_SUBSCRIBETOWORKFLOWRUNSREQUEST']._serialized_start=
|
|
77
|
-
_globals['_SUBSCRIBETOWORKFLOWRUNSREQUEST']._serialized_end=
|
|
78
|
-
_globals['_WORKFLOWEVENT']._serialized_start=
|
|
79
|
-
_globals['_WORKFLOWEVENT']._serialized_end=
|
|
80
|
-
_globals['_WORKFLOWRUNEVENT']._serialized_start=
|
|
81
|
-
_globals['_WORKFLOWRUNEVENT']._serialized_end=
|
|
82
|
-
_globals['_STEPRUNRESULT']._serialized_start=
|
|
83
|
-
_globals['_STEPRUNRESULT']._serialized_end=
|
|
84
|
-
_globals['_OVERRIDESDATA']._serialized_start=
|
|
85
|
-
_globals['_OVERRIDESDATA']._serialized_end=
|
|
86
|
-
_globals['_OVERRIDESDATARESPONSE']._serialized_start=
|
|
87
|
-
_globals['_OVERRIDESDATARESPONSE']._serialized_end=
|
|
88
|
-
_globals['_HEARTBEATREQUEST']._serialized_start=
|
|
89
|
-
_globals['_HEARTBEATREQUEST']._serialized_end=
|
|
90
|
-
_globals['_HEARTBEATRESPONSE']._serialized_start=
|
|
91
|
-
_globals['_HEARTBEATRESPONSE']._serialized_end=
|
|
92
|
-
_globals['_REFRESHTIMEOUTREQUEST']._serialized_start=
|
|
93
|
-
_globals['_REFRESHTIMEOUTREQUEST']._serialized_end=
|
|
94
|
-
_globals['_REFRESHTIMEOUTRESPONSE']._serialized_start=
|
|
95
|
-
_globals['_REFRESHTIMEOUTRESPONSE']._serialized_end=
|
|
96
|
-
_globals['_RELEASESLOTREQUEST']._serialized_start=
|
|
97
|
-
_globals['_RELEASESLOTREQUEST']._serialized_end=
|
|
98
|
-
_globals['_RELEASESLOTRESPONSE']._serialized_start=
|
|
99
|
-
_globals['_RELEASESLOTRESPONSE']._serialized_end=
|
|
100
|
-
_globals['_DISPATCHER']._serialized_start=
|
|
101
|
-
_globals['_DISPATCHER']._serialized_end=
|
|
71
|
+
_globals['_STEPACTIONEVENT']._serialized_end=2207
|
|
72
|
+
_globals['_ACTIONEVENTRESPONSE']._serialized_start=2209
|
|
73
|
+
_globals['_ACTIONEVENTRESPONSE']._serialized_end=2266
|
|
74
|
+
_globals['_SUBSCRIBETOWORKFLOWEVENTSREQUEST']._serialized_start=2269
|
|
75
|
+
_globals['_SUBSCRIBETOWORKFLOWEVENTSREQUEST']._serialized_end=2461
|
|
76
|
+
_globals['_SUBSCRIBETOWORKFLOWRUNSREQUEST']._serialized_start=2463
|
|
77
|
+
_globals['_SUBSCRIBETOWORKFLOWRUNSREQUEST']._serialized_end=2518
|
|
78
|
+
_globals['_WORKFLOWEVENT']._serialized_start=2521
|
|
79
|
+
_globals['_WORKFLOWEVENT']._serialized_end=2827
|
|
80
|
+
_globals['_WORKFLOWRUNEVENT']._serialized_start=2830
|
|
81
|
+
_globals['_WORKFLOWRUNEVENT']._serialized_end=2998
|
|
82
|
+
_globals['_STEPRUNRESULT']._serialized_start=3001
|
|
83
|
+
_globals['_STEPRUNRESULT']._serialized_end=3139
|
|
84
|
+
_globals['_OVERRIDESDATA']._serialized_start=3141
|
|
85
|
+
_globals['_OVERRIDESDATA']._serialized_end=3228
|
|
86
|
+
_globals['_OVERRIDESDATARESPONSE']._serialized_start=3230
|
|
87
|
+
_globals['_OVERRIDESDATARESPONSE']._serialized_end=3253
|
|
88
|
+
_globals['_HEARTBEATREQUEST']._serialized_start=3255
|
|
89
|
+
_globals['_HEARTBEATREQUEST']._serialized_end=3340
|
|
90
|
+
_globals['_HEARTBEATRESPONSE']._serialized_start=3342
|
|
91
|
+
_globals['_HEARTBEATRESPONSE']._serialized_end=3361
|
|
92
|
+
_globals['_REFRESHTIMEOUTREQUEST']._serialized_start=3363
|
|
93
|
+
_globals['_REFRESHTIMEOUTREQUEST']._serialized_end=3433
|
|
94
|
+
_globals['_REFRESHTIMEOUTRESPONSE']._serialized_start=3435
|
|
95
|
+
_globals['_REFRESHTIMEOUTRESPONSE']._serialized_end=3506
|
|
96
|
+
_globals['_RELEASESLOTREQUEST']._serialized_start=3508
|
|
97
|
+
_globals['_RELEASESLOTREQUEST']._serialized_end=3547
|
|
98
|
+
_globals['_RELEASESLOTRESPONSE']._serialized_start=3549
|
|
99
|
+
_globals['_RELEASESLOTRESPONSE']._serialized_end=3570
|
|
100
|
+
_globals['_DISPATCHER']._serialized_start=4472
|
|
101
|
+
_globals['_DISPATCHER']._serialized_end=5360
|
|
102
102
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -239,7 +239,7 @@ class GroupKeyActionEvent(_message.Message):
|
|
|
239
239
|
def __init__(self, workerId: _Optional[str] = ..., workflowRunId: _Optional[str] = ..., getGroupKeyRunId: _Optional[str] = ..., actionId: _Optional[str] = ..., eventTimestamp: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., eventType: _Optional[_Union[GroupKeyActionEventType, str]] = ..., eventPayload: _Optional[str] = ...) -> None: ...
|
|
240
240
|
|
|
241
241
|
class StepActionEvent(_message.Message):
|
|
242
|
-
__slots__ = ("workerId", "jobId", "jobRunId", "stepId", "stepRunId", "actionId", "eventTimestamp", "eventType", "eventPayload", "retryCount")
|
|
242
|
+
__slots__ = ("workerId", "jobId", "jobRunId", "stepId", "stepRunId", "actionId", "eventTimestamp", "eventType", "eventPayload", "retryCount", "shouldNotRetry")
|
|
243
243
|
WORKERID_FIELD_NUMBER: _ClassVar[int]
|
|
244
244
|
JOBID_FIELD_NUMBER: _ClassVar[int]
|
|
245
245
|
JOBRUNID_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -250,6 +250,7 @@ class StepActionEvent(_message.Message):
|
|
|
250
250
|
EVENTTYPE_FIELD_NUMBER: _ClassVar[int]
|
|
251
251
|
EVENTPAYLOAD_FIELD_NUMBER: _ClassVar[int]
|
|
252
252
|
RETRYCOUNT_FIELD_NUMBER: _ClassVar[int]
|
|
253
|
+
SHOULDNOTRETRY_FIELD_NUMBER: _ClassVar[int]
|
|
253
254
|
workerId: str
|
|
254
255
|
jobId: str
|
|
255
256
|
jobRunId: str
|
|
@@ -260,7 +261,8 @@ class StepActionEvent(_message.Message):
|
|
|
260
261
|
eventType: StepActionEventType
|
|
261
262
|
eventPayload: str
|
|
262
263
|
retryCount: int
|
|
263
|
-
|
|
264
|
+
shouldNotRetry: bool
|
|
265
|
+
def __init__(self, workerId: _Optional[str] = ..., jobId: _Optional[str] = ..., jobRunId: _Optional[str] = ..., stepId: _Optional[str] = ..., stepRunId: _Optional[str] = ..., actionId: _Optional[str] = ..., eventTimestamp: _Optional[_Union[_timestamp_pb2.Timestamp, _Mapping]] = ..., eventType: _Optional[_Union[StepActionEventType, str]] = ..., eventPayload: _Optional[str] = ..., retryCount: _Optional[int] = ..., shouldNotRetry: bool = ...) -> None: ...
|
|
264
266
|
|
|
265
267
|
class ActionEventResponse(_message.Message):
|
|
266
268
|
__slots__ = ("tenantId", "workerId")
|
hatchet_sdk/runnables/task.py
CHANGED
|
@@ -272,6 +272,10 @@ class BaseWorkflow(Generic[TWorkflowInput]):
|
|
|
272
272
|
def is_durable(self) -> bool:
|
|
273
273
|
return any(task.is_durable for task in self.tasks)
|
|
274
274
|
|
|
275
|
+
@property
|
|
276
|
+
def name(self) -> str:
|
|
277
|
+
return self.config.name
|
|
278
|
+
|
|
275
279
|
def create_bulk_run_item(
|
|
276
280
|
self,
|
|
277
281
|
input: TWorkflowInput | None = None,
|
|
@@ -487,6 +491,18 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
487
491
|
:param backoff_max_seconds: The maximum number of seconds to allow retries with exponential backoff to continue. Default: `None`
|
|
488
492
|
:type backoff_max_seconds: int | None
|
|
489
493
|
|
|
494
|
+
:param concurrency: A list of concurrency expressions for the task. Defaults to an empty list (no concurrency).
|
|
495
|
+
:type concurrency: list[ConcurrencyExpression]
|
|
496
|
+
|
|
497
|
+
:param wait_for: A list of conditions that must be met before the task can run. Defaults to an empty list (no conditions).
|
|
498
|
+
:type wait_for: list[Condition | OrGroup]
|
|
499
|
+
|
|
500
|
+
:param skip_if: A list of conditions that, if met, will cause the task to be skipped. Defaults to an empty list (no conditions).
|
|
501
|
+
:type skip_if: list[Condition | OrGroup]
|
|
502
|
+
|
|
503
|
+
:param cancel_if: A list of conditions that, if met, will cause the task to be canceled. Defaults to an empty list (no conditions).
|
|
504
|
+
:type cancel_if: list[Condition | OrGroup]
|
|
505
|
+
|
|
490
506
|
:returns: A decorator which creates a `Task` object.
|
|
491
507
|
:rtype: Callable[[Callable[[Type[BaseModel], Context], R]], Task[Type[BaseModel], R]]
|
|
492
508
|
"""
|
|
@@ -572,6 +588,18 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
572
588
|
:param backoff_max_seconds: The maximum number of seconds to allow retries with exponential backoff to continue. Default: `None`
|
|
573
589
|
:type backoff_max_seconds: int | None
|
|
574
590
|
|
|
591
|
+
:param concurrency: A list of concurrency expressions for the task. Defaults to an empty list (no concurrency).
|
|
592
|
+
:type concurrency: list[ConcurrencyExpression]
|
|
593
|
+
|
|
594
|
+
:param wait_for: A list of conditions that must be met before the task can run. Defaults to an empty list (no conditions).
|
|
595
|
+
:type wait_for: list[Condition | OrGroup]
|
|
596
|
+
|
|
597
|
+
:param skip_if: A list of conditions that, if met, will cause the task to be skipped. Defaults to an empty list (no conditions).
|
|
598
|
+
:type skip_if: list[Condition | OrGroup]
|
|
599
|
+
|
|
600
|
+
:param cancel_if: A list of conditions that, if met, will cause the task to be canceled. Defaults to an empty list (no conditions).
|
|
601
|
+
:type cancel_if: list[Condition | OrGroup]
|
|
602
|
+
|
|
575
603
|
:returns: A decorator which creates a `Task` object.
|
|
576
604
|
:rtype: Callable[[Callable[[Type[BaseModel], Context], R]], Task[Type[BaseModel], R]]
|
|
577
605
|
"""
|
|
@@ -38,6 +38,7 @@ class ActionEvent:
|
|
|
38
38
|
action: Action
|
|
39
39
|
type: Any # TODO type
|
|
40
40
|
payload: str
|
|
41
|
+
should_not_retry: bool
|
|
41
42
|
|
|
42
43
|
|
|
43
44
|
STOP_LOOP_TYPE = Literal["STOP_LOOP"]
|
|
@@ -190,7 +191,10 @@ class WorkerActionListenerProcess:
|
|
|
190
191
|
|
|
191
192
|
asyncio.create_task(
|
|
192
193
|
self.dispatcher_client.send_step_action_event(
|
|
193
|
-
event.action,
|
|
194
|
+
event.action,
|
|
195
|
+
event.type,
|
|
196
|
+
event.payload,
|
|
197
|
+
event.should_not_retry,
|
|
194
198
|
)
|
|
195
199
|
)
|
|
196
200
|
case ActionType.CANCEL_STEP_RUN:
|
|
@@ -235,6 +239,7 @@ class WorkerActionListenerProcess:
|
|
|
235
239
|
action=action,
|
|
236
240
|
type=STEP_EVENT_TYPE_STARTED, # TODO ack type
|
|
237
241
|
payload="",
|
|
242
|
+
should_not_retry=False,
|
|
238
243
|
)
|
|
239
244
|
)
|
|
240
245
|
logger.info(
|
|
@@ -255,6 +260,7 @@ class WorkerActionListenerProcess:
|
|
|
255
260
|
action=action,
|
|
256
261
|
type=GROUP_KEY_EVENT_TYPE_STARTED, # TODO ack type
|
|
257
262
|
payload="",
|
|
263
|
+
should_not_retry=False,
|
|
258
264
|
)
|
|
259
265
|
)
|
|
260
266
|
logger.info(
|
|
@@ -38,7 +38,7 @@ from hatchet_sdk.runnables.contextvars import (
|
|
|
38
38
|
spawn_index_lock,
|
|
39
39
|
workflow_spawn_indices,
|
|
40
40
|
)
|
|
41
|
-
from hatchet_sdk.runnables.task import Task
|
|
41
|
+
from hatchet_sdk.runnables.task import NonRetryableException, Task
|
|
42
42
|
from hatchet_sdk.runnables.types import R, TWorkflowInput
|
|
43
43
|
from hatchet_sdk.utils.typing import WorkflowValidator
|
|
44
44
|
from hatchet_sdk.worker.action_listener_process import ActionEvent
|
|
@@ -117,7 +117,9 @@ class Runner:
|
|
|
117
117
|
log = f"unknown action type: {action.action_type}"
|
|
118
118
|
logger.error(log)
|
|
119
119
|
|
|
120
|
-
def step_run_callback(
|
|
120
|
+
def step_run_callback(
|
|
121
|
+
self, action: Action, action_task: "Task[TWorkflowInput, R]"
|
|
122
|
+
) -> Callable[[asyncio.Task[Any]], None]:
|
|
121
123
|
def inner_callback(task: asyncio.Task[Any]) -> None:
|
|
122
124
|
self.cleanup_run_id(action.step_run_id)
|
|
123
125
|
|
|
@@ -132,12 +134,15 @@ class Runner:
|
|
|
132
134
|
except Exception as e:
|
|
133
135
|
errored = True
|
|
134
136
|
|
|
137
|
+
should_not_retry = isinstance(e, NonRetryableException)
|
|
138
|
+
|
|
135
139
|
# This except is coming from the application itself, so we want to send that to the Hatchet instance
|
|
136
140
|
self.event_queue.put(
|
|
137
141
|
ActionEvent(
|
|
138
142
|
action=action,
|
|
139
143
|
type=STEP_EVENT_TYPE_FAILED,
|
|
140
144
|
payload=str(pretty_format_exception(f"{e}", e)),
|
|
145
|
+
should_not_retry=should_not_retry,
|
|
141
146
|
)
|
|
142
147
|
)
|
|
143
148
|
|
|
@@ -151,6 +156,7 @@ class Runner:
|
|
|
151
156
|
action=action,
|
|
152
157
|
type=STEP_EVENT_TYPE_COMPLETED,
|
|
153
158
|
payload=self.serialize_output(output),
|
|
159
|
+
should_not_retry=False,
|
|
154
160
|
)
|
|
155
161
|
)
|
|
156
162
|
|
|
@@ -181,6 +187,7 @@ class Runner:
|
|
|
181
187
|
action=action,
|
|
182
188
|
type=GROUP_KEY_EVENT_TYPE_FAILED,
|
|
183
189
|
payload=str(pretty_format_exception(f"{e}", e)),
|
|
190
|
+
should_not_retry=False,
|
|
184
191
|
)
|
|
185
192
|
)
|
|
186
193
|
|
|
@@ -194,6 +201,7 @@ class Runner:
|
|
|
194
201
|
action=action,
|
|
195
202
|
type=GROUP_KEY_EVENT_TYPE_COMPLETED,
|
|
196
203
|
payload=self.serialize_output(output),
|
|
204
|
+
should_not_retry=False,
|
|
197
205
|
)
|
|
198
206
|
)
|
|
199
207
|
|
|
@@ -302,7 +310,12 @@ class Runner:
|
|
|
302
310
|
|
|
303
311
|
self.contexts[action.step_run_id] = context
|
|
304
312
|
self.event_queue.put(
|
|
305
|
-
ActionEvent(
|
|
313
|
+
ActionEvent(
|
|
314
|
+
action=action,
|
|
315
|
+
type=STEP_EVENT_TYPE_STARTED,
|
|
316
|
+
payload="",
|
|
317
|
+
should_not_retry=False,
|
|
318
|
+
)
|
|
306
319
|
)
|
|
307
320
|
|
|
308
321
|
loop = asyncio.get_event_loop()
|
|
@@ -312,7 +325,7 @@ class Runner:
|
|
|
312
325
|
)
|
|
313
326
|
)
|
|
314
327
|
|
|
315
|
-
task.add_done_callback(self.step_run_callback(action))
|
|
328
|
+
task.add_done_callback(self.step_run_callback(action, action_func))
|
|
316
329
|
self.tasks[action.step_run_id] = task
|
|
317
330
|
|
|
318
331
|
try:
|
|
@@ -341,7 +354,10 @@ class Runner:
|
|
|
341
354
|
# send an event that the group key run has started
|
|
342
355
|
self.event_queue.put(
|
|
343
356
|
ActionEvent(
|
|
344
|
-
action=action,
|
|
357
|
+
action=action,
|
|
358
|
+
type=GROUP_KEY_EVENT_TYPE_STARTED,
|
|
359
|
+
payload="",
|
|
360
|
+
should_not_retry=False,
|
|
345
361
|
)
|
|
346
362
|
)
|
|
347
363
|
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: hatchet-sdk
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary:
|
|
5
|
+
Author: Alexander Belanger
|
|
6
|
+
Author-email: alexander@hatchet.run
|
|
7
|
+
Requires-Python: >=3.10,<4.0
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Provides-Extra: otel
|
|
13
|
+
Requires-Dist: aiohttp (>=3.10.5,<4.0.0)
|
|
14
|
+
Requires-Dist: aiohttp-retry (>=2.8.3,<3.0.0)
|
|
15
|
+
Requires-Dist: aiostream (>=0.5.2,<0.6.0)
|
|
16
|
+
Requires-Dist: cel-python (>=0.2.0,<0.3.0)
|
|
17
|
+
Requires-Dist: grpcio (>=1.64.1,!=1.68.*) ; python_version < "3.13"
|
|
18
|
+
Requires-Dist: grpcio (>=1.69.0) ; python_version >= "3.13"
|
|
19
|
+
Requires-Dist: grpcio-tools (>=1.64.1,!=1.68.*) ; python_version < "3.13"
|
|
20
|
+
Requires-Dist: grpcio-tools (>=1.69.0) ; python_version >= "3.13"
|
|
21
|
+
Requires-Dist: nest-asyncio (>=1.6.0,<2.0.0)
|
|
22
|
+
Requires-Dist: opentelemetry-api (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
23
|
+
Requires-Dist: opentelemetry-distro (>=0.49b0) ; extra == "otel"
|
|
24
|
+
Requires-Dist: opentelemetry-exporter-otlp (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
25
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
26
|
+
Requires-Dist: opentelemetry-instrumentation (>=0.49b0) ; extra == "otel"
|
|
27
|
+
Requires-Dist: opentelemetry-sdk (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
28
|
+
Requires-Dist: prometheus-client (>=0.21.1,<0.22.0)
|
|
29
|
+
Requires-Dist: protobuf (>=5.29.1,<6.0.0)
|
|
30
|
+
Requires-Dist: pydantic (>=2.6.3,<3.0.0)
|
|
31
|
+
Requires-Dist: pydantic-settings (>=2.7.1,<3.0.0)
|
|
32
|
+
Requires-Dist: pytest-timeout (>=2.3.1,<3.0.0)
|
|
33
|
+
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
|
|
34
|
+
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
35
|
+
Requires-Dist: tenacity (>=8.4.1)
|
|
36
|
+
Requires-Dist: urllib3 (>=1.26.20)
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# Hatchet Python SDK
|
|
40
|
+
|
|
41
|
+
<div align="center">
|
|
42
|
+
|
|
43
|
+
[](https://badge.fury.io/py/hatchet-sdk)
|
|
44
|
+
[](https://docs.hatchet.run)
|
|
45
|
+
[](https://opensource.org/licenses/MIT)
|
|
46
|
+
|
|
47
|
+
</div>
|
|
48
|
+
|
|
49
|
+
This is the official Python SDK for [Hatchet](https://hatchet.run), a distributed, fault-tolerant task queue. The SDK allows you to easily integrate Hatchet's task scheduling and workflow orchestration capabilities into your Python applications.
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
Install the SDK using pip:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pip install hatchet-sdk
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Or using poetry:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
poetry add hatchet-sdk
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Quick Start
|
|
66
|
+
|
|
67
|
+
Here's a simple example of how to use the Hatchet Python SDK:
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from hatchet_sdk import Context, EmptyModel, Hatchet
|
|
71
|
+
|
|
72
|
+
hatchet = Hatchet(debug=True)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
@hatchet.task(name="SimpleWorkflow")
|
|
76
|
+
def step1(input: EmptyModel, ctx: Context) -> None:
|
|
77
|
+
print("executed step1")
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def main() -> None:
|
|
81
|
+
worker = hatchet.worker("test-worker", slots=1, workflows=[step1])
|
|
82
|
+
worker.start()
|
|
83
|
+
|
|
84
|
+
if __name__ == "__main__":
|
|
85
|
+
main()
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Features
|
|
89
|
+
|
|
90
|
+
- 🔄 **Workflow Orchestration**: Define complex workflows with dependencies and parallel execution
|
|
91
|
+
- 🔁 **Automatic Retries**: Configure retry policies for handling transient failures
|
|
92
|
+
- 📊 **Observability**: Track workflow progress and monitor execution metrics
|
|
93
|
+
- ⏰ **Scheduling**: Schedule workflows to run at specific times or on a recurring basis
|
|
94
|
+
- 🔄 **Event-Driven**: Trigger workflows based on events in your system
|
|
95
|
+
|
|
96
|
+
## Documentation
|
|
97
|
+
|
|
98
|
+
For detailed documentation, examples, and best practices, visit:
|
|
99
|
+
- [Hatchet Documentation](https://docs.hatchet.run)
|
|
100
|
+
- [Examples](https://github.com/hatchet-dev/hatchet/tree/main/sdks/python/examples)
|
|
101
|
+
|
|
102
|
+
## Contributing
|
|
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.
|
|
105
|
+
|
|
106
|
+
## License
|
|
107
|
+
|
|
108
|
+
This SDK is released under the MIT License. See [LICENSE](https://github.com/hatchet-dev/hatchet/blob/main/LICENSE) for details.
|
|
109
|
+
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
hatchet_sdk/__init__.py,sha256=
|
|
1
|
+
hatchet_sdk/__init__.py,sha256=xpvq4zASQag5sYGlkaU8cg9wmACaAaeXXCdTtU17-UM,10054
|
|
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
|
|
5
|
-
hatchet_sdk/clients/dispatcher/dispatcher.py,sha256=
|
|
5
|
+
hatchet_sdk/clients/dispatcher/dispatcher.py,sha256=7tHEoCvL2MKklxbT43oRsQdx9JuLIVCJvFuIUqTHjis,7794
|
|
6
6
|
hatchet_sdk/clients/durable_event_listener.py,sha256=J5Tg8niikms-tEfB8wps_wgsPF7Fx-pYhYExd0lJo7Y,11791
|
|
7
7
|
hatchet_sdk/clients/event_ts.py,sha256=tbWLz3NXrwMyIoEm0Q2TfitF5cNEpo3k42jWKciOK8A,1082
|
|
8
8
|
hatchet_sdk/clients/events.py,sha256=sKqzGwkrW_AKWW0Q_rxfwo9jXV5EUpLx7fTQvCNHaVo,5443
|
|
@@ -222,8 +222,8 @@ hatchet_sdk/connection.py,sha256=B5gT5NL9BBB5-l9U_cN6pMlraQk880rEYMnqaK_dgL0,259
|
|
|
222
222
|
hatchet_sdk/context/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
223
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
|
-
hatchet_sdk/contracts/dispatcher_pb2.py,sha256=
|
|
226
|
-
hatchet_sdk/contracts/dispatcher_pb2.pyi,sha256=
|
|
225
|
+
hatchet_sdk/contracts/dispatcher_pb2.py,sha256=SN4CIKeQwYkrbfRGhdhZo2uBn4nGzjUWIC1vvXdDeOQ,14503
|
|
226
|
+
hatchet_sdk/contracts/dispatcher_pb2.pyi,sha256=ZSGio5eYxkw-QuQx2C5ASTNcKzeMQn5JTnWaRiThafM,18455
|
|
227
227
|
hatchet_sdk/contracts/dispatcher_pb2_grpc.py,sha256=zJ4c0Z0-iJngrVEw51vmwQgP1c8aZhAkjcUJUpH6JQ0,24756
|
|
228
228
|
hatchet_sdk/contracts/events_pb2.py,sha256=sda_dHK2N7g8kmaZSNqfvUSvHaa-ro9IBw0Diu1PCE4,4074
|
|
229
229
|
hatchet_sdk/contracts/events_pb2.pyi,sha256=eoHvNI5gY98ZfFleiynbtIz3SiW_X49ggMBOlOgAP74,4014
|
|
@@ -257,9 +257,9 @@ hatchet_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
257
257
|
hatchet_sdk/rate_limit.py,sha256=TwbCuggiZaWpYuo4mjVLlE-z1OfQ2mRBiVvCSaG3lv4,3919
|
|
258
258
|
hatchet_sdk/runnables/contextvars.py,sha256=6MDocAMmlyiRW37oQ1jyx10tAlJs-xgDjR3xPoPz05g,426
|
|
259
259
|
hatchet_sdk/runnables/standalone.py,sha256=2jgUgILYIyHSYy3S6M6n2QAQ7UyvxfSQk0DDRar5RpI,5996
|
|
260
|
-
hatchet_sdk/runnables/task.py,sha256=
|
|
260
|
+
hatchet_sdk/runnables/task.py,sha256=O0DEDvYZT6gC5eNF6ObsE2MhCBUNKWkr2JXPZx2aUZM,4883
|
|
261
261
|
hatchet_sdk/runnables/types.py,sha256=JWo4hkYb2XYoktIFVvnqud6Ywmo7AHMK_upYpdNmij0,4235
|
|
262
|
-
hatchet_sdk/runnables/workflow.py,sha256=
|
|
262
|
+
hatchet_sdk/runnables/workflow.py,sha256=eYIbpAAwlArhEZrd3NHDT4Yy8_GejgCzRG6TZomPugI,30681
|
|
263
263
|
hatchet_sdk/token.py,sha256=KjIiInwG5Kqd_FO4BSW1x_5Uc7PFbnzIVJqr50-ZldE,779
|
|
264
264
|
hatchet_sdk/utils/aio.py,sha256=A9pKNn8eAKUeinY2uBkJn4jdrYI5vAw_A-gzz04xdvQ,1122
|
|
265
265
|
hatchet_sdk/utils/backoff.py,sha256=6B5Rb5nLKw_TqqgpJMYjIBV1PTTtbOMRZCveisVhg_I,353
|
|
@@ -499,13 +499,13 @@ hatchet_sdk/v0/workflow.py,sha256=d4o425efk7J3JgLIge34MW_A3pzwnwSRtwEOgIqM2pc,93
|
|
|
499
499
|
hatchet_sdk/v0/workflow_run.py,sha256=jsEZprXshrSV7i_TtL5uoCL03D18zQ3NeJCq7mp97Dg,1752
|
|
500
500
|
hatchet_sdk/waits.py,sha256=mBJVOjvTJfhXCngyIfNccYFtg7eiFM2B2n7lcg90S3A,3327
|
|
501
501
|
hatchet_sdk/worker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
502
|
-
hatchet_sdk/worker/action_listener_process.py,sha256=
|
|
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=
|
|
504
|
+
hatchet_sdk/worker/runner/runner.py,sha256=ruDVu1NouU52xqe3Fgw9vZrvX7ljm-LDZWq-RstZhWI,17008
|
|
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.
|
|
509
|
-
hatchet_sdk-1.
|
|
510
|
-
hatchet_sdk-1.
|
|
511
|
-
hatchet_sdk-1.
|
|
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,,
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: hatchet-sdk
|
|
3
|
-
Version: 1.1.0
|
|
4
|
-
Summary:
|
|
5
|
-
Author: Alexander Belanger
|
|
6
|
-
Author-email: alexander@hatchet.run
|
|
7
|
-
Requires-Python: >=3.10,<4.0
|
|
8
|
-
Classifier: Programming Language :: Python :: 3
|
|
9
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
-
Provides-Extra: otel
|
|
13
|
-
Requires-Dist: aiohttp (>=3.10.5,<4.0.0)
|
|
14
|
-
Requires-Dist: aiohttp-retry (>=2.8.3,<3.0.0)
|
|
15
|
-
Requires-Dist: aiostream (>=0.5.2,<0.6.0)
|
|
16
|
-
Requires-Dist: cel-python (>=0.2.0,<0.3.0)
|
|
17
|
-
Requires-Dist: grpcio (>=1.64.1,!=1.68.*) ; python_version < "3.13"
|
|
18
|
-
Requires-Dist: grpcio (>=1.69.0) ; python_version >= "3.13"
|
|
19
|
-
Requires-Dist: grpcio-tools (>=1.64.1,!=1.68.*) ; python_version < "3.13"
|
|
20
|
-
Requires-Dist: grpcio-tools (>=1.69.0) ; python_version >= "3.13"
|
|
21
|
-
Requires-Dist: nest-asyncio (>=1.6.0,<2.0.0)
|
|
22
|
-
Requires-Dist: opentelemetry-api (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
23
|
-
Requires-Dist: opentelemetry-distro (>=0.49b0) ; extra == "otel"
|
|
24
|
-
Requires-Dist: opentelemetry-exporter-otlp (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
25
|
-
Requires-Dist: opentelemetry-exporter-otlp-proto-http (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
26
|
-
Requires-Dist: opentelemetry-instrumentation (>=0.49b0) ; extra == "otel"
|
|
27
|
-
Requires-Dist: opentelemetry-sdk (>=1.28.0,<2.0.0) ; extra == "otel"
|
|
28
|
-
Requires-Dist: prometheus-client (>=0.21.1,<0.22.0)
|
|
29
|
-
Requires-Dist: protobuf (>=5.29.1,<6.0.0)
|
|
30
|
-
Requires-Dist: pydantic (>=2.6.3,<3.0.0)
|
|
31
|
-
Requires-Dist: pydantic-settings (>=2.7.1,<3.0.0)
|
|
32
|
-
Requires-Dist: pytest-timeout (>=2.3.1,<3.0.0)
|
|
33
|
-
Requires-Dist: python-dateutil (>=2.9.0.post0,<3.0.0)
|
|
34
|
-
Requires-Dist: pyyaml (>=6.0.1,<7.0.0)
|
|
35
|
-
Requires-Dist: tenacity (>=8.4.1)
|
|
36
|
-
Requires-Dist: urllib3 (>=1.26.20)
|
|
37
|
-
Description-Content-Type: text/markdown
|
|
38
|
-
|
|
39
|
-
# Hatchet Python SDK
|
|
40
|
-
|
|
41
|
-
This is the [Hatchet](https://hatchet.run) Python SDK. For usage, see the [docs](https://docs.hatchet.run).
|
|
42
|
-
|
|
File without changes
|
|
File without changes
|