hatchet-sdk 1.0.0__py3-none-any.whl → 1.0.0a1__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 +27 -16
- hatchet_sdk/client.py +13 -63
- hatchet_sdk/clients/admin.py +203 -124
- hatchet_sdk/clients/dispatcher/action_listener.py +42 -42
- hatchet_sdk/clients/dispatcher/dispatcher.py +18 -16
- hatchet_sdk/clients/durable_event_listener.py +327 -0
- hatchet_sdk/clients/rest/__init__.py +12 -1
- hatchet_sdk/clients/rest/api/log_api.py +258 -0
- hatchet_sdk/clients/rest/api/task_api.py +32 -6
- hatchet_sdk/clients/rest/api/workflow_runs_api.py +626 -0
- hatchet_sdk/clients/rest/models/__init__.py +12 -1
- hatchet_sdk/clients/rest/models/v1_log_line.py +94 -0
- hatchet_sdk/clients/rest/models/v1_log_line_level.py +39 -0
- hatchet_sdk/clients/rest/models/v1_log_line_list.py +110 -0
- hatchet_sdk/clients/rest/models/v1_task_summary.py +80 -64
- hatchet_sdk/clients/rest/models/v1_trigger_workflow_run_request.py +95 -0
- hatchet_sdk/clients/rest/models/v1_workflow_run_display_name.py +98 -0
- hatchet_sdk/clients/rest/models/v1_workflow_run_display_name_list.py +114 -0
- hatchet_sdk/clients/rest/models/workflow_run_shape_item_for_workflow_run_details.py +9 -4
- hatchet_sdk/clients/rest_client.py +21 -0
- hatchet_sdk/clients/run_event_listener.py +0 -1
- hatchet_sdk/context/context.py +85 -147
- hatchet_sdk/contracts/dispatcher_pb2_grpc.py +1 -1
- hatchet_sdk/contracts/events_pb2.py +2 -2
- hatchet_sdk/contracts/events_pb2_grpc.py +1 -1
- hatchet_sdk/contracts/v1/dispatcher_pb2.py +36 -0
- hatchet_sdk/contracts/v1/dispatcher_pb2.pyi +38 -0
- hatchet_sdk/contracts/v1/dispatcher_pb2_grpc.py +145 -0
- hatchet_sdk/contracts/v1/shared/condition_pb2.py +39 -0
- hatchet_sdk/contracts/v1/shared/condition_pb2.pyi +72 -0
- hatchet_sdk/contracts/v1/shared/condition_pb2_grpc.py +29 -0
- hatchet_sdk/contracts/v1/workflows_pb2.py +67 -0
- hatchet_sdk/contracts/v1/workflows_pb2.pyi +228 -0
- hatchet_sdk/contracts/v1/workflows_pb2_grpc.py +234 -0
- hatchet_sdk/contracts/workflows_pb2_grpc.py +1 -1
- hatchet_sdk/features/cron.py +3 -3
- hatchet_sdk/features/scheduled.py +2 -2
- hatchet_sdk/hatchet.py +427 -151
- hatchet_sdk/opentelemetry/instrumentor.py +8 -13
- hatchet_sdk/rate_limit.py +33 -39
- hatchet_sdk/runnables/contextvars.py +12 -0
- hatchet_sdk/runnables/standalone.py +194 -0
- hatchet_sdk/runnables/task.py +144 -0
- hatchet_sdk/runnables/types.py +138 -0
- hatchet_sdk/runnables/workflow.py +764 -0
- hatchet_sdk/utils/aio_utils.py +0 -79
- hatchet_sdk/utils/proto_enums.py +0 -7
- hatchet_sdk/utils/timedelta_to_expression.py +23 -0
- hatchet_sdk/utils/typing.py +2 -2
- hatchet_sdk/v0/clients/rest_client.py +9 -0
- hatchet_sdk/v0/worker/action_listener_process.py +18 -2
- hatchet_sdk/waits.py +120 -0
- hatchet_sdk/worker/action_listener_process.py +64 -30
- hatchet_sdk/worker/runner/run_loop_manager.py +35 -25
- hatchet_sdk/worker/runner/runner.py +72 -49
- hatchet_sdk/worker/runner/utils/capture_logs.py +3 -11
- hatchet_sdk/worker/worker.py +155 -118
- hatchet_sdk/workflow_run.py +4 -5
- {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.0a1.dist-info}/METADATA +1 -2
- {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.0a1.dist-info}/RECORD +62 -42
- {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.0a1.dist-info}/entry_points.txt +2 -0
- hatchet_sdk/semver.py +0 -30
- hatchet_sdk/worker/runner/utils/error_with_traceback.py +0 -6
- hatchet_sdk/workflow.py +0 -527
- {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.0a1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
2
|
+
"""Client and server classes corresponding to protobuf-defined services."""
|
|
3
|
+
import grpc
|
|
4
|
+
import warnings
|
|
5
|
+
|
|
6
|
+
from hatchet_sdk.contracts.v1 import workflows_pb2 as v1_dot_workflows__pb2
|
|
7
|
+
|
|
8
|
+
GRPC_GENERATED_VERSION = '1.64.1'
|
|
9
|
+
GRPC_VERSION = grpc.__version__
|
|
10
|
+
EXPECTED_ERROR_RELEASE = '1.65.0'
|
|
11
|
+
SCHEDULED_RELEASE_DATE = 'June 25, 2024'
|
|
12
|
+
_version_not_supported = False
|
|
13
|
+
|
|
14
|
+
try:
|
|
15
|
+
from grpc._utilities import first_version_is_lower
|
|
16
|
+
_version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
|
|
17
|
+
except ImportError:
|
|
18
|
+
_version_not_supported = True
|
|
19
|
+
|
|
20
|
+
if _version_not_supported:
|
|
21
|
+
warnings.warn(
|
|
22
|
+
f'The grpc package installed is at version {GRPC_VERSION},'
|
|
23
|
+
+ f' but the generated code in v1/workflows_pb2_grpc.py depends on'
|
|
24
|
+
+ f' grpcio>={GRPC_GENERATED_VERSION}.'
|
|
25
|
+
+ f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
|
|
26
|
+
+ f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
|
|
27
|
+
+ f' This warning will become an error in {EXPECTED_ERROR_RELEASE},'
|
|
28
|
+
+ f' scheduled for release on {SCHEDULED_RELEASE_DATE}.',
|
|
29
|
+
RuntimeWarning
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class AdminServiceStub(object):
|
|
34
|
+
"""AdminService represents a set of RPCs for admin management of tasks, workflows, etc.
|
|
35
|
+
"""
|
|
36
|
+
|
|
37
|
+
def __init__(self, channel):
|
|
38
|
+
"""Constructor.
|
|
39
|
+
|
|
40
|
+
Args:
|
|
41
|
+
channel: A grpc.Channel.
|
|
42
|
+
"""
|
|
43
|
+
self.PutWorkflow = channel.unary_unary(
|
|
44
|
+
'/v1.AdminService/PutWorkflow',
|
|
45
|
+
request_serializer=v1_dot_workflows__pb2.CreateWorkflowVersionRequest.SerializeToString,
|
|
46
|
+
response_deserializer=v1_dot_workflows__pb2.CreateWorkflowVersionResponse.FromString,
|
|
47
|
+
_registered_method=True)
|
|
48
|
+
self.CancelTasks = channel.unary_unary(
|
|
49
|
+
'/v1.AdminService/CancelTasks',
|
|
50
|
+
request_serializer=v1_dot_workflows__pb2.CancelTasksRequest.SerializeToString,
|
|
51
|
+
response_deserializer=v1_dot_workflows__pb2.CancelTasksResponse.FromString,
|
|
52
|
+
_registered_method=True)
|
|
53
|
+
self.ReplayTasks = channel.unary_unary(
|
|
54
|
+
'/v1.AdminService/ReplayTasks',
|
|
55
|
+
request_serializer=v1_dot_workflows__pb2.ReplayTasksRequest.SerializeToString,
|
|
56
|
+
response_deserializer=v1_dot_workflows__pb2.ReplayTasksResponse.FromString,
|
|
57
|
+
_registered_method=True)
|
|
58
|
+
self.TriggerWorkflowRun = channel.unary_unary(
|
|
59
|
+
'/v1.AdminService/TriggerWorkflowRun',
|
|
60
|
+
request_serializer=v1_dot_workflows__pb2.TriggerWorkflowRunRequest.SerializeToString,
|
|
61
|
+
response_deserializer=v1_dot_workflows__pb2.TriggerWorkflowRunResponse.FromString,
|
|
62
|
+
_registered_method=True)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class AdminServiceServicer(object):
|
|
66
|
+
"""AdminService represents a set of RPCs for admin management of tasks, workflows, etc.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
def PutWorkflow(self, request, context):
|
|
70
|
+
"""Missing associated documentation comment in .proto file."""
|
|
71
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
72
|
+
context.set_details('Method not implemented!')
|
|
73
|
+
raise NotImplementedError('Method not implemented!')
|
|
74
|
+
|
|
75
|
+
def CancelTasks(self, request, context):
|
|
76
|
+
"""Missing associated documentation comment in .proto file."""
|
|
77
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
78
|
+
context.set_details('Method not implemented!')
|
|
79
|
+
raise NotImplementedError('Method not implemented!')
|
|
80
|
+
|
|
81
|
+
def ReplayTasks(self, request, context):
|
|
82
|
+
"""Missing associated documentation comment in .proto file."""
|
|
83
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
84
|
+
context.set_details('Method not implemented!')
|
|
85
|
+
raise NotImplementedError('Method not implemented!')
|
|
86
|
+
|
|
87
|
+
def TriggerWorkflowRun(self, request, context):
|
|
88
|
+
"""Missing associated documentation comment in .proto file."""
|
|
89
|
+
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
90
|
+
context.set_details('Method not implemented!')
|
|
91
|
+
raise NotImplementedError('Method not implemented!')
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def add_AdminServiceServicer_to_server(servicer, server):
|
|
95
|
+
rpc_method_handlers = {
|
|
96
|
+
'PutWorkflow': grpc.unary_unary_rpc_method_handler(
|
|
97
|
+
servicer.PutWorkflow,
|
|
98
|
+
request_deserializer=v1_dot_workflows__pb2.CreateWorkflowVersionRequest.FromString,
|
|
99
|
+
response_serializer=v1_dot_workflows__pb2.CreateWorkflowVersionResponse.SerializeToString,
|
|
100
|
+
),
|
|
101
|
+
'CancelTasks': grpc.unary_unary_rpc_method_handler(
|
|
102
|
+
servicer.CancelTasks,
|
|
103
|
+
request_deserializer=v1_dot_workflows__pb2.CancelTasksRequest.FromString,
|
|
104
|
+
response_serializer=v1_dot_workflows__pb2.CancelTasksResponse.SerializeToString,
|
|
105
|
+
),
|
|
106
|
+
'ReplayTasks': grpc.unary_unary_rpc_method_handler(
|
|
107
|
+
servicer.ReplayTasks,
|
|
108
|
+
request_deserializer=v1_dot_workflows__pb2.ReplayTasksRequest.FromString,
|
|
109
|
+
response_serializer=v1_dot_workflows__pb2.ReplayTasksResponse.SerializeToString,
|
|
110
|
+
),
|
|
111
|
+
'TriggerWorkflowRun': grpc.unary_unary_rpc_method_handler(
|
|
112
|
+
servicer.TriggerWorkflowRun,
|
|
113
|
+
request_deserializer=v1_dot_workflows__pb2.TriggerWorkflowRunRequest.FromString,
|
|
114
|
+
response_serializer=v1_dot_workflows__pb2.TriggerWorkflowRunResponse.SerializeToString,
|
|
115
|
+
),
|
|
116
|
+
}
|
|
117
|
+
generic_handler = grpc.method_handlers_generic_handler(
|
|
118
|
+
'v1.AdminService', rpc_method_handlers)
|
|
119
|
+
server.add_generic_rpc_handlers((generic_handler,))
|
|
120
|
+
server.add_registered_method_handlers('v1.AdminService', rpc_method_handlers)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# This class is part of an EXPERIMENTAL API.
|
|
124
|
+
class AdminService(object):
|
|
125
|
+
"""AdminService represents a set of RPCs for admin management of tasks, workflows, etc.
|
|
126
|
+
"""
|
|
127
|
+
|
|
128
|
+
@staticmethod
|
|
129
|
+
def PutWorkflow(request,
|
|
130
|
+
target,
|
|
131
|
+
options=(),
|
|
132
|
+
channel_credentials=None,
|
|
133
|
+
call_credentials=None,
|
|
134
|
+
insecure=False,
|
|
135
|
+
compression=None,
|
|
136
|
+
wait_for_ready=None,
|
|
137
|
+
timeout=None,
|
|
138
|
+
metadata=None):
|
|
139
|
+
return grpc.experimental.unary_unary(
|
|
140
|
+
request,
|
|
141
|
+
target,
|
|
142
|
+
'/v1.AdminService/PutWorkflow',
|
|
143
|
+
v1_dot_workflows__pb2.CreateWorkflowVersionRequest.SerializeToString,
|
|
144
|
+
v1_dot_workflows__pb2.CreateWorkflowVersionResponse.FromString,
|
|
145
|
+
options,
|
|
146
|
+
channel_credentials,
|
|
147
|
+
insecure,
|
|
148
|
+
call_credentials,
|
|
149
|
+
compression,
|
|
150
|
+
wait_for_ready,
|
|
151
|
+
timeout,
|
|
152
|
+
metadata,
|
|
153
|
+
_registered_method=True)
|
|
154
|
+
|
|
155
|
+
@staticmethod
|
|
156
|
+
def CancelTasks(request,
|
|
157
|
+
target,
|
|
158
|
+
options=(),
|
|
159
|
+
channel_credentials=None,
|
|
160
|
+
call_credentials=None,
|
|
161
|
+
insecure=False,
|
|
162
|
+
compression=None,
|
|
163
|
+
wait_for_ready=None,
|
|
164
|
+
timeout=None,
|
|
165
|
+
metadata=None):
|
|
166
|
+
return grpc.experimental.unary_unary(
|
|
167
|
+
request,
|
|
168
|
+
target,
|
|
169
|
+
'/v1.AdminService/CancelTasks',
|
|
170
|
+
v1_dot_workflows__pb2.CancelTasksRequest.SerializeToString,
|
|
171
|
+
v1_dot_workflows__pb2.CancelTasksResponse.FromString,
|
|
172
|
+
options,
|
|
173
|
+
channel_credentials,
|
|
174
|
+
insecure,
|
|
175
|
+
call_credentials,
|
|
176
|
+
compression,
|
|
177
|
+
wait_for_ready,
|
|
178
|
+
timeout,
|
|
179
|
+
metadata,
|
|
180
|
+
_registered_method=True)
|
|
181
|
+
|
|
182
|
+
@staticmethod
|
|
183
|
+
def ReplayTasks(request,
|
|
184
|
+
target,
|
|
185
|
+
options=(),
|
|
186
|
+
channel_credentials=None,
|
|
187
|
+
call_credentials=None,
|
|
188
|
+
insecure=False,
|
|
189
|
+
compression=None,
|
|
190
|
+
wait_for_ready=None,
|
|
191
|
+
timeout=None,
|
|
192
|
+
metadata=None):
|
|
193
|
+
return grpc.experimental.unary_unary(
|
|
194
|
+
request,
|
|
195
|
+
target,
|
|
196
|
+
'/v1.AdminService/ReplayTasks',
|
|
197
|
+
v1_dot_workflows__pb2.ReplayTasksRequest.SerializeToString,
|
|
198
|
+
v1_dot_workflows__pb2.ReplayTasksResponse.FromString,
|
|
199
|
+
options,
|
|
200
|
+
channel_credentials,
|
|
201
|
+
insecure,
|
|
202
|
+
call_credentials,
|
|
203
|
+
compression,
|
|
204
|
+
wait_for_ready,
|
|
205
|
+
timeout,
|
|
206
|
+
metadata,
|
|
207
|
+
_registered_method=True)
|
|
208
|
+
|
|
209
|
+
@staticmethod
|
|
210
|
+
def TriggerWorkflowRun(request,
|
|
211
|
+
target,
|
|
212
|
+
options=(),
|
|
213
|
+
channel_credentials=None,
|
|
214
|
+
call_credentials=None,
|
|
215
|
+
insecure=False,
|
|
216
|
+
compression=None,
|
|
217
|
+
wait_for_ready=None,
|
|
218
|
+
timeout=None,
|
|
219
|
+
metadata=None):
|
|
220
|
+
return grpc.experimental.unary_unary(
|
|
221
|
+
request,
|
|
222
|
+
target,
|
|
223
|
+
'/v1.AdminService/TriggerWorkflowRun',
|
|
224
|
+
v1_dot_workflows__pb2.TriggerWorkflowRunRequest.SerializeToString,
|
|
225
|
+
v1_dot_workflows__pb2.TriggerWorkflowRunResponse.FromString,
|
|
226
|
+
options,
|
|
227
|
+
channel_credentials,
|
|
228
|
+
insecure,
|
|
229
|
+
call_credentials,
|
|
230
|
+
compression,
|
|
231
|
+
wait_for_ready,
|
|
232
|
+
timeout,
|
|
233
|
+
metadata,
|
|
234
|
+
_registered_method=True)
|
hatchet_sdk/features/cron.py
CHANGED
|
@@ -14,7 +14,7 @@ from hatchet_sdk.clients.rest.models.workflow_run_order_by_direction import (
|
|
|
14
14
|
from hatchet_sdk.utils.typing import JSONSerializableMapping
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
class
|
|
17
|
+
class CreateCronTriggerConfig(BaseModel):
|
|
18
18
|
"""
|
|
19
19
|
Schema for creating a workflow run triggered by a cron.
|
|
20
20
|
|
|
@@ -103,7 +103,7 @@ class CronClient:
|
|
|
103
103
|
Returns:
|
|
104
104
|
CronWorkflows: The created cron workflow instance.
|
|
105
105
|
"""
|
|
106
|
-
validated_input =
|
|
106
|
+
validated_input = CreateCronTriggerConfig(
|
|
107
107
|
expression=expression, input=input, additional_metadata=additional_metadata
|
|
108
108
|
)
|
|
109
109
|
|
|
@@ -197,7 +197,7 @@ class CronClient:
|
|
|
197
197
|
Returns:
|
|
198
198
|
CronWorkflows: The created cron workflow instance.
|
|
199
199
|
"""
|
|
200
|
-
validated_input =
|
|
200
|
+
validated_input = CreateCronTriggerConfig(
|
|
201
201
|
expression=expression, input=input, additional_metadata=additional_metadata
|
|
202
202
|
)
|
|
203
203
|
|
|
@@ -20,7 +20,7 @@ from hatchet_sdk.clients.rest.models.workflow_run_order_by_direction import (
|
|
|
20
20
|
from hatchet_sdk.utils.typing import JSONSerializableMapping
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
class
|
|
23
|
+
class CreateScheduledTriggerConfig(BaseModel):
|
|
24
24
|
"""
|
|
25
25
|
Schema for creating a scheduled workflow run.
|
|
26
26
|
|
|
@@ -75,7 +75,7 @@ class ScheduledClient:
|
|
|
75
75
|
ScheduledWorkflows: The created scheduled workflow instance.
|
|
76
76
|
"""
|
|
77
77
|
|
|
78
|
-
validated_input =
|
|
78
|
+
validated_input = CreateScheduledTriggerConfig(
|
|
79
79
|
trigger_at=trigger_at, input=input, additional_metadata=additional_metadata
|
|
80
80
|
)
|
|
81
81
|
|