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

@@ -141,19 +141,6 @@ class AdminClient:
141
141
  priority=_options.priority,
142
142
  )
143
143
 
144
- def _prepare_put_workflow_request(
145
- self,
146
- name: str,
147
- workflow: workflow_protos.CreateWorkflowVersionRequest,
148
- overrides: workflow_protos.CreateWorkflowVersionRequest | None = None,
149
- ) -> workflow_protos.CreateWorkflowVersionRequest:
150
- if overrides is not None:
151
- workflow.MergeFrom(overrides)
152
-
153
- workflow.name = name
154
-
155
- return workflow
156
-
157
144
  def _parse_schedule(
158
145
  self, schedule: datetime | timestamp_pb2.Timestamp
159
146
  ) -> timestamp_pb2.Timestamp:
@@ -191,11 +178,9 @@ class AdminClient:
191
178
  @tenacity_retry
192
179
  async def aio_put_workflow(
193
180
  self,
194
- name: str,
195
181
  workflow: workflow_protos.CreateWorkflowVersionRequest,
196
- overrides: workflow_protos.CreateWorkflowVersionRequest | None = None,
197
182
  ) -> workflow_protos.CreateWorkflowVersionResponse:
198
- return await asyncio.to_thread(self.put_workflow, name, workflow, overrides)
183
+ return await asyncio.to_thread(self.put_workflow, workflow)
199
184
 
200
185
  @tenacity_retry
201
186
  async def aio_put_rate_limit(
@@ -221,12 +206,8 @@ class AdminClient:
221
206
  @tenacity_retry
222
207
  def put_workflow(
223
208
  self,
224
- name: str,
225
209
  workflow: workflow_protos.CreateWorkflowVersionRequest,
226
- overrides: workflow_protos.CreateWorkflowVersionRequest | None = None,
227
210
  ) -> workflow_protos.CreateWorkflowVersionResponse:
228
- opts = self._prepare_put_workflow_request(name, workflow, overrides)
229
-
230
211
  if self.client is None:
231
212
  conn = new_conn(self.config, False)
232
213
  self.client = AdminServiceStub(conn)
@@ -234,7 +215,7 @@ class AdminClient:
234
215
  return cast(
235
216
  workflow_protos.CreateWorkflowVersionResponse,
236
217
  self.client.PutWorkflow(
237
- opts,
218
+ workflow,
238
219
  metadata=get_metadata(self.token),
239
220
  ),
240
221
  )
@@ -324,6 +305,9 @@ class AdminClient:
324
305
  additional_metadata=options.additional_metadata,
325
306
  desired_worker_id=desired_worker_id,
326
307
  priority=options.priority,
308
+ namespace=options.namespace,
309
+ sticky=options.sticky,
310
+ key=options.key,
327
311
  )
328
312
 
329
313
  namespace = options.namespace or self.namespace
@@ -245,6 +245,8 @@ from hatchet_sdk.clients.rest.models.v1_task_run_status import V1TaskRunStatus
245
245
  from hatchet_sdk.clients.rest.models.v1_task_status import V1TaskStatus
246
246
  from hatchet_sdk.clients.rest.models.v1_task_summary import V1TaskSummary
247
247
  from hatchet_sdk.clients.rest.models.v1_task_summary_list import V1TaskSummaryList
248
+ from hatchet_sdk.clients.rest.models.v1_task_timing import V1TaskTiming
249
+ from hatchet_sdk.clients.rest.models.v1_task_timing_list import V1TaskTimingList
248
250
  from hatchet_sdk.clients.rest.models.v1_trigger_workflow_run_request import (
249
251
  V1TriggerWorkflowRunRequest,
250
252
  )
@@ -1555,6 +1555,9 @@ class TaskApi:
1555
1555
  since: Annotated[
1556
1556
  datetime, Field(description="The start time to get metrics for")
1557
1557
  ],
