hatchet-sdk 1.11.1__py3-none-any.whl → 1.12.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 -0
- hatchet_sdk/client.py +2 -0
- hatchet_sdk/clients/events.py +10 -2
- hatchet_sdk/clients/rest/__init__.py +4 -0
- hatchet_sdk/clients/rest/api/event_api.py +67 -0
- hatchet_sdk/clients/rest/api/filter_api.py +339 -0
- hatchet_sdk/clients/rest/api/tenant_api.py +275 -0
- hatchet_sdk/clients/rest/api/workflow_runs_api.py +310 -0
- hatchet_sdk/clients/rest/models/__init__.py +4 -0
- hatchet_sdk/clients/rest/models/create_tenant_request.py +15 -2
- hatchet_sdk/clients/rest/models/tenant.py +6 -0
- hatchet_sdk/clients/rest/models/tenant_ui_version.py +37 -0
- hatchet_sdk/clients/rest/models/update_tenant_request.py +6 -0
- hatchet_sdk/clients/rest/models/v1_update_filter_request.py +98 -0
- hatchet_sdk/contracts/v1/workflows_pb2.py +26 -24
- hatchet_sdk/contracts/v1/workflows_pb2.pyi +14 -2
- hatchet_sdk/features/filters.py +36 -0
- hatchet_sdk/features/runs.py +22 -3
- hatchet_sdk/features/tenant.py +32 -0
- hatchet_sdk/hatchet.py +51 -8
- hatchet_sdk/runnables/action.py +1 -1
- hatchet_sdk/runnables/types.py +22 -4
- hatchet_sdk/runnables/workflow.py +413 -188
- hatchet_sdk/waits.py +2 -2
- {hatchet_sdk-1.11.1.dist-info → hatchet_sdk-1.12.0.dist-info}/METADATA +1 -1
- {hatchet_sdk-1.11.1.dist-info → hatchet_sdk-1.12.0.dist-info}/RECORD +28 -26
- hatchet_sdk/runnables/standalone.py +0 -391
- {hatchet_sdk-1.11.1.dist-info → hatchet_sdk-1.12.0.dist-info}/WHEEL +0 -0
- {hatchet_sdk-1.11.1.dist-info → hatchet_sdk-1.12.0.dist-info}/entry_points.txt +0 -0
|
@@ -22,6 +22,8 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
|
22
22
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
23
23
|
from typing_extensions import Self
|
|
24
24
|
|
|
25
|
+
from hatchet_sdk.clients.rest.models.tenant_ui_version import TenantUIVersion
|
|
26
|
+
|
|
25
27
|
|
|
26
28
|
class CreateTenantRequest(BaseModel):
|
|
27
29
|
"""
|
|
@@ -30,7 +32,12 @@ class CreateTenantRequest(BaseModel):
|
|
|
30
32
|
|
|
31
33
|
name: StrictStr = Field(description="The name of the tenant.")
|
|
32
34
|
slug: StrictStr = Field(description="The slug of the tenant.")
|
|
33
|
-
|
|
35
|
+
ui_version: Optional[TenantUIVersion] = Field(
|
|
36
|
+
default=None,
|
|
37
|
+
description="The UI version of the tenant. Defaults to V0.",
|
|
38
|
+
alias="uiVersion",
|
|
39
|
+
)
|
|
40
|
+
__properties: ClassVar[List[str]] = ["name", "slug", "uiVersion"]
|
|
34
41
|
|
|
35
42
|
model_config = ConfigDict(
|
|
36
43
|
populate_by_name=True,
|
|
@@ -80,5 +87,11 @@ class CreateTenantRequest(BaseModel):
|
|
|
80
87
|
if not isinstance(obj, dict):
|
|
81
88
|
return cls.model_validate(obj)
|
|
82
89
|
|
|
83
|
-
_obj = cls.model_validate(
|
|
90
|
+
_obj = cls.model_validate(
|
|
91
|
+
{
|
|
92
|
+
"name": obj.get("name"),
|
|
93
|
+
"slug": obj.get("slug"),
|
|
94
|
+
"uiVersion": obj.get("uiVersion"),
|
|
95
|
+
}
|
|
96
|
+
)
|
|
84
97
|
return _obj
|
|
@@ -23,6 +23,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
|
23
23
|
from typing_extensions import Self
|
|
24
24
|
|
|
25
25
|
from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta
|
|
26
|
+
from hatchet_sdk.clients.rest.models.tenant_ui_version import TenantUIVersion
|
|
26
27
|
from hatchet_sdk.clients.rest.models.tenant_version import TenantVersion
|
|
27
28
|
|
|
28
29
|
|
|
@@ -45,6 +46,9 @@ class Tenant(BaseModel):
|
|
|
45
46
|
alias="alertMemberEmails",
|
|
46
47
|
)
|
|
47
48
|
version: TenantVersion = Field(description="The version of the tenant.")
|
|
49
|
+
ui_version: Optional[TenantUIVersion] = Field(
|
|
50
|
+
default=None, description="The UI of the tenant.", alias="uiVersion"
|
|
51
|
+
)
|
|
48
52
|
__properties: ClassVar[List[str]] = [
|
|
49
53
|
"metadata",
|
|
50
54
|
"name",
|
|
@@ -52,6 +56,7 @@ class Tenant(BaseModel):
|
|
|
52
56
|
"analyticsOptOut",
|
|
53
57
|
"alertMemberEmails",
|
|
54
58
|
"version",
|
|
59
|
+
"uiVersion",
|
|
55
60
|
]
|
|
56
61
|
|
|
57
62
|
model_config = ConfigDict(
|
|
@@ -117,6 +122,7 @@ class Tenant(BaseModel):
|
|
|
117
122
|
"analyticsOptOut": obj.get("analyticsOptOut"),
|
|
118
123
|
"alertMemberEmails": obj.get("alertMemberEmails"),
|
|
119
124
|
"version": obj.get("version"),
|
|
125
|
+
"uiVersion": obj.get("uiVersion"),
|
|
120
126
|
}
|
|
121
127
|
)
|
|
122
128
|
return _obj
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hatchet API
|
|
5
|
+
|
|
6
|
+
The Hatchet API
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
from enum import Enum
|
|
19
|
+
|
|
20
|
+
from typing_extensions import Self
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class TenantUIVersion(str, Enum):
|
|
24
|
+
"""
|
|
25
|
+
TenantUIVersion
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
"""
|
|
29
|
+
allowed enum values
|
|
30
|
+
"""
|
|
31
|
+
V0 = "V0"
|
|
32
|
+
V1 = "V1"
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def from_json(cls, json_str: str) -> Self:
|
|
36
|
+
"""Create an instance of TenantUIVersion from a JSON string"""
|
|
37
|
+
return cls(json.loads(json_str))
|
|
@@ -22,6 +22,7 @@ from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
|
22
22
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
|
|
23
23
|
from typing_extensions import Self
|
|
24
24
|
|
|
25
|
+
from hatchet_sdk.clients.rest.models.tenant_ui_version import TenantUIVersion
|
|
25
26
|
from hatchet_sdk.clients.rest.models.tenant_version import TenantVersion
|
|
26
27
|
|
|
27
28
|
|
|
@@ -66,6 +67,9 @@ class UpdateTenantRequest(BaseModel):
|
|
|
66
67
|
version: Optional[TenantVersion] = Field(
|
|
67
68
|
default=None, description="The version of the tenant."
|
|
68
69
|
)
|
|
70
|
+
ui_version: Optional[TenantUIVersion] = Field(
|
|
71
|
+
default=None, description="The UI of the tenant.", alias="uiVersion"
|
|
72
|
+
)
|
|
69
73
|
__properties: ClassVar[List[str]] = [
|
|
70
74
|
"name",
|
|
71
75
|
"analyticsOptOut",
|
|
@@ -75,6 +79,7 @@ class UpdateTenantRequest(BaseModel):
|
|
|
75
79
|
"enableTenantResourceLimitAlerts",
|
|
76
80
|
"maxAlertingFrequency",
|
|
77
81
|
"version",
|
|
82
|
+
"uiVersion",
|
|
78
83
|
]
|
|
79
84
|
|
|
80
85
|
model_config = ConfigDict(
|
|
@@ -139,6 +144,7 @@ class UpdateTenantRequest(BaseModel):
|
|
|
139
144
|
),
|
|
140
145
|
"maxAlertingFrequency": obj.get("maxAlertingFrequency"),
|
|
141
146
|
"version": obj.get("version"),
|
|
147
|
+
"uiVersion": obj.get("uiVersion"),
|
|
142
148
|
}
|
|
143
149
|
)
|
|
144
150
|
return _obj
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Hatchet API
|
|
5
|
+
|
|
6
|
+
The Hatchet API
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: 1.0.0
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
import json
|
|
18
|
+
import pprint
|
|
19
|
+
import re # noqa: F401
|
|
20
|
+
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
+
|
|
22
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class V1UpdateFilterRequest(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
V1UpdateFilterRequest
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
|
|
31
|
+
expression: Optional[StrictStr] = Field(
|
|
32
|
+
default=None, description="The expression for the filter"
|
|
33
|
+
)
|
|
34
|
+
scope: Optional[StrictStr] = Field(
|
|
35
|
+
default=None,
|
|
36
|
+
description="The scope associated with this filter. Used for subsetting candidate filters at evaluation time",
|
|
37
|
+
)
|
|
38
|
+
payload: Optional[Dict[str, Any]] = Field(
|
|
39
|
+
default=None, description="The payload for the filter"
|
|
40
|
+
)
|
|
41
|
+
__properties: ClassVar[List[str]] = ["expression", "scope", "payload"]
|
|
42
|
+
|
|
43
|
+
model_config = ConfigDict(
|
|
44
|
+
populate_by_name=True,
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
def to_str(self) -> str:
|
|
50
|
+
"""Returns the string representation of the model using alias"""
|
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
52
|
+
|
|
53
|
+
def to_json(self) -> str:
|
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
56
|
+
return json.dumps(self.to_dict())
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
|
+
"""Create an instance of V1UpdateFilterRequest from a JSON string"""
|
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
|
65
|
+
|
|
66
|
+
This has the following differences from calling pydantic's
|
|
67
|
+
`self.model_dump(by_alias=True)`:
|
|
68
|
+
|
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
|
70
|
+
were set at model initialization. Other fields with value `None`
|
|
71
|
+
are ignored.
|
|
72
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([])
|
|
74
|
+
|
|
75
|
+
_dict = self.model_dump(
|
|
76
|
+
by_alias=True,
|
|
77
|
+
exclude=excluded_fields,
|
|
78
|
+
exclude_none=True,
|
|
79
|
+
)
|
|
80
|
+
return _dict
|
|
81
|
+
|
|
82
|
+
@classmethod
|
|
83
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
84
|
+
"""Create an instance of V1UpdateFilterRequest from a dict"""
|
|
85
|
+
if obj is None:
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
if not isinstance(obj, dict):
|
|
89
|
+
return cls.model_validate(obj)
|
|
90
|
+
|
|
91
|
+
_obj = cls.model_validate(
|
|
92
|
+
{
|
|
93
|
+
"expression": obj.get("expression"),
|
|
94
|
+
"scope": obj.get("scope"),
|
|
95
|
+
"payload": obj.get("payload"),
|
|
96
|
+
}
|
|
97
|
+
)
|
|
98
|
+
return _obj
|
|
@@ -16,7 +16,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__
|
|
|
16
16
|
from hatchet_sdk.contracts.v1.shared import condition_pb2 as v1_dot_shared_dot_condition__pb2
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12v1/workflows.proto\x12\x02v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19v1/shared/condition.proto\"Z\n\x12\x43\x61ncelTasksRequest\x12\x13\n\x0b\x65xternalIds\x18\x01 \x03(\t\x12$\n\x06\x66ilter\x18\x02 \x01(\x0b\x32\x0f.v1.TasksFilterH\x00\x88\x01\x01\x42\t\n\x07_filter\"Z\n\x12ReplayTasksRequest\x12\x13\n\x0b\x65xternalIds\x18\x01 \x03(\t\x12$\n\x06\x66ilter\x18\x02 \x01(\x0b\x32\x0f.v1.TasksFilterH\x00\x88\x01\x01\x42\t\n\x07_filter\"\xb7\x01\n\x0bTasksFilter\x12\x10\n\x08statuses\x18\x01 \x03(\t\x12)\n\x05since\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\x05until\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x12\x14\n\x0cworkflow_ids\x18\x04 \x03(\t\x12\x1b\n\x13\x61\x64\x64itional_metadata\x18\x05 \x03(\tB\x08\n\x06_until\".\n\x13\x43\x61ncelTasksResponse\x12\x17\n\x0f\x63\x61ncelled_tasks\x18\x01 \x03(\t\"-\n\x13ReplayTasksResponse\x12\x16\n\x0ereplayed_tasks\x18\x01 \x03(\t\"\x82\x01\n\x19TriggerWorkflowRunRequest\x12\x15\n\rworkflow_name\x18\x01 \x01(\t\x12\r\n\x05input\x18\x02 \x01(\x0c\x12\x1b\n\x13\x61\x64\x64itional_metadata\x18\x03 \x01(\x0c\x12\x15\n\x08priority\x18\x04 \x01(\x05H\x00\x88\x01\x01\x42\x0b\n\t_priority\"1\n\x1aTriggerWorkflowRunResponse\x12\x13\n\x0b\x65xternal_id\x18\x01 \x01(\t\"\
|
|
19
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x12v1/workflows.proto\x12\x02v1\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x19v1/shared/condition.proto\"Z\n\x12\x43\x61ncelTasksRequest\x12\x13\n\x0b\x65xternalIds\x18\x01 \x03(\t\x12$\n\x06\x66ilter\x18\x02 \x01(\x0b\x32\x0f.v1.TasksFilterH\x00\x88\x01\x01\x42\t\n\x07_filter\"Z\n\x12ReplayTasksRequest\x12\x13\n\x0b\x65xternalIds\x18\x01 \x03(\t\x12$\n\x06\x66ilter\x18\x02 \x01(\x0b\x32\x0f.v1.TasksFilterH\x00\x88\x01\x01\x42\t\n\x07_filter\"\xb7\x01\n\x0bTasksFilter\x12\x10\n\x08statuses\x18\x01 \x03(\t\x12)\n\x05since\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\x05until\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x88\x01\x01\x12\x14\n\x0cworkflow_ids\x18\x04 \x03(\t\x12\x1b\n\x13\x61\x64\x64itional_metadata\x18\x05 \x03(\tB\x08\n\x06_until\".\n\x13\x43\x61ncelTasksResponse\x12\x17\n\x0f\x63\x61ncelled_tasks\x18\x01 \x03(\t\"-\n\x13ReplayTasksResponse\x12\x16\n\x0ereplayed_tasks\x18\x01 \x03(\t\"\x82\x01\n\x19TriggerWorkflowRunRequest\x12\x15\n\rworkflow_name\x18\x01 \x01(\t\x12\r\n\x05input\x18\x02 \x01(\x0c\x12\x1b\n\x13\x61\x64\x64itional_metadata\x18\x03 \x01(\x0c\x12\x15\n\x08priority\x18\x04 \x01(\x05H\x00\x88\x01\x01\x42\x0b\n\t_priority\"1\n\x1aTriggerWorkflowRunResponse\x12\x13\n\x0b\x65xternal_id\x18\x01 \x01(\t\"\xf6\x03\n\x1c\x43reateWorkflowVersionRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12\x0f\n\x07version\x18\x03 \x01(\t\x12\x16\n\x0e\x65vent_triggers\x18\x04 \x03(\t\x12\x15\n\rcron_triggers\x18\x05 \x03(\t\x12!\n\x05tasks\x18\x06 \x03(\x0b\x32\x12.v1.CreateTaskOpts\x12$\n\x0b\x63oncurrency\x18\x07 \x01(\x0b\x32\x0f.v1.Concurrency\x12\x17\n\ncron_input\x18\x08 \x01(\tH\x00\x88\x01\x01\x12\x30\n\x0fon_failure_task\x18\t \x01(\x0b\x32\x12.v1.CreateTaskOptsH\x01\x88\x01\x01\x12\'\n\x06sticky\x18\n \x01(\x0e\x32\x12.v1.StickyStrategyH\x02\x88\x01\x01\x12\x1d\n\x10\x64\x65\x66\x61ult_priority\x18\x0b \x01(\x05H\x03\x88\x01\x01\x12(\n\x0f\x63oncurrency_arr\x18\x0c \x03(\x0b\x32\x0f.v1.Concurrency\x12*\n\x0f\x64\x65\x66\x61ult_filters\x18\r \x03(\x0b\x32\x11.v1.DefaultFilterB\r\n\x0b_cron_inputB\x12\n\x10_on_failure_taskB\t\n\x07_stickyB\x13\n\x11_default_priority\"T\n\rDefaultFilter\x12\x12\n\nexpression\x18\x01 \x01(\t\x12\r\n\x05scope\x18\x02 \x01(\t\x12\x14\n\x07payload\x18\x03 \x01(\tH\x00\x88\x01\x01\x42\n\n\x08_payload\"\x93\x01\n\x0b\x43oncurrency\x12\x12\n\nexpression\x18\x01 \x01(\t\x12\x15\n\x08max_runs\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x39\n\x0elimit_strategy\x18\x03 \x01(\x0e\x32\x1c.v1.ConcurrencyLimitStrategyH\x01\x88\x01\x01\x42\x0b\n\t_max_runsB\x11\n\x0f_limit_strategy\"\xe4\x01\n\x13\x44\x65siredWorkerLabels\x12\x15\n\x08strValue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08intValue\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x15\n\x08required\x18\x03 \x01(\x08H\x02\x88\x01\x01\x12\x32\n\ncomparator\x18\x04 \x01(\x0e\x32\x19.v1.WorkerLabelComparatorH\x03\x88\x01\x01\x12\x13\n\x06weight\x18\x05 \x01(\x05H\x04\x88\x01\x01\x42\x0b\n\t_strValueB\x0b\n\t_intValueB\x0b\n\t_requiredB\r\n\x0b_comparatorB\t\n\x07_weight\"\xb1\x04\n\x0e\x43reateTaskOpts\x12\x13\n\x0breadable_id\x18\x01 \x01(\t\x12\x0e\n\x06\x61\x63tion\x18\x02 \x01(\t\x12\x0f\n\x07timeout\x18\x03 \x01(\t\x12\x0e\n\x06inputs\x18\x04 \x01(\t\x12\x0f\n\x07parents\x18\x05 \x03(\t\x12\x0f\n\x07retries\x18\x06 \x01(\x05\x12,\n\x0brate_limits\x18\x07 \x03(\x0b\x32\x17.v1.CreateTaskRateLimit\x12;\n\rworker_labels\x18\x08 \x03(\x0b\x32$.v1.CreateTaskOpts.WorkerLabelsEntry\x12\x1b\n\x0e\x62\x61\x63koff_factor\x18\t \x01(\x02H\x00\x88\x01\x01\x12 \n\x13\x62\x61\x63koff_max_seconds\x18\n \x01(\x05H\x01\x88\x01\x01\x12$\n\x0b\x63oncurrency\x18\x0b \x03(\x0b\x32\x0f.v1.Concurrency\x12+\n\nconditions\x18\x0c \x01(\x0b\x32\x12.v1.TaskConditionsH\x02\x88\x01\x01\x12\x1d\n\x10schedule_timeout\x18\r \x01(\tH\x03\x88\x01\x01\x1aL\n\x11WorkerLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12&\n\x05value\x18\x02 \x01(\x0b\x32\x17.v1.DesiredWorkerLabels:\x02\x38\x01\x42\x11\n\x0f_backoff_factorB\x16\n\x14_backoff_max_secondsB\r\n\x0b_conditionsB\x13\n\x11_schedule_timeout\"\xfd\x01\n\x13\x43reateTaskRateLimit\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x12\n\x05units\x18\x02 \x01(\x05H\x00\x88\x01\x01\x12\x15\n\x08key_expr\x18\x03 \x01(\tH\x01\x88\x01\x01\x12\x17\n\nunits_expr\x18\x04 \x01(\tH\x02\x88\x01\x01\x12\x1e\n\x11limit_values_expr\x18\x05 \x01(\tH\x03\x88\x01\x01\x12,\n\x08\x64uration\x18\x06 \x01(\x0e\x32\x15.v1.RateLimitDurationH\x04\x88\x01\x01\x42\x08\n\x06_unitsB\x0b\n\t_key_exprB\r\n\x0b_units_exprB\x14\n\x12_limit_values_exprB\x0b\n\t_duration\"@\n\x1d\x43reateWorkflowVersionResponse\x12\n\n\x02id\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t*$\n\x0eStickyStrategy\x12\x08\n\x04SOFT\x10\x00\x12\x08\n\x04HARD\x10\x01*]\n\x11RateLimitDuration\x12\n\n\x06SECOND\x10\x00\x12\n\n\x06MINUTE\x10\x01\x12\x08\n\x04HOUR\x10\x02\x12\x07\n\x03\x44\x41Y\x10\x03\x12\x08\n\x04WEEK\x10\x04\x12\t\n\x05MONTH\x10\x05\x12\x08\n\x04YEAR\x10\x06*\x7f\n\x18\x43oncurrencyLimitStrategy\x12\x16\n\x12\x43\x41NCEL_IN_PROGRESS\x10\x00\x12\x0f\n\x0b\x44ROP_NEWEST\x10\x01\x12\x10\n\x0cQUEUE_NEWEST\x10\x02\x12\x15\n\x11GROUP_ROUND_ROBIN\x10\x03\x12\x11\n\rCANCEL_NEWEST\x10\x04*\x85\x01\n\x15WorkerLabelComparator\x12\t\n\x05\x45QUAL\x10\x00\x12\r\n\tNOT_EQUAL\x10\x01\x12\x10\n\x0cGREATER_THAN\x10\x02\x12\x19\n\x15GREATER_THAN_OR_EQUAL\x10\x03\x12\r\n\tLESS_THAN\x10\x04\x12\x16\n\x12LESS_THAN_OR_EQUAL\x10\x05\x32\xb7\x02\n\x0c\x41\x64minService\x12R\n\x0bPutWorkflow\x12 .v1.CreateWorkflowVersionRequest\x1a!.v1.CreateWorkflowVersionResponse\x12>\n\x0b\x43\x61ncelTasks\x12\x16.v1.CancelTasksRequest\x1a\x17.v1.CancelTasksResponse\x12>\n\x0bReplayTasks\x12\x16.v1.ReplayTasksRequest\x1a\x17.v1.ReplayTasksResponse\x12S\n\x12TriggerWorkflowRun\x12\x1d.v1.TriggerWorkflowRunRequest\x1a\x1e.v1.TriggerWorkflowRunResponseBBZ@github.com/hatchet-dev/hatchet/internal/services/shared/proto/v1b\x06proto3')
|
|
20
20
|
|
|
21
21
|
_globals = globals()
|
|
22
22
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
@@ -26,14 +26,14 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
26
26
|
_globals['DESCRIPTOR']._serialized_options = b'Z@github.com/hatchet-dev/hatchet/internal/services/shared/proto/v1'
|
|
27
27
|
_globals['_CREATETASKOPTS_WORKERLABELSENTRY']._loaded_options = None
|
|
28
28
|
_globals['_CREATETASKOPTS_WORKERLABELSENTRY']._serialized_options = b'8\001'
|
|
29
|
-
_globals['_STICKYSTRATEGY']._serialized_start=
|
|
30
|
-
_globals['_STICKYSTRATEGY']._serialized_end=
|
|
31
|
-
_globals['_RATELIMITDURATION']._serialized_start=
|
|
32
|
-
_globals['_RATELIMITDURATION']._serialized_end=
|
|
33
|
-
_globals['_CONCURRENCYLIMITSTRATEGY']._serialized_start=
|
|
34
|
-
_globals['_CONCURRENCYLIMITSTRATEGY']._serialized_end=
|
|
35
|
-
_globals['_WORKERLABELCOMPARATOR']._serialized_start=
|
|
36
|
-
_globals['_WORKERLABELCOMPARATOR']._serialized_end=
|
|
29
|
+
_globals['_STICKYSTRATEGY']._serialized_start=2593
|
|
30
|
+
_globals['_STICKYSTRATEGY']._serialized_end=2629
|
|
31
|
+
_globals['_RATELIMITDURATION']._serialized_start=2631
|
|
32
|
+
_globals['_RATELIMITDURATION']._serialized_end=2724
|
|
33
|
+
_globals['_CONCURRENCYLIMITSTRATEGY']._serialized_start=2726
|
|
34
|
+
_globals['_CONCURRENCYLIMITSTRATEGY']._serialized_end=2853
|
|
35
|
+
_globals['_WORKERLABELCOMPARATOR']._serialized_start=2856
|
|
36
|
+
_globals['_WORKERLABELCOMPARATOR']._serialized_end=2989
|
|
37
37
|
_globals['_CANCELTASKSREQUEST']._serialized_start=86
|
|
38
38
|
_globals['_CANCELTASKSREQUEST']._serialized_end=176
|
|
39
39
|
_globals['_REPLAYTASKSREQUEST']._serialized_start=178
|
|
@@ -49,19 +49,21 @@ if not _descriptor._USE_C_DESCRIPTORS:
|
|
|
49
49
|
_globals['_TRIGGERWORKFLOWRUNRESPONSE']._serialized_start=684
|
|
50
50
|
_globals['_TRIGGERWORKFLOWRUNRESPONSE']._serialized_end=733
|
|
51
51
|
_globals['_CREATEWORKFLOWVERSIONREQUEST']._serialized_start=736
|
|
52
|
-
_globals['_CREATEWORKFLOWVERSIONREQUEST']._serialized_end=
|
|
53
|
-
_globals['
|
|
54
|
-
_globals['
|
|
55
|
-
_globals['
|
|
56
|
-
_globals['
|
|
57
|
-
_globals['
|
|
58
|
-
_globals['
|
|
59
|
-
_globals['
|
|
60
|
-
_globals['
|
|
61
|
-
_globals['
|
|
62
|
-
_globals['
|
|
63
|
-
_globals['
|
|
64
|
-
_globals['
|
|
65
|
-
_globals['
|
|
66
|
-
_globals['
|
|
52
|
+
_globals['_CREATEWORKFLOWVERSIONREQUEST']._serialized_end=1238
|
|
53
|
+
_globals['_DEFAULTFILTER']._serialized_start=1240
|
|
54
|
+
_globals['_DEFAULTFILTER']._serialized_end=1324
|
|
55
|
+
_globals['_CONCURRENCY']._serialized_start=1327
|
|
56
|
+
_globals['_CONCURRENCY']._serialized_end=1474
|
|
57
|
+
_globals['_DESIREDWORKERLABELS']._serialized_start=1477
|
|
58
|
+
_globals['_DESIREDWORKERLABELS']._serialized_end=1705
|
|
59
|
+
_globals['_CREATETASKOPTS']._serialized_start=1708
|
|
60
|
+
_globals['_CREATETASKOPTS']._serialized_end=2269
|
|
61
|
+
_globals['_CREATETASKOPTS_WORKERLABELSENTRY']._serialized_start=2114
|
|
62
|
+
_globals['_CREATETASKOPTS_WORKERLABELSENTRY']._serialized_end=2190
|
|
63
|
+
_globals['_CREATETASKRATELIMIT']._serialized_start=2272
|
|
64
|
+
_globals['_CREATETASKRATELIMIT']._serialized_end=2525
|
|
65
|
+
_globals['_CREATEWORKFLOWVERSIONRESPONSE']._serialized_start=2527
|
|
66
|
+
_globals['_CREATEWORKFLOWVERSIONRESPONSE']._serialized_end=2591
|
|
67
|
+
_globals['_ADMINSERVICE']._serialized_start=2992
|
|
68
|
+
_globals['_ADMINSERVICE']._serialized_end=3303
|
|
67
69
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -121,7 +121,7 @@ class TriggerWorkflowRunResponse(_message.Message):
|
|
|
121
121
|
def __init__(self, external_id: _Optional[str] = ...) -> None: ...
|
|
122
122
|
|
|
123
123
|
class CreateWorkflowVersionRequest(_message.Message):
|
|
124
|
-
__slots__ = ("name", "description", "version", "event_triggers", "cron_triggers", "tasks", "concurrency", "cron_input", "on_failure_task", "sticky", "default_priority", "concurrency_arr")
|
|
124
|
+
__slots__ = ("name", "description", "version", "event_triggers", "cron_triggers", "tasks", "concurrency", "cron_input", "on_failure_task", "sticky", "default_priority", "concurrency_arr", "default_filters")
|
|
125
125
|
NAME_FIELD_NUMBER: _ClassVar[int]
|
|
126
126
|
DESCRIPTION_FIELD_NUMBER: _ClassVar[int]
|
|
127
127
|
VERSION_FIELD_NUMBER: _ClassVar[int]
|
|
@@ -134,6 +134,7 @@ class CreateWorkflowVersionRequest(_message.Message):
|
|
|
134
134
|
STICKY_FIELD_NUMBER: _ClassVar[int]
|
|
135
135
|
DEFAULT_PRIORITY_FIELD_NUMBER: _ClassVar[int]
|
|
136
136
|
CONCURRENCY_ARR_FIELD_NUMBER: _ClassVar[int]
|
|
137
|
+
DEFAULT_FILTERS_FIELD_NUMBER: _ClassVar[int]
|
|
137
138
|
name: str
|
|
138
139
|
description: str
|
|
139
140
|
version: str
|
|
@@ -146,7 +147,18 @@ class CreateWorkflowVersionRequest(_message.Message):
|
|
|
146
147
|
sticky: StickyStrategy
|
|
147
148
|
default_priority: int
|
|
148
149
|
concurrency_arr: _containers.RepeatedCompositeFieldContainer[Concurrency]
|
|
149
|
-
|
|
150
|
+
default_filters: _containers.RepeatedCompositeFieldContainer[DefaultFilter]
|
|
151
|
+
def __init__(self, name: _Optional[str] = ..., description: _Optional[str] = ..., version: _Optional[str] = ..., event_triggers: _Optional[_Iterable[str]] = ..., cron_triggers: _Optional[_Iterable[str]] = ..., tasks: _Optional[_Iterable[_Union[CreateTaskOpts, _Mapping]]] = ..., concurrency: _Optional[_Union[Concurrency, _Mapping]] = ..., cron_input: _Optional[str] = ..., on_failure_task: _Optional[_Union[CreateTaskOpts, _Mapping]] = ..., sticky: _Optional[_Union[StickyStrategy, str]] = ..., default_priority: _Optional[int] = ..., concurrency_arr: _Optional[_Iterable[_Union[Concurrency, _Mapping]]] = ..., default_filters: _Optional[_Iterable[_Union[DefaultFilter, _Mapping]]] = ...) -> None: ...
|
|
152
|
+
|
|
153
|
+
class DefaultFilter(_message.Message):
|
|
154
|
+
__slots__ = ("expression", "scope", "payload")
|
|
155
|
+
EXPRESSION_FIELD_NUMBER: _ClassVar[int]
|
|
156
|
+
SCOPE_FIELD_NUMBER: _ClassVar[int]
|
|
157
|
+
PAYLOAD_FIELD_NUMBER: _ClassVar[int]
|
|
158
|
+
expression: str
|
|
159
|
+
scope: str
|
|
160
|
+
payload: str
|
|
161
|
+
def __init__(self, expression: _Optional[str] = ..., scope: _Optional[str] = ..., payload: _Optional[str] = ...) -> None: ...
|
|
150
162
|
|
|
151
163
|
class Concurrency(_message.Message):
|
|
152
164
|
__slots__ = ("expression", "max_runs", "limit_strategy")
|
hatchet_sdk/features/filters.py
CHANGED
|
@@ -7,6 +7,9 @@ from hatchet_sdk.clients.rest.models.v1_create_filter_request import (
|
|
|
7
7
|
)
|
|
8
8
|
from hatchet_sdk.clients.rest.models.v1_filter import V1Filter
|
|
9
9
|
from hatchet_sdk.clients.rest.models.v1_filter_list import V1FilterList
|
|
10
|
+
from hatchet_sdk.clients.rest.models.v1_update_filter_request import (
|
|
11
|
+
V1UpdateFilterRequest,
|
|
12
|
+
)
|
|
10
13
|
from hatchet_sdk.clients.v1.api_client import BaseRestClient
|
|
11
14
|
from hatchet_sdk.utils.typing import JSONSerializableMapping
|
|
12
15
|
|
|
@@ -179,3 +182,36 @@ class FiltersClient(BaseRestClient):
|
|
|
179
182
|
:return: The deleted filter.
|
|
180
183
|
"""
|
|
181
184
|
return await asyncio.to_thread(self.delete, filter_id)
|
|
185
|
+
|
|
186
|
+
def update(
|
|
187
|
+
self,
|
|
188
|
+
filter_id: str,
|
|
189
|
+
updates: V1UpdateFilterRequest,
|
|
190
|
+
) -> V1Filter:
|
|
191
|
+
"""
|
|
192
|
+
Update a filter by its ID.
|
|
193
|
+
|
|
194
|
+
:param filter_id: The ID of the filter to delete.
|
|
195
|
+
:param updates: The updates to apply to the filter.
|
|
196
|
+
:return: The updated filter.
|
|
197
|
+
"""
|
|
198
|
+
with self.client() as client:
|
|
199
|
+
return self._fa(client).v1_filter_update(
|
|
200
|
+
tenant=self.tenant_id,
|
|
201
|
+
v1_filter=filter_id,
|
|
202
|
+
v1_update_filter_request=updates,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
async def aio_update(
|
|
206
|
+
self,
|
|
207
|
+
filter_id: str,
|
|
208
|
+
updates: V1UpdateFilterRequest,
|
|
209
|
+
) -> V1Filter:
|
|
210
|
+
"""
|
|
211
|
+
Update a filter by its ID.
|
|
212
|
+
|
|
213
|
+
:param filter_id: The ID of the filter to delete.
|
|
214
|
+
:param updates: The updates to apply to the filter.
|
|
215
|
+
:return: The updated filter.
|
|
216
|
+
"""
|
|
217
|
+
return await asyncio.to_thread(self.update, filter_id, updates)
|
hatchet_sdk/features/runs.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import asyncio
|
|
2
|
-
from datetime import datetime, timedelta
|
|
2
|
+
from datetime import datetime, timedelta, timezone
|
|
3
3
|
from typing import TYPE_CHECKING, Literal, overload
|
|
4
4
|
|
|
5
5
|
from pydantic import BaseModel, model_validator
|
|
@@ -129,6 +129,25 @@ class RunsClient(BaseRestClient):
|
|
|
129
129
|
"""
|
|
130
130
|
return await asyncio.to_thread(self.get, workflow_run_id)
|
|
131
131
|
|
|
132
|
+
def get_status(self, workflow_run_id: str) -> V1TaskStatus:
|
|
133
|
+
"""
|
|
134
|
+
Get workflow run status for a given workflow run ID.
|
|
135
|
+
|
|
136
|
+
:param workflow_run_id: The ID of the workflow run to retrieve details for.
|
|
137
|
+
:return: The task status
|
|
138
|
+
"""
|
|
139
|
+
with self.client() as client:
|
|
140
|
+
return self._wra(client).v1_workflow_run_get_status(str(workflow_run_id))
|
|
141
|
+
|
|
142
|
+
async def aio_get_status(self, workflow_run_id: str) -> V1TaskStatus:
|
|
143
|
+
"""
|
|
144
|
+
Get workflow run status for a given workflow run ID.
|
|
145
|
+
|
|
146
|
+
:param workflow_run_id: The ID of the workflow run to retrieve details for.
|
|
147
|
+
:return: The task status
|
|
148
|
+
"""
|
|
149
|
+
return await asyncio.to_thread(self.get_status, workflow_run_id)
|
|
150
|
+
|
|
132
151
|
async def aio_list(
|
|
133
152
|
self,
|
|
134
153
|
since: datetime | None = None,
|
|
@@ -162,7 +181,7 @@ class RunsClient(BaseRestClient):
|
|
|
162
181
|
"""
|
|
163
182
|
return await asyncio.to_thread(
|
|
164
183
|
self.list,
|
|
165
|
-
since=since or datetime.now() - timedelta(days=1),
|
|
184
|
+
since=since or datetime.now(tz=timezone.utc) - timedelta(days=1),
|
|
166
185
|
only_tasks=only_tasks,
|
|
167
186
|
offset=offset,
|
|
168
187
|
limit=limit,
|
|
@@ -209,7 +228,7 @@ class RunsClient(BaseRestClient):
|
|
|
209
228
|
with self.client() as client:
|
|
210
229
|
return self._wra(client).v1_workflow_run_list(
|
|
211
230
|
tenant=self.client_config.tenant_id,
|
|
212
|
-
since=since or datetime.now() - timedelta(days=1),
|
|
231
|
+
since=since or datetime.now(tz=timezone.utc) - timedelta(days=1),
|
|
213
232
|
only_tasks=only_tasks,
|
|
214
233
|
offset=offset,
|
|
215
234
|
limit=limit,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
|
|
3
|
+
from hatchet_sdk.clients.rest.api.tenant_api import TenantApi
|
|
4
|
+
from hatchet_sdk.clients.rest.api_client import ApiClient
|
|
5
|
+
from hatchet_sdk.clients.rest.models.tenant import Tenant
|
|
6
|
+
from hatchet_sdk.clients.v1.api_client import BaseRestClient
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TenantClient(BaseRestClient):
|
|
10
|
+
"""
|
|
11
|
+
The tenant client is a client for interacting with your Tenant.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
def _ta(self, client: ApiClient) -> TenantApi:
|
|
15
|
+
return TenantApi(client)
|
|
16
|
+
|
|
17
|
+
def get(self) -> Tenant:
|
|
18
|
+
"""
|
|
19
|
+
Get the current tenant.
|
|
20
|
+
|
|
21
|
+
:return: The tenant.
|
|
22
|
+
"""
|
|
23
|
+
with self.client() as client:
|
|
24
|
+
return self._ta(client).tenant_get(self.client_config.tenant_id)
|
|
25
|
+
|
|
26
|
+
async def aio_get(self) -> Tenant:
|
|
27
|
+
"""
|
|
28
|
+
Get the current tenant.
|
|
29
|
+
|
|
30
|
+
:return: The tenant.
|
|
31
|
+
"""
|
|
32
|
+
return await asyncio.to_thread(self.get)
|