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

Files changed (31) hide show
  1. hatchet_sdk/__init__.py +2 -0
  2. hatchet_sdk/client.py +2 -0
  3. hatchet_sdk/clients/events.py +42 -3
  4. hatchet_sdk/clients/rest/__init__.py +5 -0
  5. hatchet_sdk/clients/rest/api/event_api.py +490 -0
  6. hatchet_sdk/clients/rest/api/filter_api.py +339 -0
  7. hatchet_sdk/clients/rest/api/tenant_api.py +275 -0
  8. hatchet_sdk/clients/rest/api/workflow_runs_api.py +310 -0
  9. hatchet_sdk/clients/rest/models/__init__.py +5 -0
  10. hatchet_sdk/clients/rest/models/create_tenant_request.py +22 -2
  11. hatchet_sdk/clients/rest/models/tenant.py +6 -0
  12. hatchet_sdk/clients/rest/models/tenant_ui_version.py +37 -0
  13. hatchet_sdk/clients/rest/models/update_tenant_request.py +6 -0
  14. hatchet_sdk/clients/rest/models/v1_event.py +42 -0
  15. hatchet_sdk/clients/rest/models/v1_event_triggered_run.py +94 -0
  16. hatchet_sdk/clients/rest/models/v1_update_filter_request.py +98 -0
  17. hatchet_sdk/contracts/v1/workflows_pb2.py +26 -24
  18. hatchet_sdk/contracts/v1/workflows_pb2.pyi +14 -2
  19. hatchet_sdk/features/filters.py +36 -0
  20. hatchet_sdk/features/runs.py +22 -3
  21. hatchet_sdk/features/tenant.py +32 -0
  22. hatchet_sdk/hatchet.py +51 -8
  23. hatchet_sdk/runnables/action.py +1 -1
  24. hatchet_sdk/runnables/types.py +22 -4
  25. hatchet_sdk/runnables/workflow.py +413 -188
  26. hatchet_sdk/waits.py +2 -2
  27. {hatchet_sdk-1.11.1.dist-info → hatchet_sdk-1.12.1.dist-info}/METADATA +1 -1
  28. {hatchet_sdk-1.11.1.dist-info → hatchet_sdk-1.12.1.dist-info}/RECORD +30 -27
  29. hatchet_sdk/runnables/standalone.py +0 -391
  30. {hatchet_sdk-1.11.1.dist-info → hatchet_sdk-1.12.1.dist-info}/WHEEL +0 -0
  31. {hatchet_sdk-1.11.1.dist-info → hatchet_sdk-1.12.1.dist-info}/entry_points.txt +0 -0
hatchet_sdk/__init__.py CHANGED
@@ -144,6 +144,7 @@ from hatchet_sdk.runnables.task import Task
144
144
  from hatchet_sdk.runnables.types import (
145
145
  ConcurrencyExpression,
146
146
  ConcurrencyLimitStrategy,
147
+ DefaultFilter,
147
148
  EmptyModel,
148
149
  StickyStrategy,
149
150
  TaskDefaults,
@@ -275,4 +276,5 @@ __all__ = [
275
276
  "OTelAttribute",
276
277
  "OpenTelemetryConfig",
277
278
  "ClientTLSConfig",
279
+ "DefaultFilter",
278
280
  ]
hatchet_sdk/client.py CHANGED
@@ -11,6 +11,7 @@ from hatchet_sdk.features.metrics import MetricsClient
11
11
  from hatchet_sdk.features.rate_limits import RateLimitsClient
12
12
  from hatchet_sdk.features.runs import RunsClient
13
13
  from hatchet_sdk.features.scheduled import ScheduledClient
14
+ from hatchet_sdk.features.tenant import TenantClient
14
15
  from hatchet_sdk.features.workers import WorkersClient
15
16
  from hatchet_sdk.features.workflows import WorkflowsClient
16
17
 
@@ -45,6 +46,7 @@ class Client:
45
46
  workflow_run_listener=self.workflow_listener,
46
47
  )
47
48
  self.scheduled = ScheduledClient(self.config)
49
+ self.tenant = TenantClient(self.config)
48
50
  self.workers = WorkersClient(self.config)
49
51
  self.workflows = WorkflowsClient(self.config)
50
52
 
@@ -10,8 +10,12 @@ from hatchet_sdk.clients.rest.api.event_api import EventApi
10
10
  from hatchet_sdk.clients.rest.api.workflow_runs_api import WorkflowRunsApi
11
11
  from hatchet_sdk.clients.rest.api_client import ApiClient
12
12
  from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
13
+ from hatchet_sdk.clients.rest.models.v1_task_status import V1TaskStatus
13
14
  from hatchet_sdk.clients.rest.tenacity_utils import tenacity_retry
14
- from hatchet_sdk.clients.v1.api_client import BaseRestClient
15
+ from hatchet_sdk.clients.v1.api_client import (
16
+ BaseRestClient,
17
+ maybe_additional_metadata_to_kv,
18
+ )
15
19
  from hatchet_sdk.config import ClientConfig
