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

Files changed (42) hide show
  1. hatchet_sdk/client.py +2 -0
  2. hatchet_sdk/clients/admin.py +2 -6
  3. hatchet_sdk/clients/dispatcher/action_listener.py +20 -1
  4. hatchet_sdk/clients/events.py +58 -8
  5. hatchet_sdk/clients/rest/__init__.py +11 -0
  6. hatchet_sdk/clients/rest/api/__init__.py +1 -0
  7. hatchet_sdk/clients/rest/api/event_api.py +335 -0
  8. hatchet_sdk/clients/rest/api/filter_api.py +1305 -0
  9. hatchet_sdk/clients/rest/api/task_api.py +51 -0
  10. hatchet_sdk/clients/rest/api/workflow_runs_api.py +34 -0
  11. hatchet_sdk/clients/rest/models/__init__.py +10 -0
  12. hatchet_sdk/clients/rest/models/create_event_request.py +16 -2
  13. hatchet_sdk/clients/rest/models/v1_create_filter_request.py +99 -0
  14. hatchet_sdk/clients/rest/models/v1_event.py +142 -0
  15. hatchet_sdk/clients/rest/models/v1_event_list.py +110 -0
  16. hatchet_sdk/clients/rest/models/v1_event_workflow_run_summary.py +101 -0
  17. hatchet_sdk/clients/rest/models/v1_filter.py +127 -0
  18. hatchet_sdk/clients/rest/models/v1_filter_list.py +110 -0
  19. hatchet_sdk/clients/rest/models/v1_log_line.py +21 -2
  20. hatchet_sdk/clients/rest/models/v1_task_event.py +12 -0
  21. hatchet_sdk/clients/rest/models/v1_task_summary.py +12 -0
  22. hatchet_sdk/clients/rest/models/v1_task_timing.py +19 -0
  23. hatchet_sdk/clients/rest/models/workflow.py +5 -0
  24. hatchet_sdk/config.py +29 -0
  25. hatchet_sdk/context/context.py +9 -0
  26. hatchet_sdk/contracts/dispatcher_pb2.py +56 -56
  27. hatchet_sdk/contracts/dispatcher_pb2.pyi +6 -2
  28. hatchet_sdk/contracts/events_pb2.py +20 -20
  29. hatchet_sdk/contracts/events_pb2.pyi +14 -6
  30. hatchet_sdk/features/cron.py +1 -1
  31. hatchet_sdk/features/filters.py +181 -0
  32. hatchet_sdk/features/runs.py +7 -1
  33. hatchet_sdk/features/scheduled.py +1 -1
  34. hatchet_sdk/features/workflows.py +1 -1
  35. hatchet_sdk/hatchet.py +82 -71
  36. hatchet_sdk/runnables/standalone.py +6 -0
  37. hatchet_sdk/runnables/workflow.py +29 -2
  38. hatchet_sdk/worker/worker.py +1 -1
  39. {hatchet_sdk-1.9.0.dist-info → hatchet_sdk-1.10.0.dist-info}/METADATA +1 -1
  40. {hatchet_sdk-1.9.0.dist-info → hatchet_sdk-1.10.0.dist-info}/RECORD +42 -34
  41. {hatchet_sdk-1.9.0.dist-info → hatchet_sdk-1.10.0.dist-info}/WHEEL +0 -0
  42. {hatchet_sdk-1.9.0.dist-info → hatchet_sdk-1.10.0.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,110 @@
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
23
+ from typing_extensions import Self
24
+
25
+ from hatchet_sdk.clients.rest.models.pagination_response import PaginationResponse
26
+ from hatchet_sdk.clients.rest.models.v1_event import V1Event
27
+
28
+
29
+ class V1EventList(BaseModel):
30
+ """
31
+ V1EventList
32
+ """ # noqa: E501
33
+
34
+ pagination: Optional[PaginationResponse] = None
35
+ rows: Optional[List[V1Event]] = None
36
+ __properties: ClassVar[List[str]] = ["pagination", "rows"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of V1EventList from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of pagination
76
+ if self.pagination:
77
+ _dict["pagination"] = self.pagination.to_dict()
78
+ # override the default output from pydantic by calling `to_dict()` of each item in rows (list)
79
+ _items = []
80
+ if self.rows:
81
+ for _item_rows in self.rows:
82
+ if _item_rows:
83
+ _items.append(_item_rows.to_dict())
84
+ _dict["rows"] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of V1EventList from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate(
97
+ {
98
+ "pagination": (
99
+ PaginationResponse.from_dict(obj["pagination"])
100
+ if obj.get("pagination") is not None
101
+ else None
102
+ ),
103
+ "rows": (
104
+ [V1Event.from_dict(_item) for _item in obj["rows"]]
105
+ if obj.get("rows") is not None
106
+ else None
107
+ ),
108
+ }
109
+ )
110
+ return _obj
@@ -0,0 +1,101 @@
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, StrictInt
23
+ from typing_extensions import Self
24
+
25
+
26
+ class V1EventWorkflowRunSummary(BaseModel):
27
+ """
28
+ V1EventWorkflowRunSummary
29
+ """ # noqa: E501
30
+
31
+ running: StrictInt = Field(description="The number of running runs.")
32
+ queued: StrictInt = Field(description="The number of queued runs.")
33
+ succeeded: StrictInt = Field(description="The number of succeeded runs.")
34
+ failed: StrictInt = Field(description="The number of failed runs.")
35
+ cancelled: StrictInt = Field(description="The number of cancelled runs.")
36
+ __properties: ClassVar[List[str]] = [
37
+ "running",
38
+ "queued",
39
+ "succeeded",
40
+ "failed",
41
+ "cancelled",
42
+ ]
43
+
44
+ model_config = ConfigDict(
45
+ populate_by_name=True,
46
+ validate_assignment=True,
47
+ protected_namespaces=(),
48
+ )
49
+
50
+ def to_str(self) -> str:
51
+ """Returns the string representation of the model using alias"""
52
+ return pprint.pformat(self.model_dump(by_alias=True))
53
+
54
+ def to_json(self) -> str:
55
+ """Returns the JSON representation of the model using alias"""
56
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
57
+ return json.dumps(self.to_dict())
58
+
59
+ @classmethod
60
+ def from_json(cls, json_str: str) -> Optional[Self]:
61
+ """Create an instance of V1EventWorkflowRunSummary from a JSON string"""
62
+ return cls.from_dict(json.loads(json_str))
63
+
64
+ def to_dict(self) -> Dict[str, Any]:
65
+ """Return the dictionary representation of the model using alias.
66
+
67
+ This has the following differences from calling pydantic's
68
+ `self.model_dump(by_alias=True)`:
69
+
70
+ * `None` is only added to the output dict for nullable fields that
71
+ were set at model initialization. Other fields with value `None`
72
+ are ignored.
73
+ """
74
+ excluded_fields: Set[str] = set([])
75
+
76
+ _dict = self.model_dump(
77
+ by_alias=True,
78
+ exclude=excluded_fields,
79
+ exclude_none=True,
80
+ )
81
+ return _dict
82
+
83
+ @classmethod
84
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
85
+ """Create an instance of V1EventWorkflowRunSummary from a dict"""
86
+ if obj is None:
87
+ return None
88
+
89
+ if not isinstance(obj, dict):
90
+ return cls.model_validate(obj)
91
+
92
+ _obj = cls.model_validate(
93
+ {
94
+ "running": obj.get("running"),
95
+ "queued": obj.get("queued"),
96
+ "succeeded": obj.get("succeeded"),
97
+ "failed": obj.get("failed"),
98
+ "cancelled": obj.get("cancelled"),
99
+ }
100
+ )
101
+ return _obj
@@ -0,0 +1,127 @@
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 Annotated, Self
24
+
25
+ from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta
26
+
27
+
28
+ class V1Filter(BaseModel):
29
+ """
30
+ V1Filter
31
+ """ # noqa: E501
32
+
33
+ metadata: APIResourceMeta
34
+ tenant_id: StrictStr = Field(
35
+ description="The ID of the tenant associated with this filter.",
36
+ alias="tenantId",
37
+ )
38
+ workflow_id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = (
39
+ Field(
40
+ description="The workflow id associated with this filter.",
41
+ alias="workflowId",
42
+ )
43
+ )
44
+ scope: StrictStr = Field(
45
+ description="The scope associated with this filter. Used for subsetting candidate filters at evaluation time"
46
+ )
47
+ expression: StrictStr = Field(
48
+ description="The expression associated with this filter."
49
+ )
50
+ payload: Dict[str, Any] = Field(
51
+ description="Additional payload data associated with the filter"
52
+ )
53
+ __properties: ClassVar[List[str]] = [
54
+ "metadata",
55
+ "tenantId",
56
+ "workflowId",
57
+ "scope",
58
+ "expression",
59
+ "payload",
60
+ ]
61
+
62
+ model_config = ConfigDict(
63
+ populate_by_name=True,
64
+ validate_assignment=True,
65
+ protected_namespaces=(),
66
+ )
67
+
68
+ def to_str(self) -> str:
69
+ """Returns the string representation of the model using alias"""
70
+ return pprint.pformat(self.model_dump(by_alias=True))
71
+
72
+ def to_json(self) -> str:
73
+ """Returns the JSON representation of the model using alias"""
74
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
75
+ return json.dumps(self.to_dict())
76
+
77
+ @classmethod
78
+ def from_json(cls, json_str: str) -> Optional[Self]:
79
+ """Create an instance of V1Filter from a JSON string"""
80
+ return cls.from_dict(json.loads(json_str))
81
+
82
+ def to_dict(self) -> Dict[str, Any]:
83
+ """Return the dictionary representation of the model using alias.
84
+
85
+ This has the following differences from calling pydantic's
86
+ `self.model_dump(by_alias=True)`:
87
+
88
+ * `None` is only added to the output dict for nullable fields that
89
+ were set at model initialization. Other fields with value `None`
90
+ are ignored.
91
+ """
92
+ excluded_fields: Set[str] = set([])
93
+
94
+ _dict = self.model_dump(
95
+ by_alias=True,
96
+ exclude=excluded_fields,
97
+ exclude_none=True,
98
+ )
99
+ # override the default output from pydantic by calling `to_dict()` of metadata
100
+ if self.metadata:
101
+ _dict["metadata"] = self.metadata.to_dict()
102
+ return _dict
103
+
104
+ @classmethod
105
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
106
+ """Create an instance of V1Filter from a dict"""
107
+ if obj is None:
108
+ return None
109
+
110
+ if not isinstance(obj, dict):
111
+ return cls.model_validate(obj)
112
+
113
+ _obj = cls.model_validate(
114
+ {
115
+ "metadata": (
116
+ APIResourceMeta.from_dict(obj["metadata"])
117
+ if obj.get("metadata") is not None
118
+ else None
119
+ ),
120
+ "tenantId": obj.get("tenantId"),
121
+ "workflowId": obj.get("workflowId"),
122
+ "scope": obj.get("scope"),
123
+ "expression": obj.get("expression"),
124
+ "payload": obj.get("payload"),
125
+ }
126
+ )
127
+ return _obj
@@ -0,0 +1,110 @@
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
23
+ from typing_extensions import Self
24
+
25
+ from hatchet_sdk.clients.rest.models.pagination_response import PaginationResponse
26
+ from hatchet_sdk.clients.rest.models.v1_filter import V1Filter
27
+
28
+
29
+ class V1FilterList(BaseModel):
30
+ """
31
+ V1FilterList
32
+ """ # noqa: E501
33
+
34
+ pagination: Optional[PaginationResponse] = None
35
+ rows: Optional[List[V1Filter]] = None
36
+ __properties: ClassVar[List[str]] = ["pagination", "rows"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of V1FilterList from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of pagination
76
+ if self.pagination:
77
+ _dict["pagination"] = self.pagination.to_dict()
78
+ # override the default output from pydantic by calling `to_dict()` of each item in rows (list)
79
+ _items = []
80
+ if self.rows:
81
+ for _item_rows in self.rows:
82
+ if _item_rows:
83
+ _items.append(_item_rows.to_dict())
84
+ _dict["rows"] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of V1FilterList from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate(
97
+ {
98
+ "pagination": (
99
+ PaginationResponse.from_dict(obj["pagination"])
100
+ if obj.get("pagination") is not None
101
+ else None
102
+ ),
103
+ "rows": (
104
+ [V1Filter.from_dict(_item) for _item in obj["rows"]]
105
+ if obj.get("rows") is not None
106
+ else None
107
+ ),
108
+ }
109
+ )
110
+ return _obj
@@ -20,9 +20,11 @@ import re # noqa: F401
20
20
  from datetime import datetime
21
21
  from typing import Any, ClassVar, Dict, List, Optional, Set
22
22
 
23
- from pydantic import BaseModel, ConfigDict, Field, StrictStr
23
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
24
24
  from typing_extensions import Self
25
25
 
26
+ from hatchet_sdk.clients.rest.models.v1_log_line_level import V1LogLineLevel
27
+
26
28
 
27
29
  class V1LogLine(BaseModel):
28
30
  """
@@ -34,7 +36,21 @@ class V1LogLine(BaseModel):
34
36
  )
35
37
  message: StrictStr = Field(description="The log message.")
36
38
  metadata: Dict[str, Any] = Field(description="The log metadata.")
37
- __properties: ClassVar[List[str]] = ["createdAt", "message", "metadata"]
39
+ retry_count: Optional[StrictInt] = Field(
40
+ default=None, description="The retry count of the log line.", alias="retryCount"
41
+ )
42
+ attempt: Optional[StrictInt] = Field(
43
+ default=None, description="The attempt number of the log line."
44
+ )
45
+ level: Optional[V1LogLineLevel] = Field(default=None, description="The log level.")
46
+ __properties: ClassVar[List[str]] = [
47
+ "createdAt",
48
+ "message",
49
+ "metadata",
50
+ "retryCount",
51
+ "attempt",
52
+ "level",
53
+ ]
38
54
 
39
55
  model_config = ConfigDict(
40
56
  populate_by_name=True,
@@ -89,6 +105,9 @@ class V1LogLine(BaseModel):
89
105
  "createdAt": obj.get("createdAt"),
90
106
  "message": obj.get("message"),
91
107
  "metadata": obj.get("metadata"),
108
+ "retryCount": obj.get("retryCount"),
109
+ "attempt": obj.get("attempt"),
110
+ "level": obj.get("level"),
92
111
  }
93
112
  )
94
113
  return _obj
@@ -42,6 +42,14 @@ class V1TaskEvent(BaseModel):
42
42
  task_display_name: Optional[StrictStr] = Field(
43
43
  default=None, alias="taskDisplayName"
44
44
  )
45
+ retry_count: Optional[StrictInt] = Field(
46
+ default=None,
47
+ description="The number of retries of the task.",
48
+ alias="retryCount",
49
+ )
50
+ attempt: Optional[StrictInt] = Field(
51
+ default=None, description="The attempt number of the task."
52
+ )
45
53
  __properties: ClassVar[List[str]] = [
46
54
  "id",
47
55
  "taskId",
@@ -52,6 +60,8 @@ class V1TaskEvent(BaseModel):
52
60
  "output",
53
61
  "workerId",
54
62
  "taskDisplayName",
63
+ "retryCount",
64
+ "attempt",
55
65
  ]
56
66
 
57
67
  model_config = ConfigDict(
@@ -113,6 +123,8 @@ class V1TaskEvent(BaseModel):
113
123
  "output": obj.get("output"),
114
124
  "workerId": obj.get("workerId"),
115
125
  "taskDisplayName": obj.get("taskDisplayName"),
126
+ "retryCount": obj.get("retryCount"),
127
+ "attempt": obj.get("attempt"),
116
128
  }
117
129
  )
118
130
  return _obj
@@ -37,6 +37,14 @@ class V1TaskSummary(BaseModel):
37
37
  action_id: Optional[StrictStr] = Field(
38
38
  default=None, description="The action ID of the task.", alias="actionId"
39
39
  )
40
+ retry_count: Optional[StrictInt] = Field(
41
+ default=None,
42
+ description="The number of retries of the task.",
43
+ alias="retryCount",
44
+ )
45
+ attempt: Optional[StrictInt] = Field(
46
+ default=None, description="The attempt number of the task."
47
+ )
40
48
  additional_metadata: Optional[Dict[str, Any]] = Field(
41
49
  default=None,
42
50
  description="Additional metadata for the task run.",
@@ -106,6 +114,8 @@ class V1TaskSummary(BaseModel):
106
114
  __properties: ClassVar[List[str]] = [
107
115
  "metadata",
108
116
  "actionId",
117
+ "retryCount",
118
+ "attempt",
109
119
  "additionalMetadata",
110
120
  "children",
111
121
  "createdAt",
@@ -196,6 +206,8 @@ class V1TaskSummary(BaseModel):
196
206
  else None
197
207
  ),
198
208
  "actionId": obj.get("actionId"),
209
+ "retryCount": obj.get("retryCount"),
210
+ "attempt": obj.get("attempt"),
199
211
  "additionalMetadata": obj.get("additionalMetadata"),
200
212
  "children": (
201
213
  [V1TaskSummary.from_dict(_item) for _item in obj["children"]]
@@ -70,6 +70,19 @@ class V1TaskTiming(BaseModel):
70
70
  description="The timestamp the task run finished.",
71
71
  alias="finishedAt",
72
72
  )
73
+ workflow_run_id: Optional[StrictStr] = Field(
74
+ default=None,
75
+ description="The external ID of the workflow run.",
76
+ alias="workflowRunId",
77
+ )
78
+ retry_count: Optional[StrictInt] = Field(
79
+ default=None,
80
+ description="The number of retries of the task.",
81
+ alias="retryCount",
82
+ )
83
+ attempt: Optional[StrictInt] = Field(
84
+ default=None, description="The attempt number of the task."
85
+ )
73
86
  __properties: ClassVar[List[str]] = [
74
87
  "metadata",
75
88
  "depth",
@@ -83,6 +96,9 @@ class V1TaskTiming(BaseModel):
83
96
  "queuedAt",
84
97
  "startedAt",
85
98
  "finishedAt",
99
+ "workflowRunId",
100
+ "retryCount",
101
+ "attempt",
86
102
  ]
87
103
 
88
104
  model_config = ConfigDict(
@@ -154,6 +170,9 @@ class V1TaskTiming(BaseModel):
154
170
  "queuedAt": obj.get("queuedAt"),
155
171
  "startedAt": obj.get("startedAt"),
156
172
  "finishedAt": obj.get("finishedAt"),
173
+ "workflowRunId": obj.get("workflowRunId"),
174
+ "retryCount": obj.get("retryCount"),
175
+ "attempt": obj.get("attempt"),
157
176
  }
158
177
  )
159
178
  return _obj
@@ -47,6 +47,9 @@ class Workflow(BaseModel):
47
47
  jobs: Optional[List[Job]] = Field(
48
48
  default=None, description="The jobs of the workflow."
49
49
  )
50
+ tenant_id: StrictStr = Field(
51
+ description="The tenant id of the workflow.", alias="tenantId"
52
+ )
50
53
  __properties: ClassVar[List[str]] = [
51
54
  "metadata",
52
55
  "name",
@@ -55,6 +58,7 @@ class Workflow(BaseModel):
55
58
  "versions",
56
59
  "tags",
57
60
  "jobs",
61
+ "tenantId",
58
62
  ]
59
63
 
60
64
  model_config = ConfigDict(
@@ -154,6 +158,7 @@ class Workflow(BaseModel):
154
158
  if obj.get("jobs") is not None
155
159
  else None
156
160
  ),
161
+ "tenantId": obj.get("tenantId"),
157
162
  }
158
163
  )
159
164
  return _obj
hatchet_sdk/config.py CHANGED
@@ -1,5 +1,6 @@
1
1
  import json
2
2
  from logging import Logger, getLogger
3
+ from typing import overload
3
4
 
4
5
  from pydantic import Field, field_validator, model_validator
5
6
  from pydantic_settings import BaseSettings, SettingsConfigDict
@@ -121,9 +122,37 @@ class ClientConfig(BaseSettings):
121
122
  def validate_namespace(cls, namespace: str) -> str:
122
123
  if not namespace:
123
124
  return ""
125
+
124
126
  if not namespace.endswith("_"):
125
127
  namespace = f"{namespace}_"
128
+
126
129
  return namespace.lower()
127
130
 
128
131
  def __hash__(self) -> int:
129
132
  return hash(json.dumps(self.model_dump(), default=str))
133
+
134
+ @overload
135
+ def apply_namespace(
136
+ self, resource_name: str, namespace_override: str | None = None
137
+ ) -> str: ...
138
+
139
+ @overload
140
+ def apply_namespace(
141
+ self, resource_name: None, namespace_override: str | None = None
142
+ ) -> None: ...
143
+
144
+ def apply_namespace(
145
+ self, resource_name: str | None, namespace_override: str | None = None
146
+ ) -> str | None:
147
+ if resource_name is None:
148
+ return None
149
+
150
+ namespace = namespace_override or self.namespace
151
+
152
+ if not namespace:
153
+ return resource_name
154
+
155
+ if resource_name.startswith(namespace):
156
+ return resource_name
157
+
158
+ return namespace + resource_name
@@ -59,6 +59,7 @@ class Context:
59
59
  self.stream_event_thread_pool = ThreadPoolExecutor(max_workers=1)
60
60
 
61
61
  self.input = self.data.input
62
+ self.filter_payload = self.data.filter_payload
62
63
 
63
64
  self._lifespan_context = lifespan_context
64
65
 
@@ -222,6 +223,14 @@ class Context:
222
223
  def priority(self) -> int | None:
223
224
  return self.action.priority
224
225
 
226
+ @property
227
+ def workflow_id(self) -> str | None:
228
+ return self.action.workflow_id
229
+
230
+ @property
231
+ def workflow_version_id(self) -> str | None:
232
+ return self.action.workflow_version_id
233
+
225
234
  @property
226
235
  def task_run_errors(self) -> dict[str, str]:
227
236
  errors = self.data.step_run_errors