1558
+ until: Annotated[
1559
+ Optional[datetime], Field(description="The end time to get metrics for")
1560
+ ] = None,
1558
1561
  workflow_ids: Annotated[
1559
1562
  Optional[
1560
1563
  List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
@@ -1585,6 +1588,8 @@ class TaskApi:
1585
1588
  :type tenant: str
1586
1589
  :param since: The start time to get metrics for (required)
1587
1590
  :type since: datetime
1591
+ :param until: The end time to get metrics for
1592
+ :type until: datetime
1588
1593
  :param workflow_ids: The workflow id to find runs for
1589
1594
  :type workflow_ids: List[str]
1590
1595
  :param parent_task_external_id: The parent task's external id
@@ -1614,6 +1619,7 @@ class TaskApi:
1614
1619
  _param = self._v1_task_list_status_metrics_serialize(
1615
1620
  tenant=tenant,
1616
1621
  since=since,
1622
+ until=until,
1617
1623
  workflow_ids=workflow_ids,
1618
1624
  parent_task_external_id=parent_task_external_id,
1619
1625
  _request_auth=_request_auth,
@@ -1649,6 +1655,9 @@ class TaskApi:
1649
1655
  since: Annotated[
1650
1656
  datetime, Field(description="The start time to get metrics for")
1651
1657
  ],
1658
+ until: Annotated[
1659
+ Optional[datetime], Field(description="The end time to get metrics for")
1660
+ ] = None,
1652
1661
  workflow_ids: Annotated[
1653
1662
  Optional[
1654
1663
  List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
@@ -1679,6 +1688,8 @@ class TaskApi:
1679
1688
  :type tenant: str
1680
1689
  :param since: The start time to get metrics for (required)
1681
1690
  :type since: datetime
1691
+ :param until: The end time to get metrics for
1692
+ :type until: datetime
1682
1693
  :param workflow_ids: The workflow id to find runs for
1683
1694
  :type workflow_ids: List[str]
1684
1695
  :param parent_task_external_id: The parent task's external id
@@ -1708,6 +1719,7 @@ class TaskApi:
1708
1719
  _param = self._v1_task_list_status_metrics_serialize(
1709
1720
  tenant=tenant,
1710
1721
  since=since,
1722
+ until=until,
1711
1723
  workflow_ids=workflow_ids,
1712
1724
  parent_task_external_id=parent_task_external_id,
1713
1725
  _request_auth=_request_auth,
@@ -1743,6 +1755,9 @@ class TaskApi:
1743
1755
  since: Annotated[
1744
1756
  datetime, Field(description="The start time to get metrics for")
1745
1757
  ],
1758
+ until: Annotated[
1759
+ Optional[datetime], Field(description="The end time to get metrics for")
1760
+ ] = None,
1746
1761
  workflow_ids: Annotated[
1747
1762
  Optional[
1748
1763
  List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
@@ -1773,6 +1788,8 @@ class TaskApi:
1773
1788
  :type tenant: str
1774
1789
  :param since: The start time to get metrics for (required)
1775
1790
  :type since: datetime
1791
+ :param until: The end time to get metrics for
1792
+ :type until: datetime
1776
1793
  :param workflow_ids: The workflow id to find runs for
1777
1794
  :type workflow_ids: List[str]
1778
1795
  :param parent_task_external_id: The parent task's external id
@@ -1802,6 +1819,7 @@ class TaskApi:
1802
1819
  _param = self._v1_task_list_status_metrics_serialize(
1803
1820
  tenant=tenant,
1804
1821
  since=since,
1822
+ until=until,
1805
1823
  workflow_ids=workflow_ids,
1806
1824
  parent_task_external_id=parent_task_external_id,
1807
1825
  _request_auth=_request_auth,
@@ -1825,6 +1843,7 @@ class TaskApi:
1825
1843
  self,
1826
1844
  tenant,
1827
1845
  since,
1846
+ until,
1828
1847
  workflow_ids,
1829
1848
  parent_task_external_id,
1830
1849
  _request_auth,
@@ -1863,6 +1882,17 @@ class TaskApi:
1863
1882
  else:
1864
1883
  _query_params.append(("since", since))
1865
1884
 
1885
+ if until is not None:
1886
+ if isinstance(until, datetime):
1887
+ _query_params.append(
1888
+ (
1889
+ "until",
1890
+ until.strftime(self.api_client.configuration.datetime_format),
1891
+ )
1892
+ )
1893
+ else:
1894
+ _query_params.append(("until", until))
1895
+
1866
1896
  if workflow_ids is not None:
1867
1897
 
1868
1898
  _query_params.append(("workflow_ids", workflow_ids))
@@ -88,6 +88,12 @@ class WorkflowApi:
88
88
  Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]],
89
89
  Field(description="The workflow id to get runs for."),
90
90
  ] = None,
91
+ workflow_name: Annotated[
92
+ Optional[StrictStr], Field(description="The workflow name to get runs for.")
93
+ ] = None,
94
+ cron_name: Annotated[
95
+ Optional[StrictStr], Field(description="The cron name to get runs for.")
96
+ ] = None,
91
97
  additional_metadata: Annotated[
92
98
  Optional[List[StrictStr]],
93
99
  Field(description="A list of metadata key value pairs to filter by"),
@@ -123,6 +129,10 @@ class WorkflowApi:
123
129
  :type limit: int
124
130
  :param workflow_id: The workflow id to get runs for.
125
131
  :type workflow_id: str
132
+ :param workflow_name: The workflow name to get runs for.
133
+ :type workflow_name: str
134
+ :param cron_name: The cron name to get runs for.
135
+ :type cron_name: str
126
136
  :param additional_metadata: A list of metadata key value pairs to filter by
127
137
  :type additional_metadata: List[str]
128
138
  :param order_by_field: The order by field
@@ -156,6 +166,8 @@ class WorkflowApi:
156
166
  offset=offset,
157
167
  limit=limit,
158
168
  workflow_id=workflow_id,
169
+ workflow_name=workflow_name,
170
+ cron_name=cron_name,
159
171
  additional_metadata=additional_metadata,
160
172
  order_by_field=order_by_field,
161
173
  order_by_direction=order_by_direction,
@@ -198,6 +210,12 @@ class WorkflowApi:
198
210
  Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]],
199
211
  Field(description="The workflow id to get runs for."),
200
212
  ] = None,
213
+ workflow_name: Annotated[
214
+ Optional[StrictStr], Field(description="The workflow name to get runs for.")
215
+ ] = None,
216
+ cron_name: Annotated[
217
+ Optional[StrictStr], Field(description="The cron name to get runs for.")
218
+ ] = None,
201
219
  additional_metadata: Annotated[
202
220
  Optional[List[StrictStr]],
203
221
  Field(description="A list of metadata key value pairs to filter by"),
@@ -233,6 +251,10 @@ class WorkflowApi:
233
251
  :type limit: int
234
252
  :param workflow_id: The workflow id to get runs for.
235
253
  :type workflow_id: str
254
+ :param workflow_name: The workflow name to get runs for.
255
+ :type workflow_name: str
256
+ :param cron_name: The cron name to get runs for.
257
+ :type cron_name: str
236
258
  :param additional_metadata: A list of metadata key value pairs to filter by
237
259
  :type additional_metadata: List[str]
238
260
  :param order_by_field: The order by field
@@ -266,6 +288,8 @@ class WorkflowApi:
266
288
  offset=offset,
267
289
  limit=limit,
268
290
  workflow_id=workflow_id,
291
+ workflow_name=workflow_name,
292
+ cron_name=cron_name,
269
293
  additional_metadata=additional_metadata,
270
294
  order_by_field=order_by_field,
271
295
  order_by_direction=order_by_direction,
@@ -308,6 +332,12 @@ class WorkflowApi:
308
332
  Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]],
309
333
  Field(description="The workflow id to get runs for."),
310
334
  ] = None,
335
+ workflow_name: Annotated[
336
+ Optional[StrictStr], Field(description="The workflow name to get runs for.")
337
+ ] = None,
338
+ cron_name: Annotated[
339
+ Optional[StrictStr], Field(description="The cron name to get runs for.")
340
+ ] = None,
311
341
  additional_metadata: Annotated[
312
342
  Optional[List[StrictStr]],
313
343
  Field(description="A list of metadata key value pairs to filter by"),
@@ -343,6 +373,10 @@ class WorkflowApi:
343
373
  :type limit: int
344
374
  :param workflow_id: The workflow id to get runs for.
345
375
  :type workflow_id: str
376
+ :param workflow_name: The workflow name to get runs for.
377
+ :type workflow_name: str
378
+ :param cron_name: The cron name to get runs for.
379
+ :type cron_name: str
346
380
  :param additional_metadata: A list of metadata key value pairs to filter by
347
381
  :type additional_metadata: List[str]
348
382
  :param order_by_field: The order by field
@@ -376,6 +410,8 @@ class WorkflowApi:
376
410
  offset=offset,
377
411
  limit=limit,
378
412
  workflow_id=workflow_id,
413
+ workflow_name=workflow_name,
414
+ cron_name=cron_name,
379
415
  additional_metadata=additional_metadata,
380
416
  order_by_field=order_by_field,
381
417
  order_by_direction=order_by_direction,
@@ -401,6 +437,8 @@ class WorkflowApi:
401
437
  offset,
402
438
  limit,
403
439
  workflow_id,
440
+ workflow_name,
441
+ cron_name,
404
442
  additional_metadata,
405
443
  order_by_field,
406
444
  order_by_direction,
@@ -441,6 +479,14 @@ class WorkflowApi:
441
479
 
442
480
  _query_params.append(("workflowId", workflow_id))
443
481
 
482
+ if workflow_name is not None:
483
+
484
+ _query_params.append(("workflowName", workflow_name))
485
+
486
+ if cron_name is not None:
487
+
488
+ _query_params.append(("cronName", cron_name))
489
+
444
490
  if additional_metadata is not None:
445
491
 
446
492
  _query_params.append(("additionalMetadata", additional_metadata))
@@ -23,6 +23,7 @@ from hatchet_sdk.clients.rest.api_response import ApiResponse
23
23
  from hatchet_sdk.clients.rest.models.v1_task_event_list import V1TaskEventList
24
24
  from hatchet_sdk.clients.rest.models.v1_task_status import V1TaskStatus
25
25
  from hatchet_sdk.clients.rest.models.v1_task_summary_list import V1TaskSummaryList
26
+ from hatchet_sdk.clients.rest.models.v1_task_timing_list import V1TaskTimingList
26
27
  from hatchet_sdk.clients.rest.models.v1_trigger_workflow_run_request import (
27
28
  V1TriggerWorkflowRunRequest,
28
29
  )
@@ -914,6 +915,304 @@ class WorkflowRunsApi:
914
915
  _request_auth=_request_auth,
915
916
  )
916
917
 
918
+ @validate_call
919
+ def v1_workflow_run_get_timings(
920
+ self,
921
+ v1_workflow_run: Annotated[
922
+ str,
923
+ Field(
924
+ min_length=36,
925
+ strict=True,
926
+ max_length=36,
927
+ description="The workflow run id to get",
928
+ ),
929
+ ],
930
+ depth: Annotated[
931
+ Optional[StrictInt], Field(description="The depth to retrieve children")
932
+ ] = None,
933
+ _request_timeout: Union[
934
+ None,
935
+ Annotated[StrictFloat, Field(gt=0)],
936
+ Tuple[
937
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
938
+ ],
939
+ ] = None,
940
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
941
+ _content_type: Optional[StrictStr] = None,
942
+ _headers: Optional[Dict[StrictStr, Any]] = None,
943
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
944
+ ) -> V1TaskTimingList:
945
+ """List timings for a workflow run
946
+
947
+ Get the timings for a workflow run
948
+
949
+ :param v1_workflow_run: The workflow run id to get (required)
950
+ :type v1_workflow_run: str
951
+ :param depth: The depth to retrieve children
952
+ :type depth: int
953
+ :param _request_timeout: timeout setting for this request. If one
954
+ number provided, it will be total request
955
+ timeout. It can also be a pair (tuple) of
956
+ (connection, read) timeouts.
957
+ :type _request_timeout: int, tuple(int, int), optional
958
+ :param _request_auth: set to override the auth_settings for an a single
959
+ request; this effectively ignores the
960
+ authentication in the spec for a single request.
961
+ :type _request_auth: dict, optional
962
+ :param _content_type: force content-type for the request.
963
+ :type _content_type: str, Optional
964
+ :param _headers: set to override the headers for a single
965
+ request; this effectively ignores the headers
966
+ in the spec for a single request.
967
+ :type _headers: dict, optional
968
+ :param _host_index: set to override the host_index for a single
969
+ request; this effectively ignores the host_index
970
+ in the spec for a single request.
971
+ :type _host_index: int, optional
972
+ :return: Returns the result object.
973
+ """ # noqa: E501
974
+
975
+ _param = self._v1_workflow_run_get_timings_serialize(
976
+ v1_workflow_run=v1_workflow_run,
977
+ depth=depth,
978
+ _request_auth=_request_auth,
979
+ _content_type=_content_type,
980
+ _headers=_headers,
981
+ _host_index=_host_index,
982
+ )
983
+
984
+ _response_types_map: Dict[str, Optional[str]] = {
985
+ "200": "V1TaskTimingList",
986
+ "400": "APIErrors",
987
+ "403": "APIErrors",
988
+ "501": "APIErrors",
989
+ }
990
+ response_data = self.api_client.call_api(
991
+ *_param, _request_timeout=_request_timeout
992
+ )
993
+ response_data.read()
994
+ return self.api_client.response_deserialize(
995
+ response_data=response_data,
996
+ response_types_map=_response_types_map,
997
+ ).data
998
+
999
+ @validate_call
1000
+ def v1_workflow_run_get_timings_with_http_info(
1001
+ self,
1002
+ v1_workflow_run: Annotated[
1003
+ str,
1004
+ Field(
1005
+ min_length=36,
1006
+ strict=True,
1007
+ max_length=36,
1008
+ description="The workflow run id to get",
1009
+ ),
1010
+ ],
1011
+ depth: Annotated[
1012
+ Optional[StrictInt], Field(description="The depth to retrieve children")
1013
+ ] = None,
1014
+ _request_timeout: Union[
1015
+ None,
1016
+ Annotated[StrictFloat, Field(gt=0)],
1017
+ Tuple[
1018
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
1019
+ ],
1020
+ ] = None,
1021
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1022
+ _content_type: Optional[StrictStr] = None,
1023
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1024
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1025
+ ) -> ApiResponse[V1TaskTimingList]:
1026
+ """List timings for a workflow run
1027
+
1028
+ Get the timings for a workflow run
1029
+
1030
+ :param v1_workflow_run: The workflow run id to get (required)
1031
+ :type v1_workflow_run: str
1032
+ :param depth: The depth to retrieve children
1033
+ :type depth: int
1034
+ :param _request_timeout: timeout setting for this request. If one
1035
+ number provided, it will be total request
1036
+ timeout. It can also be a pair (tuple) of
1037
+ (connection, read) timeouts.
1038
+ :type _request_timeout: int, tuple(int, int), optional
1039
+ :param _request_auth: set to override the auth_settings for an a single
1040
+ request; this effectively ignores the
1041
+ authentication in the spec for a single request.
1042
+ :type _request_auth: dict, optional
1043
+ :param _content_type: force content-type for the request.
1044
+ :type _content_type: str, Optional
1045
+ :param _headers: set to override the headers for a single
1046
+ request; this effectively ignores the headers
1047
+ in the spec for a single request.
1048
+ :type _headers: dict, optional
1049
+ :param _host_index: set to override the host_index for a single
1050
+ request; this effectively ignores the host_index
1051
+ in the spec for a single request.
1052
+ :type _host_index: int, optional
1053
+ :return: Returns the result object.
1054
+ """ # noqa: E501
1055
+
1056
+ _param = self._v1_workflow_run_get_timings_serialize(
1057
+ v1_workflow_run=v1_workflow_run,
1058
+ depth=depth,
1059
+ _request_auth=_request_auth,
1060
+ _content_type=_content_type,
1061
+ _headers=_headers,
1062
+ _host_index=_host_index,
1063
+ )
1064
+
1065
+ _response_types_map: Dict[str, Optional[str]] = {
1066
+ "200": "V1TaskTimingList",
1067
+ "400": "APIErrors",
1068
+ "403": "APIErrors",
1069
+ "501": "APIErrors",
1070
+ }
1071
+ response_data = self.api_client.call_api(
1072
+ *_param, _request_timeout=_request_timeout
1073
+ )
1074
+ response_data.read()
1075
+ return self.api_client.response_deserialize(
1076
+ response_data=response_data,
1077
+ response_types_map=_response_types_map,
1078
+ )
1079
+
1080
+ @validate_call
1081
+ def v1_workflow_run_get_timings_without_preload_content(
1082
+ self,
1083
+ v1_workflow_run: Annotated[
1084
+ str,
1085
+ Field(
1086
+ min_length=36,
1087
+ strict=True,
1088
+ max_length=36,
1089
+ description="The workflow run id to get",
1090
+ ),
1091
+ ],
1092
+ depth: Annotated[
1093
+ Optional[StrictInt], Field(description="The depth to retrieve children")
1094
+ ] = None,
1095
+ _request_timeout: Union[
1096
+ None,
1097
+ Annotated[StrictFloat, Field(gt=0)],
1098
+ Tuple[
1099
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
1100
+ ],
1101
+ ] = None,
1102
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1103
+ _content_type: Optional[StrictStr] = None,
1104
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1105
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1106
+ ) -> RESTResponseType:
1107
+ """List timings for a workflow run
1108
+
1109
+ Get the timings for a workflow run
1110
+
1111
+ :param v1_workflow_run: The workflow run id to get (required)
1112
+ :type v1_workflow_run: str
1113
+ :param depth: The depth to retrieve children
1114
+ :type depth: int
1115
+ :param _request_timeout: timeout setting for this request. If one
1116
+ number provided, it will be total request
1117
+ timeout. It can also be a pair (tuple) of
1118
+ (connection, read) timeouts.
1119
+ :type _request_timeout: int, tuple(int, int), optional
1120
+ :param _request_auth: set to override the auth_settings for an a single
1121
+ request; this effectively ignores the
1122
+ authentication in the spec for a single request.
1123
+ :type _request_auth: dict, optional
1124
+ :param _content_type: force content-type for the request.
1125
+ :type _content_type: str, Optional
1126
+ :param _headers: set to override the headers for a single
1127
+ request; this effectively ignores the headers
1128
+ in the spec for a single request.
1129
+ :type _headers: dict, optional
1130
+ :param _host_index: set to override the host_index for a single
1131
+ request; this effectively ignores the host_index
1132
+ in the spec for a single request.
1133
+ :type _host_index: int, optional
1134
+ :return: Returns the result object.
1135
+ """ # noqa: E501
1136
+
1137
+ _param = self._v1_workflow_run_get_timings_serialize(
1138
+ v1_workflow_run=v1_workflow_run,
1139
+ depth=depth,
1140
+ _request_auth=_request_auth,
1141
+ _content_type=_content_type,
1142
+ _headers=_headers,
1143
+ _host_index=_host_index,
1144
+ )
1145
+
1146
+ _response_types_map: Dict[str, Optional[str]] = {
1147
+ "200": "V1TaskTimingList",
1148
+ "400": "APIErrors",
1149
+ "403": "APIErrors",
1150
+ "501": "APIErrors",
1151
+ }
1152
+ response_data = self.api_client.call_api(
1153
+ *_param, _request_timeout=_request_timeout
1154
+ )
1155
+ return response_data.response
1156
+
1157
+ def _v1_workflow_run_get_timings_serialize(
1158
+ self,
1159
+ v1_workflow_run,
1160
+ depth,
1161
+ _request_auth,
1162
+ _content_type,
1163
+ _headers,
1164
+ _host_index,
1165
+ ) -> RequestSerialized:
1166
+
1167
+ _host = None
1168
+
1169
+ _collection_formats: Dict[str, str] = {}
1170
+
1171
+ _path_params: Dict[str, str] = {}
1172
+ _query_params: List[Tuple[str, str]] = []
1173
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1174
+ _form_params: List[Tuple[str, str]] = []
1175
+ _files: Dict[
1176
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1177
+ ] = {}
1178
+ _body_params: Optional[bytes] = None
1179
+
1180
+ # process the path parameters
1181
+ if v1_workflow_run is not None:
1182
+ _path_params["v1-workflow-run"] = v1_workflow_run
1183
+ # process the query parameters
1184
+ if depth is not None:
1185
+
1186
+ _query_params.append(("depth", depth))
1187
+
1188
+ # process the header parameters
1189
+ # process the form parameters
1190
+ # process the body parameter
1191
+
1192
+ # set the HTTP header `Accept`
1193
+ if "Accept" not in _header_params:
1194
+ _header_params["Accept"] = self.api_client.select_header_accept(
1195
+ ["application/json"]
1196
+ )
1197
+
1198
+ # authentication setting
1199
+ _auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
1200
+
1201
+ return self.api_client.param_serialize(
1202
+ method="GET",
1203
+ resource_path="/api/v1/stable/workflow-runs/{v1-workflow-run}/task-timings",
1204
+ path_params=_path_params,
1205
+ query_params=_query_params,
1206
+ header_params=_header_params,
1207
+ body=_body_params,
1208
+ post_params=_form_params,
1209
+ files=_files,
1210
+ auth_settings=_auth_settings,
1211
+ collection_formats=_collection_formats,
1212
+ _host=_host,
1213
+ _request_auth=_request_auth,
1214
+ )
1215
+
917
1216
  @validate_call
918
1217
  def v1_workflow_run_list(
919
1218
  self,
@@ -40,6 +40,7 @@ from hatchet_sdk.clients.rest.exceptions import (
40
40
  ServiceException,
41
41
  UnauthorizedException,
42
42
  )
43
+ from hatchet_sdk.logger import logger
43
44
 
44
45
  RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]]
45
46
 
@@ -356,7 +357,20 @@ class ApiClient:
356
357
  return [self.sanitize_for_serialization(sub_obj) for sub_obj in obj]
357
358
  elif isinstance(obj, tuple):
358
359
  return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj)
