hatchet-sdk 1.0.0__py3-none-any.whl → 1.0.0a1__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 (65) hide show
  1. hatchet_sdk/__init__.py +27 -16
  2. hatchet_sdk/client.py +13 -63
  3. hatchet_sdk/clients/admin.py +203 -124
  4. hatchet_sdk/clients/dispatcher/action_listener.py +42 -42
  5. hatchet_sdk/clients/dispatcher/dispatcher.py +18 -16
  6. hatchet_sdk/clients/durable_event_listener.py +327 -0
  7. hatchet_sdk/clients/rest/__init__.py +12 -1
  8. hatchet_sdk/clients/rest/api/log_api.py +258 -0
  9. hatchet_sdk/clients/rest/api/task_api.py +32 -6
  10. hatchet_sdk/clients/rest/api/workflow_runs_api.py +626 -0
  11. hatchet_sdk/clients/rest/models/__init__.py +12 -1
  12. hatchet_sdk/clients/rest/models/v1_log_line.py +94 -0
  13. hatchet_sdk/clients/rest/models/v1_log_line_level.py +39 -0
  14. hatchet_sdk/clients/rest/models/v1_log_line_list.py +110 -0
  15. hatchet_sdk/clients/rest/models/v1_task_summary.py +80 -64
  16. hatchet_sdk/clients/rest/models/v1_trigger_workflow_run_request.py +95 -0
  17. hatchet_sdk/clients/rest/models/v1_workflow_run_display_name.py +98 -0
  18. hatchet_sdk/clients/rest/models/v1_workflow_run_display_name_list.py +114 -0
  19. hatchet_sdk/clients/rest/models/workflow_run_shape_item_for_workflow_run_details.py +9 -4
  20. hatchet_sdk/clients/rest_client.py +21 -0
  21. hatchet_sdk/clients/run_event_listener.py +0 -1
  22. hatchet_sdk/context/context.py +85 -147
  23. hatchet_sdk/contracts/dispatcher_pb2_grpc.py +1 -1
  24. hatchet_sdk/contracts/events_pb2.py +2 -2
  25. hatchet_sdk/contracts/events_pb2_grpc.py +1 -1
  26. hatchet_sdk/contracts/v1/dispatcher_pb2.py +36 -0
  27. hatchet_sdk/contracts/v1/dispatcher_pb2.pyi +38 -0
  28. hatchet_sdk/contracts/v1/dispatcher_pb2_grpc.py +145 -0
  29. hatchet_sdk/contracts/v1/shared/condition_pb2.py +39 -0
  30. hatchet_sdk/contracts/v1/shared/condition_pb2.pyi +72 -0
  31. hatchet_sdk/contracts/v1/shared/condition_pb2_grpc.py +29 -0
  32. hatchet_sdk/contracts/v1/workflows_pb2.py +67 -0
  33. hatchet_sdk/contracts/v1/workflows_pb2.pyi +228 -0
  34. hatchet_sdk/contracts/v1/workflows_pb2_grpc.py +234 -0
  35. hatchet_sdk/contracts/workflows_pb2_grpc.py +1 -1
  36. hatchet_sdk/features/cron.py +3 -3
  37. hatchet_sdk/features/scheduled.py +2 -2
  38. hatchet_sdk/hatchet.py +427 -151
  39. hatchet_sdk/opentelemetry/instrumentor.py +8 -13
  40. hatchet_sdk/rate_limit.py +33 -39
  41. hatchet_sdk/runnables/contextvars.py +12 -0
  42. hatchet_sdk/runnables/standalone.py +194 -0
  43. hatchet_sdk/runnables/task.py +144 -0
  44. hatchet_sdk/runnables/types.py +138 -0
  45. hatchet_sdk/runnables/workflow.py +764 -0
  46. hatchet_sdk/utils/aio_utils.py +0 -79
  47. hatchet_sdk/utils/proto_enums.py +0 -7
  48. hatchet_sdk/utils/timedelta_to_expression.py +23 -0
  49. hatchet_sdk/utils/typing.py +2 -2
  50. hatchet_sdk/v0/clients/rest_client.py +9 -0
  51. hatchet_sdk/v0/worker/action_listener_process.py +18 -2
  52. hatchet_sdk/waits.py +120 -0
  53. hatchet_sdk/worker/action_listener_process.py +64 -30
  54. hatchet_sdk/worker/runner/run_loop_manager.py +35 -25
  55. hatchet_sdk/worker/runner/runner.py +72 -49
  56. hatchet_sdk/worker/runner/utils/capture_logs.py +3 -11
  57. hatchet_sdk/worker/worker.py +155 -118
  58. hatchet_sdk/workflow_run.py +4 -5
  59. {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.0a1.dist-info}/METADATA +1 -2
  60. {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.0a1.dist-info}/RECORD +62 -42
  61. {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.0a1.dist-info}/entry_points.txt +2 -0
  62. hatchet_sdk/semver.py +0 -30
  63. hatchet_sdk/worker/runner/utils/error_with_traceback.py +0 -6
  64. hatchet_sdk/workflow.py +0 -527
  65. {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.0a1.dist-info}/WHEEL +0 -0
