hatchet-sdk 1.0.0a1__py3-none-any.whl → 1.0.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/__init__.py +5 -0
- hatchet_sdk/client.py +17 -5
- hatchet_sdk/clients/admin.py +0 -18
- hatchet_sdk/clients/rest/models/workflow_runs_metrics.py +5 -1
- hatchet_sdk/clients/v1/api_client.py +81 -0
- hatchet_sdk/context/context.py +1 -12
- hatchet_sdk/features/cron.py +89 -119
- hatchet_sdk/features/logs.py +16 -0
- hatchet_sdk/features/metrics.py +75 -0
- hatchet_sdk/features/rate_limits.py +45 -0
- hatchet_sdk/features/runs.py +221 -0
- hatchet_sdk/features/scheduled.py +114 -131
- hatchet_sdk/features/workers.py +41 -0
- hatchet_sdk/features/workflows.py +55 -0
- hatchet_sdk/hatchet.py +36 -14
- hatchet_sdk/runnables/standalone.py +9 -11
- hatchet_sdk/runnables/types.py +1 -1
- hatchet_sdk/runnables/workflow.py +26 -19
- hatchet_sdk/worker/action_listener_process.py +3 -3
- hatchet_sdk/worker/runner/run_loop_manager.py +0 -1
- hatchet_sdk/worker/runner/runner.py +0 -6
- {hatchet_sdk-1.0.0a1.dist-info → hatchet_sdk-1.0.1.dist-info}/METADATA +1 -1
- {hatchet_sdk-1.0.0a1.dist-info → hatchet_sdk-1.0.1.dist-info}/RECORD +25 -19
- hatchet_sdk/clients/rest_client.py +0 -657
- {hatchet_sdk-1.0.0a1.dist-info → hatchet_sdk-1.0.1.dist-info}/WHEEL +0 -0
- {hatchet_sdk-1.0.0a1.dist-info → hatchet_sdk-1.0.1.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
from hatchet_sdk.clients.rest.api.workflow_api import WorkflowApi
|
|
2
|
+
from hatchet_sdk.clients.rest.api.workflow_run_api import WorkflowRunApi
|
|
3
|
+
from hatchet_sdk.clients.rest.api_client import ApiClient
|
|
4
|
+
from hatchet_sdk.clients.rest.models.workflow import Workflow
|
|
5
|
+
from hatchet_sdk.clients.rest.models.workflow_list import WorkflowList
|
|
6
|
+
from hatchet_sdk.clients.rest.models.workflow_version import WorkflowVersion
|
|
7
|
+
from hatchet_sdk.clients.v1.api_client import BaseRestClient
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class WorkflowsClient(BaseRestClient):
|
|
11
|
+
def _wra(self, client: ApiClient) -> WorkflowRunApi:
|
|
12
|
+
return WorkflowRunApi(client)
|
|
13
|
+
|
|
14
|
+
def _wa(self, client: ApiClient) -> WorkflowApi:
|
|
15
|
+
return WorkflowApi(client)
|
|
16
|
+
|
|
17
|
+
async def aio_get(self, workflow_id: str) -> Workflow:
|
|
18
|
+
async with self.client() as client:
|
|
19
|
+
return await self._wa(client).workflow_get(workflow_id)
|
|
20
|
+
|
|
21
|
+
def get(self, workflow_id: str) -> Workflow:
|
|
22
|
+
return self._run_async_from_sync(self.aio_get, workflow_id)
|
|
23
|
+
|
|
24
|
+
async def aio_list(
|
|
25
|
+
self,
|
|
26
|
+
workflow_name: str | None = None,
|
|
27
|
+
limit: int | None = None,
|
|
28
|
+
offset: int | None = None,
|
|
29
|
+
) -> WorkflowList:
|
|
30
|
+
async with self.client() as client:
|
|
31
|
+
return await self._wa(client).workflow_list(
|
|
32
|
+
tenant=self.client_config.tenant_id,
|
|
33
|
+
limit=limit,
|
|
34
|
+
offset=offset,
|
|
35
|
+
name=workflow_name,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
def list(
|
|
39
|
+
self,
|
|
40
|
+
workflow_name: str | None = None,
|
|
41
|
+
limit: int | None = None,
|
|
42
|
+
offset: int | None = None,
|
|
43
|
+
) -> WorkflowList:
|
|
44
|
+
return self._run_async_from_sync(self.aio_list, workflow_name, limit, offset)
|
|
45
|
+
|
|
46
|
+
async def aio_get_version(
|
|
47
|
+
self, workflow_id: str, version: str | None = None
|
|
48
|
+
) -> WorkflowVersion:
|
|
49
|
+
async with self.client() as client:
|
|
50
|
+
return await self._wa(client).workflow_version_get(workflow_id, version)
|
|
51
|
+
|
|
52
|
+
def get_version(
|
|
53
|
+
self, workflow_id: str, version: str | None = None
|
|
54
|
+
) -> WorkflowVersion:
|
|
55
|
+
return self._run_async_from_sync(self.aio_get_version, workflow_id, version)
|
hatchet_sdk/hatchet.py
CHANGED
|
@@ -4,14 +4,18 @@ from typing import Any, Callable, Type, cast, overload
|
|
|
4
4
|
|
|
5
5
|
from hatchet_sdk import Context, DurableContext
|
|
6
6
|
from hatchet_sdk.client import Client
|
|
7
|
-
from hatchet_sdk.clients.admin import AdminClient
|
|
8
7
|
from hatchet_sdk.clients.dispatcher.dispatcher import DispatcherClient
|
|
9
8
|
from hatchet_sdk.clients.events import EventClient
|
|
10
|
-
from hatchet_sdk.clients.rest_client import RestApi
|
|
11
9
|
from hatchet_sdk.clients.run_event_listener import RunEventListenerClient
|
|
12
10
|
from hatchet_sdk.config import ClientConfig
|
|
13
11
|
from hatchet_sdk.features.cron import CronClient
|
|
12
|
+
from hatchet_sdk.features.logs import LogsClient
|
|
13
|
+
from hatchet_sdk.features.metrics import MetricsClient
|
|
14
|
+
from hatchet_sdk.features.rate_limits import RateLimitsClient
|
|
15
|
+
from hatchet_sdk.features.runs import RunsClient
|
|
14
16
|
from hatchet_sdk.features.scheduled import ScheduledClient
|
|
17
|
+
from hatchet_sdk.features.workers import WorkersClient
|
|
18
|
+
from hatchet_sdk.features.workflows import WorkflowsClient
|
|
15
19
|
from hatchet_sdk.labels import DesiredWorkerLabel
|
|
16
20
|
from hatchet_sdk.logger import logger
|
|
17
21
|
from hatchet_sdk.rate_limit import RateLimit
|
|
@@ -48,10 +52,6 @@ class Hatchet:
|
|
|
48
52
|
rest (RestApi): Interface for REST API operations.
|
|
49
53
|
"""
|
|
50
54
|
|
|
51
|
-
_client: Client
|
|
52
|
-
cron: CronClient
|
|
53
|
-
scheduled: ScheduledClient
|
|
54
|
-
|
|
55
55
|
def __init__(
|
|
56
56
|
self,
|
|
57
57
|
debug: bool = False,
|
|
@@ -75,12 +75,38 @@ class Hatchet:
|
|
|
75
75
|
logger.setLevel(logging.DEBUG)
|
|
76
76
|
|
|
77
77
|
self._client = client if client else Client(config=config, debug=debug)
|
|
78
|
-
self.cron = CronClient(self._client)
|
|
79
|
-
self.scheduled = ScheduledClient(self._client)
|
|
80
78
|
|
|
81
79
|
@property
|
|
82
|
-
def
|
|
83
|
-
return self._client.
|
|
80
|
+
def cron(self) -> CronClient:
|
|
81
|
+
return self._client.cron
|
|
82
|
+
|
|
83
|
+
@property
|
|
84
|
+
def logs(self) -> LogsClient:
|
|
85
|
+
return self._client.logs
|
|
86
|
+
|
|
87
|
+
@property
|
|
88
|
+
def metrics(self) -> MetricsClient:
|
|
89
|
+
return self._client.metrics
|
|
90
|
+
|
|
91
|
+
@property
|
|
92
|
+
def rate_limits(self) -> RateLimitsClient:
|
|
93
|
+
return self._client.rate_limits
|
|
94
|
+
|
|
95
|
+
@property
|
|
96
|
+
def runs(self) -> RunsClient:
|
|
97
|
+
return self._client.runs
|
|
98
|
+
|
|
99
|
+
@property
|
|
100
|
+
def scheduled(self) -> ScheduledClient:
|
|
101
|
+
return self._client.scheduled
|
|
102
|
+
|
|
103
|
+
@property
|
|
104
|
+
def workers(self) -> WorkersClient:
|
|
105
|
+
return self._client.workers
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def workflows(self) -> WorkflowsClient:
|
|
109
|
+
return self._client.workflows
|
|
84
110
|
|
|
85
111
|
@property
|
|
86
112
|
def dispatcher(self) -> DispatcherClient:
|
|
@@ -90,10 +116,6 @@ class Hatchet:
|
|
|
90
116
|
def event(self) -> EventClient:
|
|
91
117
|
return self._client.event
|
|
92
118
|
|
|
93
|
-
@property
|
|
94
|
-
def rest(self) -> RestApi:
|
|
95
|
-
return self._client.rest
|
|
96
|
-
|
|
97
119
|
@property
|
|
98
120
|
def listener(self) -> RunEventListenerClient:
|
|
99
121
|
return self._client.listener
|
|
@@ -2,8 +2,6 @@ import asyncio
|
|
|
2
2
|
from datetime import datetime
|
|
3
3
|
from typing import Any, Generic, cast, get_type_hints
|
|
4
4
|
|
|
5
|
-
from google.protobuf import timestamp_pb2
|
|
6
|
-
|
|
7
5
|
from hatchet_sdk.clients.admin import (
|
|
8
6
|
ScheduleTriggerWorkflowOptions,
|
|
9
7
|
TriggerWorkflowOptions,
|
|
@@ -12,7 +10,7 @@ from hatchet_sdk.clients.admin import (
|
|
|
12
10
|
from hatchet_sdk.clients.rest.models.cron_workflows import CronWorkflows
|
|
13
11
|
from hatchet_sdk.contracts.workflows_pb2 import WorkflowVersion
|
|
14
12
|
from hatchet_sdk.runnables.task import Task
|
|
15
|
-
from hatchet_sdk.runnables.types import R, TWorkflowInput
|
|
13
|
+
from hatchet_sdk.runnables.types import EmptyModel, R, TWorkflowInput
|
|
16
14
|
from hatchet_sdk.runnables.workflow import BaseWorkflow, Workflow
|
|
17
15
|
from hatchet_sdk.utils.aio_utils import get_active_event_loop
|
|
18
16
|
from hatchet_sdk.utils.typing import JSONSerializableMapping, is_basemodel_subclass
|
|
@@ -81,14 +79,14 @@ class Standalone(BaseWorkflow[TWorkflowInput], Generic[TWorkflowInput, R]):
|
|
|
81
79
|
|
|
82
80
|
def run(
|
|
83
81
|
self,
|
|
84
|
-
input: TWorkflowInput
|
|
82
|
+
input: TWorkflowInput = cast(TWorkflowInput, EmptyModel()),
|
|
85
83
|
options: TriggerWorkflowOptions = TriggerWorkflowOptions(),
|
|
86
84
|
) -> R:
|
|
87
85
|
return self._extract_result(self._workflow.run(input, options))
|
|
88
86
|
|
|
89
87
|
async def aio_run(
|
|
90
88
|
self,
|
|
91
|
-
input: TWorkflowInput
|
|
89
|
+
input: TWorkflowInput = cast(TWorkflowInput, EmptyModel()),
|
|
92
90
|
options: TriggerWorkflowOptions = TriggerWorkflowOptions(),
|
|
93
91
|
) -> R:
|
|
94
92
|
result = await self._workflow.aio_run(input, options)
|
|
@@ -96,7 +94,7 @@ class Standalone(BaseWorkflow[TWorkflowInput], Generic[TWorkflowInput, R]):
|
|
|
96
94
|
|
|
97
95
|
def run_no_wait(
|
|
98
96
|
self,
|
|
99
|
-
input: TWorkflowInput
|
|
97
|
+
input: TWorkflowInput = cast(TWorkflowInput, EmptyModel()),
|
|
100
98
|
options: TriggerWorkflowOptions = TriggerWorkflowOptions(),
|
|
101
99
|
) -> TaskRunRef[TWorkflowInput, R]:
|
|
102
100
|
ref = self._workflow.run_no_wait(input, options)
|
|
@@ -105,7 +103,7 @@ class Standalone(BaseWorkflow[TWorkflowInput], Generic[TWorkflowInput, R]):
|
|
|
105
103
|
|
|
106
104
|
async def aio_run_no_wait(
|
|
107
105
|
self,
|
|
108
|
-
input: TWorkflowInput
|
|
106
|
+
input: TWorkflowInput = cast(TWorkflowInput, EmptyModel()),
|
|
109
107
|
options: TriggerWorkflowOptions = TriggerWorkflowOptions(),
|
|
110
108
|
) -> TaskRunRef[TWorkflowInput, R]:
|
|
111
109
|
ref = await self._workflow.aio_run_no_wait(input, options)
|
|
@@ -140,24 +138,24 @@ class Standalone(BaseWorkflow[TWorkflowInput], Generic[TWorkflowInput, R]):
|
|
|
140
138
|
|
|
141
139
|
def schedule(
|
|
142
140
|
self,
|
|
143
|
-
|
|
141
|
+
run_at: datetime,
|
|
144
142
|
input: TWorkflowInput | None = None,
|
|
145
143
|
options: ScheduleTriggerWorkflowOptions = ScheduleTriggerWorkflowOptions(),
|
|
146
144
|
) -> WorkflowVersion:
|
|
147
145
|
return self._workflow.schedule(
|
|
148
|
-
|
|
146
|
+
run_at=run_at,
|
|
149
147
|
input=input,
|
|
150
148
|
options=options,
|
|
151
149
|
)
|
|
152
150
|
|
|
153
151
|
async def aio_schedule(
|
|
154
152
|
self,
|
|
155
|
-
|
|
153
|
+
run_at: datetime,
|
|
156
154
|
input: TWorkflowInput,
|
|
157
155
|
options: ScheduleTriggerWorkflowOptions = ScheduleTriggerWorkflowOptions(),
|
|
158
156
|
) -> WorkflowVersion:
|
|
159
157
|
return await self._workflow.aio_schedule(
|
|
160
|
-
|
|
158
|
+
run_at=run_at,
|
|
161
159
|
input=input,
|
|
162
160
|
options=options,
|
|
163
161
|
)
|
hatchet_sdk/runnables/types.py
CHANGED
|
@@ -29,6 +29,7 @@ from hatchet_sdk.runnables.types import (
|
|
|
29
29
|
DEFAULT_EXECUTION_TIMEOUT,
|
|
30
30
|
DEFAULT_SCHEDULE_TIMEOUT,
|
|
31
31
|
ConcurrencyExpression,
|
|
32
|
+
EmptyModel,
|
|
32
33
|
R,
|
|
33
34
|
StepType,
|
|
34
35
|
TWorkflowInput,
|
|
@@ -271,7 +272,7 @@ class BaseWorkflow(Generic[TWorkflowInput]):
|
|
|
271
272
|
def is_durable(self) -> bool:
|
|
272
273
|
return any(task.is_durable for task in self.tasks)
|
|
273
274
|
|
|
274
|
-
def
|
|
275
|
+
def create_bulk_run_item(
|
|
275
276
|
self,
|
|
276
277
|
input: TWorkflowInput | None = None,
|
|
277
278
|
key: str | None = None,
|
|
@@ -293,10 +294,10 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
293
294
|
|
|
294
295
|
def run_no_wait(
|
|
295
296
|
self,
|
|
296
|
-
input: TWorkflowInput
|
|
297
|
+
input: TWorkflowInput = cast(TWorkflowInput, EmptyModel()),
|
|
297
298
|
options: TriggerWorkflowOptions = TriggerWorkflowOptions(),
|
|
298
299
|
) -> WorkflowRunRef:
|
|
299
|
-
return self.client.admin.run_workflow(
|
|
300
|
+
return self.client._client.admin.run_workflow(
|
|
300
301
|
workflow_name=self.config.name,
|
|
301
302
|
input=input.model_dump() if input else {},
|
|
302
303
|
options=options,
|
|
@@ -304,10 +305,10 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
304
305
|
|
|
305
306
|
def run(
|
|
306
307
|
self,
|
|
307
|
-
input: TWorkflowInput
|
|
308
|
+
input: TWorkflowInput = cast(TWorkflowInput, EmptyModel()),
|
|
308
309
|
options: TriggerWorkflowOptions = TriggerWorkflowOptions(),
|
|
309
310
|
) -> dict[str, Any]:
|
|
310
|
-
ref = self.client.admin.run_workflow(
|
|
311
|
+
ref = self.client._client.admin.run_workflow(
|
|
311
312
|
workflow_name=self.config.name,
|
|
312
313
|
input=input.model_dump() if input else {},
|
|
313
314
|
options=options,
|
|
@@ -317,10 +318,10 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
317
318
|
|
|
318
319
|
async def aio_run_no_wait(
|
|
319
320
|
self,
|
|
320
|
-
input: TWorkflowInput
|
|
321
|
+
input: TWorkflowInput = cast(TWorkflowInput, EmptyModel()),
|
|
321
322
|
options: TriggerWorkflowOptions = TriggerWorkflowOptions(),
|
|
322
323
|
) -> WorkflowRunRef:
|
|
323
|
-
return await self.client.admin.aio_run_workflow(
|
|
324
|
+
return await self.client._client.admin.aio_run_workflow(
|
|
324
325
|
workflow_name=self.config.name,
|
|
325
326
|
input=input.model_dump() if input else {},
|
|
326
327
|
options=options,
|
|
@@ -328,10 +329,10 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
328
329
|
|
|
329
330
|
async def aio_run(
|
|
330
331
|
self,
|
|
331
|
-
input: TWorkflowInput
|
|
332
|
+
input: TWorkflowInput = cast(TWorkflowInput, EmptyModel()),
|
|
332
333
|
options: TriggerWorkflowOptions = TriggerWorkflowOptions(),
|
|
333
334
|
) -> dict[str, Any]:
|
|
334
|
-
ref = await self.client.admin.aio_run_workflow(
|
|
335
|
+
ref = await self.client._client.admin.aio_run_workflow(
|
|
335
336
|
workflow_name=self.config.name,
|
|
336
337
|
input=input.model_dump() if input else {},
|
|
337
338
|
options=options,
|
|
@@ -343,7 +344,7 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
343
344
|
self,
|
|
344
345
|
workflows: list[WorkflowRunTriggerConfig],
|
|
345
346
|
) -> list[dict[str, Any]]:
|
|
346
|
-
refs = self.client.admin.run_workflows(
|
|
347
|
+
refs = self.client._client.admin.run_workflows(
|
|
347
348
|
workflows=workflows,
|
|
348
349
|
)
|
|
349
350
|
|
|
@@ -353,7 +354,7 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
353
354
|
self,
|
|
354
355
|
workflows: list[WorkflowRunTriggerConfig],
|
|
355
356
|
) -> list[dict[str, Any]]:
|
|
356
|
-
refs = await self.client.admin.aio_run_workflows(
|
|
357
|
+
refs = await self.client._client.admin.aio_run_workflows(
|
|
357
358
|
workflows=workflows,
|
|
358
359
|
)
|
|
359
360
|
|
|
@@ -363,7 +364,7 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
363
364
|
self,
|
|
364
365
|
workflows: list[WorkflowRunTriggerConfig],
|
|
365
366
|
) -> list[WorkflowRunRef]:
|
|
366
|
-
return self.client.admin.run_workflows(
|
|
367
|
+
return self.client._client.admin.run_workflows(
|
|
367
368
|
workflows=workflows,
|
|
368
369
|
)
|
|
369
370
|
|
|
@@ -371,32 +372,32 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
371
372
|
self,
|
|
372
373
|
workflows: list[WorkflowRunTriggerConfig],
|
|
373
374
|
) -> list[WorkflowRunRef]:
|
|
374
|
-
return await self.client.admin.aio_run_workflows(
|
|
375
|
+
return await self.client._client.admin.aio_run_workflows(
|
|
375
376
|
workflows=workflows,
|
|
376
377
|
)
|
|
377
378
|
|
|
378
379
|
def schedule(
|
|
379
380
|
self,
|
|
380
|
-
|
|
381
|
+
run_at: datetime,
|
|
381
382
|
input: TWorkflowInput | None = None,
|
|
382
383
|
options: ScheduleTriggerWorkflowOptions = ScheduleTriggerWorkflowOptions(),
|
|
383
384
|
) -> WorkflowVersion:
|
|
384
|
-
return self.client.admin.schedule_workflow(
|
|
385
|
+
return self.client._client.admin.schedule_workflow(
|
|
385
386
|
name=self.config.name,
|
|
386
|
-
schedules=cast(list[datetime | timestamp_pb2.Timestamp],
|
|
387
|
+
schedules=cast(list[datetime | timestamp_pb2.Timestamp], [run_at]),
|
|
387
388
|
input=input.model_dump() if input else {},
|
|
388
389
|
options=options,
|
|
389
390
|
)
|
|
390
391
|
|
|
391
392
|
async def aio_schedule(
|
|
392
393
|
self,
|
|
393
|
-
|
|
394
|
+
run_at: datetime,
|
|
394
395
|
input: TWorkflowInput,
|
|
395
396
|
options: ScheduleTriggerWorkflowOptions = ScheduleTriggerWorkflowOptions(),
|
|
396
397
|
) -> WorkflowVersion:
|
|
397
|
-
return await self.client.admin.aio_schedule_workflow(
|
|
398
|
+
return await self.client._client.admin.aio_schedule_workflow(
|
|
398
399
|
name=self.config.name,
|
|
399
|
-
schedules=
|
|
400
|
+
schedules=cast(list[datetime | timestamp_pb2.Timestamp], [run_at]),
|
|
400
401
|
input=input.model_dump(),
|
|
401
402
|
options=options,
|
|
402
403
|
)
|
|
@@ -661,6 +662,9 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
661
662
|
concurrency=concurrency,
|
|
662
663
|
)
|
|
663
664
|
|
|
665
|
+
if self._on_failure_task:
|
|
666
|
+
raise ValueError("Only one on-failure task is allowed")
|
|
667
|
+
|
|
664
668
|
self._on_failure_task = task
|
|
665
669
|
|
|
666
670
|
return task
|
|
@@ -722,6 +726,9 @@ class Workflow(BaseWorkflow[TWorkflowInput]):
|
|
|
722
726
|
parents=[],
|
|
723
727
|
)
|
|
724
728
|
|
|
729
|
+
if self._on_failure_task:
|
|
730
|
+
raise ValueError("Only one on-failure task is allowed")
|
|
731
|
+
|
|
725
732
|
self._on_success_task = task
|
|
726
733
|
|
|
727
734
|
return task
|
|
@@ -98,9 +98,9 @@ class WorkerActionListenerProcess:
|
|
|
98
98
|
if self.listener is None:
|
|
99
99
|
raise ValueError("listener not started")
|
|
100
100
|
|
|
101
|
-
await self.client.
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
await self.client.workers.aio_update(
|
|
102
|
+
worker_id=self.listener.worker_id,
|
|
103
|
+
opts=UpdateWorkerRequest(isPaused=True),
|
|
104
104
|
)
|
|
105
105
|
|
|
106
106
|
async def start(self, retry_attempt: int = 0) -> None:
|
|
@@ -55,7 +55,6 @@ class WorkerStatus(Enum):
|
|
|
55
55
|
class Runner:
|
|
56
56
|
def __init__(
|
|
57
57
|
self,
|
|
58
|
-
name: str,
|
|
59
58
|
event_queue: "Queue[ActionEvent]",
|
|
60
59
|
config: ClientConfig,
|
|
61
60
|
slots: int | None = None,
|
|
@@ -67,7 +66,6 @@ class Runner:
|
|
|
67
66
|
# We store the config so we can dynamically create clients for the dispatcher client.
|
|
68
67
|
self.config = config
|
|
69
68
|
self.client = Client(config)
|
|
70
|
-
self.name = self.client.config.namespace + name
|
|
71
69
|
self.slots = slots
|
|
72
70
|
self.tasks: dict[str, asyncio.Task[Any]] = {} # Store run ids and futures
|
|
73
71
|
self.contexts: dict[str, Context] = {} # Store run ids and contexts
|
|
@@ -286,12 +284,8 @@ class Runner:
|
|
|
286
284
|
self.dispatcher_client,
|
|
287
285
|
self.admin_client,
|
|
288
286
|
self.client.event,
|
|
289
|
-
self.client.rest,
|
|
290
|
-
self.client.workflow_listener,
|
|
291
287
|
self.durable_event_listener,
|
|
292
|
-
self.workflow_run_event_listener,
|
|
293
288
|
self.worker_context,
|
|
294
|
-
self.client.config.namespace,
|
|
295
289
|
validator_registry=self.validator_registry,
|
|
296
290
|
)
|
|
297
291
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
hatchet_sdk/__init__.py,sha256=
|
|
2
|
-
hatchet_sdk/client.py,sha256=
|
|
3
|
-
hatchet_sdk/clients/admin.py,sha256=
|
|
1
|
+
hatchet_sdk/__init__.py,sha256=o_06wLLKCKRq4uQuCF62yDRb8hTQYYcqPC3FIDNHxuQ,10002
|
|
2
|
+
hatchet_sdk/client.py,sha256=nfLv2jzv7XlL9VzQSnfyCdtK4ew0zanUgsoXC0KEtY0,2255
|
|
3
|
+
hatchet_sdk/clients/admin.py,sha256=LtSv6y4PZ2Tkz8Z-JlaDd55wSLTNBTa7rUhPx6DBsp8,16316
|
|
4
4
|
hatchet_sdk/clients/dispatcher/action_listener.py,sha256=mQI2qQI_tZLEezTO1wbGcAsjPRQYRe-KSHurJUESKeA,16554
|
|
5
5
|
hatchet_sdk/clients/dispatcher/dispatcher.py,sha256=GMb4ljE-gSTf5RkpmRboPXCMncJKAJ6KKERGcf1nz48,6993
|
|
6
6
|
hatchet_sdk/clients/durable_event_listener.py,sha256=ZiJOGlI7NKmN6Oev1UGF7wETTtvGxpmgO7YS3tDjYMk,11823
|
|
@@ -200,7 +200,7 @@ hatchet_sdk/clients/rest/models/workflow_run_shape_item_for_workflow_run_details
|
|
|
200
200
|
hatchet_sdk/clients/rest/models/workflow_run_status.py,sha256=X_jDDvq3GhjTNvdGy_NXUVNlUiIFrwbsQTw9kG_7YPs,805
|
|
201
201
|
hatchet_sdk/clients/rest/models/workflow_run_triggered_by.py,sha256=j6Ob3ICDL2wqZuFE2Bu1wuusH75HPwH0S53xpjQaRHY,3545
|
|
202
202
|
hatchet_sdk/clients/rest/models/workflow_runs_cancel_request.py,sha256=57o2jz6LN3PB2gi2SH_PBmyyhg5_94uNx2Shv_EpiSE,2537
|
|
203
|
-
hatchet_sdk/clients/rest/models/workflow_runs_metrics.py,sha256=
|
|
203
|
+
hatchet_sdk/clients/rest/models/workflow_runs_metrics.py,sha256=7CfcXlvHNny8Q496CR6iW_DBjyefgN4NZ3QhH8IhX3k,2865
|
|
204
204
|
hatchet_sdk/clients/rest/models/workflow_runs_metrics_counts.py,sha256=8pe_pI8UXe0YeMaOTRwrog3_Gq1z0LR2kLtq9hwS28g,3217
|
|
205
205
|
hatchet_sdk/clients/rest/models/workflow_tag.py,sha256=9aPXHeUYW6FV-6dB-I5Ex0P5g82YNePEuy8-VG5Ecrs,2494
|
|
206
206
|
hatchet_sdk/clients/rest/models/workflow_trigger_cron_ref.py,sha256=_6r0laWazB6r_eC1Sc7RZOYACWzhnItasKkMtkqu4Eg,2498
|
|
@@ -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/rest_client.py,sha256=QVwIPDI1uPJOewa5mWJDdOneasXCi_vb5fo8TZPej_Q,25213
|
|
218
217
|
hatchet_sdk/clients/run_event_listener.py,sha256=t58Scw9CypYXegU7ZWLAUeSFcse2l4G3d8WvIoEPlBI,10689
|
|
218
|
+
hatchet_sdk/clients/v1/api_client.py,sha256=0FmhJIjN5Y4CWEsIWt0XzoOmIFUjPwFOAG0TI-fVqHI,2412
|
|
219
219
|
hatchet_sdk/clients/workflow_listener.py,sha256=oqvoJYw9rCSPv-_V-ipX_yEC6ipLG8ZRUVwkaM2SEjc,10443
|
|
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=8vfNMu-SEC5BDaJmvbo42SxuKH6UwLdX4-q0j0zN0IU,8728
|
|
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
|
|
@@ -240,9 +240,15 @@ hatchet_sdk/contracts/v1/workflows_pb2_grpc.py,sha256=KaRIG3-jC4DCaBLXbsoiF3zq4Y
|
|
|
240
240
|
hatchet_sdk/contracts/workflows_pb2.py,sha256=9j6-YMrtgp2yxX-BePwyaqxuFhrI6OftoZSR53JPDWw,11739
|
|
241
241
|
hatchet_sdk/contracts/workflows_pb2.pyi,sha256=2r5d4DWaR0kwY8jKSzcffTAMMlWrusRXCziE_03SFYc,15434
|
|
242
242
|
hatchet_sdk/contracts/workflows_pb2_grpc.py,sha256=ekBhwoDD6Hrad58WUGCUeNES41qxOobBR4rDI_M7ET8,10778
|
|
243
|
-
hatchet_sdk/features/cron.py,sha256=
|
|
244
|
-
hatchet_sdk/features/
|
|
245
|
-
hatchet_sdk/
|
|
243
|
+
hatchet_sdk/features/cron.py,sha256=DsgRXgjM3p0CgeZiaVvVXIJpIVEabKm_QbC-a43ADHE,9188
|
|
244
|
+
hatchet_sdk/features/logs.py,sha256=JzVohdtzZC7P5DHsK90XVQwnrrwfyIYB9IdDRw1JgEE,676
|
|
245
|
+
hatchet_sdk/features/metrics.py,sha256=phAhQSRqqaoPusbX5Odg13bFNQbnJIZeU9nHtJCql68,2861
|
|
246
|
+
hatchet_sdk/features/rate_limits.py,sha256=4VqbPzLY5pZMrZBPH4n2-mNbHxJMPbhn0rODsGwnuhA,1554
|
|
247
|
+
hatchet_sdk/features/runs.py,sha256=YunX58qF_buZXC9iYki289hrqnilD2QV9PYiKDlKl4k,8133
|
|
248
|
+
hatchet_sdk/features/scheduled.py,sha256=0Qoa9SikuJviMTtw86m6iGHa55eSqtD6OihOEntRmG0,8870
|
|
249
|
+
hatchet_sdk/features/workers.py,sha256=-o5f8k_AqHPtDbJN47KPYc_XVQI672ZnNGEPVIfEv7o,1553
|
|
250
|
+
hatchet_sdk/features/workflows.py,sha256=MoC5rL3sbuYgBDri2XigaeIUOGoN0frNVcL6O7243Kg,2107
|
|
251
|
+
hatchet_sdk/hatchet.py,sha256=tmTGNRKcpLZlVquqMPmvS14OCgcMsYEsGTeFpKay5NE,22933
|
|
246
252
|
hatchet_sdk/labels.py,sha256=nATgxWE3lFxRTnfISEpoIRLGbMfAZsHF4lZTuG4Mfic,182
|
|
247
253
|
hatchet_sdk/logger.py,sha256=5uOr52T4mImSQm1QvWT8HvZFK5WfPNh3Y1cBQZRFgUQ,333
|
|
248
254
|
hatchet_sdk/metadata.py,sha256=QzIcTlOGhFd-O3BF2f8sPYESPFFN9387Zi8-OdKDntA,105
|
|
@@ -250,10 +256,10 @@ hatchet_sdk/opentelemetry/instrumentor.py,sha256=KYZG1koVv4704kgr7YJ-M3QqRcTrZI2
|
|
|
250
256
|
hatchet_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
251
257
|
hatchet_sdk/rate_limit.py,sha256=TwbCuggiZaWpYuo4mjVLlE-z1OfQ2mRBiVvCSaG3lv4,3919
|
|
252
258
|
hatchet_sdk/runnables/contextvars.py,sha256=6MDocAMmlyiRW37oQ1jyx10tAlJs-xgDjR3xPoPz05g,426
|
|
253
|
-
hatchet_sdk/runnables/standalone.py,sha256=
|
|
259
|
+
hatchet_sdk/runnables/standalone.py,sha256=DIj-E7RlZmVcUIAyd7ck9YcOt5MgladWWelKatLbpM4,6442
|
|
254
260
|
hatchet_sdk/runnables/task.py,sha256=jQiRPeE9EbIzNOxv6hkmJ8RqyVR7hMLXX4cnGRl_GF8,4832
|
|
255
|
-
hatchet_sdk/runnables/types.py,sha256=
|
|
256
|
-
hatchet_sdk/runnables/workflow.py,sha256=
|
|
261
|
+
hatchet_sdk/runnables/types.py,sha256=JWo4hkYb2XYoktIFVvnqud6Ywmo7AHMK_upYpdNmij0,4235
|
|
262
|
+
hatchet_sdk/runnables/workflow.py,sha256=lRkzDTYIsQl_3RPpWGKFKzsanEtUr6DYCfXp3hTwExA,29133
|
|
257
263
|
hatchet_sdk/token.py,sha256=KjIiInwG5Kqd_FO4BSW1x_5Uc7PFbnzIVJqr50-ZldE,779
|
|
258
264
|
hatchet_sdk/utils/aio_utils.py,sha256=PSspZGyUKJsdluB_a8jjfmAVXCmPJYlSQ4mUMa21PTk,484
|
|
259
265
|
hatchet_sdk/utils/backoff.py,sha256=6B5Rb5nLKw_TqqgpJMYjIBV1PTTtbOMRZCveisVhg_I,353
|
|
@@ -493,13 +499,13 @@ hatchet_sdk/v0/workflow.py,sha256=d4o425efk7J3JgLIge34MW_A3pzwnwSRtwEOgIqM2pc,93
|
|
|
493
499
|
hatchet_sdk/v0/workflow_run.py,sha256=jsEZprXshrSV7i_TtL5uoCL03D18zQ3NeJCq7mp97Dg,1752
|
|
494
500
|
hatchet_sdk/waits.py,sha256=mBJVOjvTJfhXCngyIfNccYFtg7eiFM2B2n7lcg90S3A,3327
|
|
495
501
|
hatchet_sdk/worker/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
496
|
-
hatchet_sdk/worker/action_listener_process.py,sha256=
|
|
497
|
-
hatchet_sdk/worker/runner/run_loop_manager.py,sha256=
|
|
498
|
-
hatchet_sdk/worker/runner/runner.py,sha256=
|
|
502
|
+
hatchet_sdk/worker/action_listener_process.py,sha256=OslEFdj0VZvC65yPB8vNqrLQXQYeRxrfjz7XPzZ8AcA,11455
|
|
503
|
+
hatchet_sdk/worker/runner/run_loop_manager.py,sha256=uLzNCKy0yHEX8IosDCQvA8TqkIOd14BaAFFArOaPxzA,3970
|
|
504
|
+
hatchet_sdk/worker/runner/runner.py,sha256=35bBFrBAamirOkfNgjNAbewP2eKTPBLbmPG19By-nFg,16509
|
|
499
505
|
hatchet_sdk/worker/runner/utils/capture_logs.py,sha256=_3W5pqT-lirfhsSjOEBkD9cgCm1OEhn6Wk5So8nhib8,2795
|
|
500
506
|
hatchet_sdk/worker/worker.py,sha256=sHqirnXNwVcw24LBzEGyUgEgYN5T1430tUs6WHNZZhg,14147
|
|
501
507
|
hatchet_sdk/workflow_run.py,sha256=JTLOuGyEat4OvMM3h55WrX0aFFpqs5YtK7YJxTMC92I,1428
|
|
502
|
-
hatchet_sdk-1.0.
|
|
503
|
-
hatchet_sdk-1.0.
|
|
504
|
-
hatchet_sdk-1.0.
|
|
505
|
-
hatchet_sdk-1.0.
|
|
508
|
+
hatchet_sdk-1.0.1.dist-info/METADATA,sha256=GZShTmxvV7xHlFjrOgEb_9AnrY1UTzmTNHq7CDt7CWA,1829
|
|
509
|
+
hatchet_sdk-1.0.1.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
510
|
+
hatchet_sdk-1.0.1.dist-info/entry_points.txt,sha256=g_3isHLTk-_oUZ6iVAN0iuFQV8vL1zvAsswQ32OqyeU,1194
|
|
511
|
+
hatchet_sdk-1.0.1.dist-info/RECORD,,
|