359
- elif isinstance(obj, (datetime.datetime, datetime.date)):
360
+ ## IMPORTANT: Checking `datetime` must come before `date` since `datetime` is a subclass of `date`
361
+ elif isinstance(obj, datetime.datetime):
362
+ if not obj.tzinfo:
363
+ current_tz = (
364
+ datetime.datetime.now(datetime.timezone(datetime.timedelta(0)))
365
+ .astimezone()
366
+ .tzinfo
367
+ or datetime.timezone.utc
368
+ )
369
+ logger.warning(f"timezone-naive datetime found. assuming {current_tz}.")
370
+ obj = obj.replace(tzinfo=current_tz)
371
+
372
+ return obj.isoformat()
373
+ elif isinstance(obj, datetime.date):
360
374
  return obj.isoformat()
361
375
  elif isinstance(obj, decimal.Decimal):
362
376
  return str(obj)
@@ -210,6 +210,8 @@ from hatchet_sdk.clients.rest.models.v1_task_run_status import V1TaskRunStatus
210
210
  from hatchet_sdk.clients.rest.models.v1_task_status import V1TaskStatus
211
211
  from hatchet_sdk.clients.rest.models.v1_task_summary import V1TaskSummary
212
212
  from hatchet_sdk.clients.rest.models.v1_task_summary_list import V1TaskSummaryList
213
+ from hatchet_sdk.clients.rest.models.v1_task_timing import V1TaskTiming
214
+ from hatchet_sdk.clients.rest.models.v1_task_timing_list import V1TaskTimingList
213
215
  from hatchet_sdk.clients.rest.models.v1_trigger_workflow_run_request import (
214
216
  V1TriggerWorkflowRunRequest,
215
217
  )
@@ -95,10 +95,8 @@ class V1TaskSummary(BaseModel):
95
95
  )
96
96
  workflow_id: StrictStr = Field(alias="workflowId")
97
97
  workflow_name: Optional[StrictStr] = Field(default=None, alias="workflowName")
98
- workflow_run_external_id: Optional[StrictStr] = Field(
99
- default=None,
100
- description="The external ID of the workflow run",
101
- alias="workflowRunExternalId",
98
+ workflow_run_external_id: StrictStr = Field(
99
+ description="The external ID of the workflow run", alias="workflowRunExternalId"
102
100
  )
103
101
  workflow_version_id: Optional[StrictStr] = Field(
104
102
  default=None,