@@ -25,6 +25,7 @@ from hatchet_sdk.clients.rest.models.log_line_order_by_direction import (
25
25
  LogLineOrderByDirection,
26
26
  )
27
27
  from hatchet_sdk.clients.rest.models.log_line_order_by_field import LogLineOrderByField
28
+ from hatchet_sdk.clients.rest.models.v1_log_line_list import V1LogLineList
28
29
  from hatchet_sdk.clients.rest.rest import RESTResponseType
29
30
 
30
31
 
@@ -445,3 +446,260 @@ class LogApi:
445
446
  _host=_host,
446
447
  _request_auth=_request_auth,
447
448
  )
449
+
450
+ @validate_call
451
+ async def v1_log_line_list(
452
+ self,
453
+ task: Annotated[
454
+ str,
455
+ Field(min_length=36, strict=True, max_length=36, description="The task id"),
456
+ ],
457
+ _request_timeout: Union[
458
+ None,
459
+ Annotated[StrictFloat, Field(gt=0)],
460
+ Tuple[
461
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
462
+ ],
463
+ ] = None,
464
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
465
+ _content_type: Optional[StrictStr] = None,
466
+ _headers: Optional[Dict[StrictStr, Any]] = None,
467
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
468
+ ) -> V1LogLineList:
469
+ """List log lines
470
+
471
+ Lists log lines for a task
472
+
473
+ :param task: The task id (required)
474
+ :type task: str
475
+ :param _request_timeout: timeout setting for this request. If one
476
+ number provided, it will be total request
477
+ timeout. It can also be a pair (tuple) of
478
+ (connection, read) timeouts.
479
+ :type _request_timeout: int, tuple(int, int), optional
480
+ :param _request_auth: set to override the auth_settings for an a single
481
+ request; this effectively ignores the
482
+ authentication in the spec for a single request.
483
+ :type _request_auth: dict, optional
484
+ :param _content_type: force content-type for the request.
485
+ :type _content_type: str, Optional
486
+ :param _headers: set to override the headers for a single
487
+ request; this effectively ignores the headers
488
+ in the spec for a single request.
489
+ :type _headers: dict, optional
490
+ :param _host_index: set to override the host_index for a single
491
+ request; this effectively ignores the host_index
492
+ in the spec for a single request.
493
+ :type _host_index: int, optional
494
+ :return: Returns the result object.
495
+ """ # noqa: E501
496
+
497
+ _param = self._v1_log_line_list_serialize(
498
+ task=task,
499
+ _request_auth=_request_auth,
500
+ _content_type=_content_type,
501
+ _headers=_headers,
502
+ _host_index=_host_index,
503
+ )
504
+
505
+ _response_types_map: Dict[str, Optional[str]] = {
506
+ "200": "V1LogLineList",
507
+ "400": "APIErrors",
508
+ "403": "APIErrors",
509
+ }
510
+ response_data = await self.api_client.call_api(
511
+ *_param, _request_timeout=_request_timeout
512
+ )
513
+ await response_data.read()
514
+ return self.api_client.response_deserialize(
515
+ response_data=response_data,
516
+ response_types_map=_response_types_map,
517
+ ).data
518
+
519
+ @validate_call
520
+ async def v1_log_line_list_with_http_info(
521
+ self,
522
+ task: Annotated[
523
+ str,
524
+ Field(min_length=36, strict=True, max_length=36, description="The task id"),
525
+ ],
526
+ _request_timeout: Union[
527
+ None,
528
+ Annotated[StrictFloat, Field(gt=0)],
529
+ Tuple[
530
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
531
+ ],
532
+ ] = None,
533
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
534
+ _content_type: Optional[StrictStr] = None,
535
+ _headers: Optional[Dict[StrictStr, Any]] = None,
536
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
537
+ ) -> ApiResponse[V1LogLineList]:
538
+ """List log lines
539
+
540
+ Lists log lines for a task
541
+
542
+ :param task: The task id (required)
543
+ :type task: str
544
+ :param _request_timeout: timeout setting for this request. If one
545
+ number provided, it will be total request
546
+ timeout. It can also be a pair (tuple) of
547
+ (connection, read) timeouts.
548
+ :type _request_timeout: int, tuple(int, int), optional
549
+ :param _request_auth: set to override the auth_settings for an a single
550
+ request; this effectively ignores the
551
+ authentication in the spec for a single request.
552
+ :type _request_auth: dict, optional
553
+ :param _content_type: force content-type for the request.
554
+ :type _content_type: str, Optional
555
+ :param _headers: set to override the headers for a single
556
+ request; this effectively ignores the headers
557
+ in the spec for a single request.
558
+ :type _headers: dict, optional
559
+ :param _host_index: set to override the host_index for a single
560
+ request; this effectively ignores the host_index
561
+ in the spec for a single request.
562
+ :type _host_index: int, optional
563
+ :return: Returns the result object.
564
+ """ # noqa: E501
565
+
566
+ _param = self._v1_log_line_list_serialize(
567
+ task=task,
568
+ _request_auth=_request_auth,
569
+ _content_type=_content_type,
570
+ _headers=_headers,
571
+ _host_index=_host_index,
572
+ )
573
+
574
+ _response_types_map: Dict[str, Optional[str]] = {
575
+ "200": "V1LogLineList",
576
+ "400": "APIErrors",
577
+ "403": "APIErrors",
578
+ }
579
+ response_data = await self.api_client.call_api(
580
+ *_param, _request_timeout=_request_timeout
581
+ )
582
+ await response_data.read()
583
+ return self.api_client.response_deserialize(
584
+ response_data=response_data,
585
+ response_types_map=_response_types_map,
586
+ )
587
+
588
+ @validate_call
589
+ async def v1_log_line_list_without_preload_content(
590
+ self,
591
+ task: Annotated[
592
+ str,
593
+ Field(min_length=36, strict=True, max_length=36, description="The task id"),
594
+ ],
595
+ _request_timeout: Union[
596
+ None,
597
+ Annotated[StrictFloat, Field(gt=0)],
598
+ Tuple[
599
+ Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
600
+ ],
601
+ ] = None,
602
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
603
+ _content_type: Optional[StrictStr] = None,
604
+ _headers: Optional[Dict[StrictStr, Any]] = None,
605
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
606
+ ) -> RESTResponseType:
607
+ """List log lines
608
+
609
+ Lists log lines for a task
610
+
611
+ :param task: The task id (required)
612
+ :type task: str
613
+ :param _request_timeout: timeout setting for this request. If one
614
+ number provided, it will be total request
615
+ timeout. It can also be a pair (tuple) of
616
+ (connection, read) timeouts.
617
+ :type _request_timeout: int, tuple(int, int), optional
618
+ :param _request_auth: set to override the auth_settings for an a single
619
+ request; this effectively ignores the
620
+ authentication in the spec for a single request.
621
+ :type _request_auth: dict, optional
622
+ :param _content_type: force content-type for the request.
623
+ :type _content_type: str, Optional
624
+ :param _headers: set to override the headers for a single
625
+ request; this effectively ignores the headers
626
+ in the spec for a single request.
627
+ :type _headers: dict, optional
628
+ :param _host_index: set to override the host_index for a single
629
+ request; this effectively ignores the host_index
630
+ in the spec for a single request.
631
+ :type _host_index: int, optional
632
+ :return: Returns the result object.
633
+ """ # noqa: E501
634
+
635
+ _param = self._v1_log_line_list_serialize(
636
+ task=task,
637
+ _request_auth=_request_auth,
638
+ _content_type=_content_type,
639
+ _headers=_headers,
640
+ _host_index=_host_index,
641
+ )
642
+
643
+ _response_types_map: Dict[str, Optional[str]] = {
644
+ "200": "V1LogLineList",
645
+ "400": "APIErrors",
646
+ "403": "APIErrors",
647
+ }
648
+ response_data = await self.api_client.call_api(
649
+ *_param, _request_timeout=_request_timeout
650
+ )
651
+ return response_data.response
652
+
653
+ def _v1_log_line_list_serialize(
654
+ self,
655
+ task,
656
+ _request_auth,
657
+ _content_type,
658
+ _headers,
659
+ _host_index,
660
+ ) -> RequestSerialized:
661
+
662
+ _host = None
663
+
664
+ _collection_formats: Dict[str, str] = {}
665
+
666
+ _path_params: Dict[str, str] = {}
667
+ _query_params: List[Tuple[str, str]] = []
668
+ _header_params: Dict[str, Optional[str]] = _headers or {}
669
+ _form_params: List[Tuple[str, str]] = []
670
+ _files: Dict[
671
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
672
+ ] = {}
673
+ _body_params: Optional[bytes] = None
674
+
675
+ # process the path parameters
676
+ if task is not None:
677
+ _path_params["task"] = task
678
+ # process the query parameters
679
+ # process the header parameters
680
+ # process the form parameters
681
+ # process the body parameter
682
+
683
+ # set the HTTP header `Accept`
684
+ if "Accept" not in _header_params:
685
+ _header_params["Accept"] = self.api_client.select_header_accept(
686
+ ["application/json"]
687
+ )
688
+
689
+ # authentication setting
690
+ _auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
691
+
692
+ return self.api_client.param_serialize(
693
+ method="GET",
694
+ resource_path="/api/v1/stable/tasks/{task}/logs",
695
+ path_params=_path_params,
696
+ query_params=_query_params,
697
+ header_params=_header_params,
698
+ body=_body_params,
699
+ post_params=_form_params,
700
+ files=_files,
701
+ auth_settings=_auth_settings,
702
+ collection_formats=_collection_formats,
703
+ _host=_host,
704
+ _request_auth=_request_auth,
705
+ )
@@ -23,10 +23,10 @@ from hatchet_sdk.clients.rest.api_response import ApiResponse
23
23
  from hatchet_sdk.clients.rest.models.v1_cancel_task_request import V1CancelTaskRequest