16
20
  from hatchet_sdk.connection import new_conn
17
21
  from hatchet_sdk.contracts.events_pb2 import (
@@ -28,7 +32,7 @@ from hatchet_sdk.utils.typing import JSONSerializableMapping
28
32
 
29
33
 
30
34
  def proto_timestamp_now() -> timestamp_pb2.Timestamp:
31
- t = datetime.datetime.now().timestamp()
35
+ t = datetime.datetime.now(tz=datetime.timezone.utc).timestamp()
32
36
  seconds = int(t)
33
37
  nanos = int(t % 1 * 1e9)
34
38
 
@@ -209,14 +213,40 @@ class EventClient(BaseRestClient):
209
213
  offset: int | None = None,
210
214
  limit: int | None = None,
211
215
  keys: list[str] | None = None,
216
+ since: datetime.datetime | None = None,
217
+ until: datetime.datetime | None = None,
218
+ workflow_ids: list[str] | None = None,
219
+ workflow_run_statuses: list[V1TaskStatus] | None = None,
220
+ event_ids: list[str] | None = None,
221
+ additional_metadata: JSONSerializableMapping | None = None,
222
+ scopes: list[str] | None = None,
212
223
  ) -> V1EventList:
213
- return await asyncio.to_thread(self.list, offset=offset, limit=limit, keys=keys)
224
+ return await asyncio.to_thread(
225
+ self.list,
226
+ offset=offset,
227
+ limit=limit,
228
+ keys=keys,
229
+ since=since,
230
+ until=until,
231
+ workflow_ids=workflow_ids,
232
+ workflow_run_statuses=workflow_run_statuses,
233
+ event_ids=event_ids,
234
+ additional_metadata=additional_metadata,
235
+ scopes=scopes,
236
+ )
214
237
 
215
238
  def list(
216
239
  self,
217
240
  offset: int | None = None,
218
241
  limit: int | None = None,
219
242
  keys: list[str] | None = None,
243
+ since: datetime.datetime | None = None,
244
+ until: datetime.datetime | None = None,
245
+ workflow_ids: list[str] | None = None,
246
+ workflow_run_statuses: list[V1TaskStatus] | None = None,
247
+ event_ids: list[str] | None = None,
248
+ additional_metadata: JSONSerializableMapping | None = None,
249
+ scopes: list[str] | None = None,
220
250
  ) -> V1EventList:
221
251
  with self.client() as client:
222
252
  return self._ea(client).v1_event_list(
@@ -224,4 +254,13 @@ class EventClient(BaseRestClient):
224
254
  offset=offset,
225
255
  limit=limit,
226
256
  keys=keys,
257
+ since=since,
258
+ until=until,
259
+ workflow_ids=workflow_ids,
260
+ workflow_run_statuses=workflow_run_statuses,
261
+ event_ids=event_ids,
262
+ additional_metadata=maybe_additional_metadata_to_kv(
263
+ additional_metadata
264
+ ),
265
+ scopes=scopes,
227
266
  )
@@ -207,6 +207,7 @@ from hatchet_sdk.clients.rest.models.tenant_resource_policy import TenantResourc
207
207
  from hatchet_sdk.clients.rest.models.tenant_step_run_queue_metrics import (
208
208
  TenantStepRunQueueMetrics,
209
209
  )
210
+ from hatchet_sdk.clients.rest.models.tenant_ui_version import TenantUIVersion
210
211
  from hatchet_sdk.clients.rest.models.tenant_version import TenantVersion
211
212
  from hatchet_sdk.clients.rest.models.trigger_workflow_run_request import (
212
213
  TriggerWorkflowRunRequest,
@@ -236,6 +237,7 @@ from hatchet_sdk.clients.rest.models.v1_create_filter_request import (
236
237
  from hatchet_sdk.clients.rest.models.v1_dag_children import V1DagChildren
237
238
  from hatchet_sdk.clients.rest.models.v1_event import V1Event
238
239
  from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
240
+ from hatchet_sdk.clients.rest.models.v1_event_triggered_run import V1EventTriggeredRun
239
241
  from hatchet_sdk.clients.rest.models.v1_event_workflow_run_summary import (
240
242
  V1EventWorkflowRunSummary,
241
243
  )
@@ -261,6 +263,9 @@ from hatchet_sdk.clients.rest.models.v1_task_timing_list import V1TaskTimingList
261
263
  from hatchet_sdk.clients.rest.models.v1_trigger_workflow_run_request import (
262
264
  V1TriggerWorkflowRunRequest,
263
265
  )
266
+ from hatchet_sdk.clients.rest.models.v1_update_filter_request import (
267
+ V1UpdateFilterRequest,
268
+ )
264
269
  from hatchet_sdk.clients.rest.models.v1_workflow_run import V1WorkflowRun
265
270
  from hatchet_sdk.clients.rest.models.v1_workflow_run_details import V1WorkflowRunDetails
266
271
  from hatchet_sdk.clients.rest.models.v1_workflow_run_display_name import (