24
24
  from hatchet_sdk.clients.rest.models.v1_dag_children import V1DagChildren
25
25
  from hatchet_sdk.clients.rest.models.v1_replay_task_request import V1ReplayTaskRequest
26
- from hatchet_sdk.clients.rest.models.v1_task import V1Task
27
26
  from hatchet_sdk.clients.rest.models.v1_task_event_list import V1TaskEventList
28
27
  from hatchet_sdk.clients.rest.models.v1_task_point_metrics import V1TaskPointMetrics
29
28
  from hatchet_sdk.clients.rest.models.v1_task_run_metric import V1TaskRunMetric
29
+ from hatchet_sdk.clients.rest.models.v1_task_summary import V1TaskSummary
30
30
  from hatchet_sdk.clients.rest.rest import RESTResponseType
31
31
 
32
32
 
@@ -965,7 +965,7 @@ class TaskApi:
965
965
  _content_type: Optional[StrictStr] = None,
966
966
  _headers: Optional[Dict[StrictStr, Any]] = None,
967
967
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
968
- ) -> V1Task:
968
+ ) -> V1TaskSummary:
969
969
  """Get a task
970
970
 
971
971
  Get a task by id
@@ -1003,7 +1003,7 @@ class TaskApi:
1003
1003
  )
1004
1004
 
1005
1005
  _response_types_map: Dict[str, Optional[str]] = {
1006
- "200": "V1Task",
1006
+ "200": "V1TaskSummary",
1007
1007
  "400": "APIErrors",
1008
1008
  "403": "APIErrors",
1009
1009
  "404": "APIErrors",
@@ -1036,7 +1036,7 @@ class TaskApi:
1036
1036
  _content_type: Optional[StrictStr] = None,
1037
1037
  _headers: Optional[Dict[StrictStr, Any]] = None,
1038
1038
  _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1039
- ) -> ApiResponse[V1Task]:
1039
+ ) -> ApiResponse[V1TaskSummary]:
1040
1040
  """Get a task
1041
1041
 
1042
1042
  Get a task by id
@@ -1074,7 +1074,7 @@ class TaskApi:
1074
1074
  )
1075
1075
 
1076
1076
  _response_types_map: Dict[str, Optional[str]] = {
1077
- "200": "V1Task",
1077
+ "200": "V1TaskSummary",
1078
1078
  "400": "APIErrors",
1079
1079
  "403": "APIErrors",
1080
1080
  "404": "APIErrors",
@@ -1145,7 +1145,7 @@ class TaskApi:
1145
1145
  )
1146
1146
 
1147
1147
  _response_types_map: Dict[str, Optional[str]] = {
1148
- "200": "V1Task",
1148
+ "200": "V1TaskSummary",
1149
1149
  "400": "APIErrors",
1150
1150
  "403": "APIErrors",
1151
1151
  "404": "APIErrors",
@@ -1561,6 +1561,10 @@ class TaskApi:
1561
1561
  ],
1562
1562
  Field(description="The workflow id to find runs for"),
1563
1563
  ] = None,
1564
+ parent_task_external_id: Annotated[
1565
+ Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]],
1566
+ Field(description="The parent task's external id"),
1567
+ ] = None,
1564
1568
  _request_timeout: Union[
1565
1569
  None,
1566
1570
  Annotated[StrictFloat, Field(gt=0)],
@@ -1583,6 +1587,8 @@ class TaskApi:
1583
1587
  :type since: datetime
1584
1588
  :param workflow_ids: The workflow id to find runs for
1585
1589
  :type workflow_ids: List[str]
1590
+ :param parent_task_external_id: The parent task's external id
1591
+ :type parent_task_external_id: str
1586
1592
  :param _request_timeout: timeout setting for this request. If one
1587
1593
  number provided, it will be total request
1588
1594
  timeout. It can also be a pair (tuple) of
@@ -1609,6 +1615,7 @@ class TaskApi:
1609
1615
  tenant=tenant,
1610
1616
  since=since,
1611
1617
  workflow_ids=workflow_ids,
1618
+ parent_task_external_id=parent_task_external_id,
1612
1619
  _request_auth=_request_auth,
1613
1620
  _content_type=_content_type,
1614
1621
  _headers=_headers,
@@ -1648,6 +1655,10 @@ class TaskApi:
1648
1655
  ],
1649
1656
  Field(description="The workflow id to find runs for"),
1650
1657
  ] = None,
1658
+ parent_task_external_id: Annotated[
1659
+ Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]],
1660
+ Field(description="The parent task's external id"),
1661
+ ] = None,
1651
1662
  _request_timeout: Union[
1652
1663
  None,
1653
1664
  Annotated[StrictFloat, Field(gt=0)],
@@ -1670,6 +1681,8 @@ class TaskApi:
1670
1681
  :type since: datetime
1671
1682
  :param workflow_ids: The workflow id to find runs for
1672
1683
  :type workflow_ids: List[str]
1684
+ :param parent_task_external_id: The parent task's external id
1685
+ :type parent_task_external_id: str
1673
1686
  :param _request_timeout: timeout setting for this request. If one
1674
1687
  number provided, it will be total request
1675
1688
  timeout. It can also be a pair (tuple) of
@@ -1696,6 +1709,7 @@ class TaskApi:
1696
1709
  tenant=tenant,
1697
1710
  since=since,
1698
1711
  workflow_ids=workflow_ids,
1712
+ parent_task_external_id=parent_task_external_id,
1699
1713
  _request_auth=_request_auth,
1700
1714
  _content_type=_content_type,
1701
1715
  _headers=_headers,
@@ -1735,6 +1749,10 @@ class TaskApi:
1735
1749
  ],
1736
1750
  Field(description="The workflow id to find runs for"),
1737
1751
  ] = None,
1752
+ parent_task_external_id: Annotated[
1753
+ Optional[Annotated[str, Field(min_length=36, strict=True, max_length=36)]],
1754
+ Field(description="The parent task's external id"),
1755
+ ] = None,
1738
1756
  _request_timeout: Union[
1739
1757
  None,
1740
1758
  Annotated[StrictFloat, Field(gt=0)],
@@ -1757,6 +1775,8 @@ class TaskApi:
1757
1775
  :type since: datetime
1758
1776
  :param workflow_ids: The workflow id to find runs for
1759
1777
  :type workflow_ids: List[str]
1778
+ :param parent_task_external_id: The parent task's external id
1779
+ :type parent_task_external_id: str
1760
1780
  :param _request_timeout: timeout setting for this request. If one
1761
1781
  number provided, it will be total request
1762
1782
  timeout. It can also be a pair (tuple) of
@@ -1783,6 +1803,7 @@ class TaskApi:
1783
1803
  tenant=tenant,
1784
1804
  since=since,
1785
1805
  workflow_ids=workflow_ids,
1806
+ parent_task_external_id=parent_task_external_id,
1786
1807
  _request_auth=_request_auth,
1787
1808
  _content_type=_content_type,
1788
1809
  _headers=_headers,
@@ -1805,6 +1826,7 @@ class TaskApi:
1805
1826
  tenant,
1806
1827
  since,
1807
1828
  workflow_ids,
1829
+ parent_task_external_id,
1808
1830
  _request_auth,
1809
1831
  _content_type,
1810
1832
  _headers,
@@ -1845,6 +1867,10 @@ class TaskApi:
1845
1867
 
1846
1868
  _query_params.append(("workflow_ids", workflow_ids))
1847
1869
 
1870
+ if parent_task_external_id is not None:
1871
+
1872
+ _query_params.append(("parent_task_external_id", parent_task_external_id))
1873
+
1848
1874
  # process the header parameters
1849
1875
  # process the form parameters
1850
1876
  # process the body parameter