diff --git a/.gitmodules b/.gitmodules index 2e2e6198..94f53c8d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,4 @@ [submodule "hatchet"] path = hatchet url = git@github.com:hatchet-dev/hatchet.git - branch = main + branch = feat--improved-sdk-ack diff --git a/hatchet b/hatchet index c2998430..618a8c0f 160000 --- a/hatchet +++ b/hatchet @@ -1 +1 @@ -Subproject commit c29984305e39d738fa4904dcaf5f6e80262348a8 +Subproject commit 618a8c0f859406f6f70bb4e3148bb9a0f5482c42 diff --git a/hatchet_sdk/clients/rest/__init__.py b/hatchet_sdk/clients/rest/__init__.py index a83c1cdc..31cf4825 100644 --- a/hatchet_sdk/clients/rest/__init__.py +++ b/hatchet_sdk/clients/rest/__init__.py @@ -24,6 +24,7 @@ from hatchet_sdk.clients.rest.api.healthcheck_api import HealthcheckApi from hatchet_sdk.clients.rest.api.log_api import LogApi from hatchet_sdk.clients.rest.api.metadata_api import MetadataApi +from hatchet_sdk.clients.rest.api.rate_limits_api import RateLimitsApi from hatchet_sdk.clients.rest.api.slack_api import SlackApi from hatchet_sdk.clients.rest.api.sns_api import SNSApi from hatchet_sdk.clients.rest.api.step_run_api import StepRunApi @@ -122,6 +123,14 @@ from hatchet_sdk.clients.rest.models.pull_request import PullRequest from hatchet_sdk.clients.rest.models.pull_request_state import PullRequestState from hatchet_sdk.clients.rest.models.queue_metrics import QueueMetrics +from hatchet_sdk.clients.rest.models.rate_limit import RateLimit +from hatchet_sdk.clients.rest.models.rate_limit_list import RateLimitList +from hatchet_sdk.clients.rest.models.rate_limit_order_by_direction import ( + RateLimitOrderByDirection, +) +from hatchet_sdk.clients.rest.models.rate_limit_order_by_field import ( + RateLimitOrderByField, +) from hatchet_sdk.clients.rest.models.recent_step_runs import RecentStepRuns from hatchet_sdk.clients.rest.models.reject_invite_request import RejectInviteRequest from hatchet_sdk.clients.rest.models.replay_event_request import ReplayEventRequest @@ -165,6 +174,9 @@ from hatchet_sdk.clients.rest.models.tenant_resource import TenantResource from hatchet_sdk.clients.rest.models.tenant_resource_limit import TenantResourceLimit from hatchet_sdk.clients.rest.models.tenant_resource_policy import TenantResourcePolicy +from hatchet_sdk.clients.rest.models.tenant_step_run_queue_metrics import ( + TenantStepRunQueueMetrics, +) from hatchet_sdk.clients.rest.models.trigger_workflow_run_request import ( TriggerWorkflowRunRequest, ) @@ -240,6 +252,9 @@ WorkflowTriggerEventRef, ) from hatchet_sdk.clients.rest.models.workflow_triggers import WorkflowTriggers +from hatchet_sdk.clients.rest.models.workflow_update_request import ( + WorkflowUpdateRequest, +) from hatchet_sdk.clients.rest.models.workflow_version import WorkflowVersion from hatchet_sdk.clients.rest.models.workflow_version_definition import ( WorkflowVersionDefinition, diff --git a/hatchet_sdk/clients/rest/api/__init__.py b/hatchet_sdk/clients/rest/api/__init__.py index bc8c788d..f6ecbe38 100644 --- a/hatchet_sdk/clients/rest/api/__init__.py +++ b/hatchet_sdk/clients/rest/api/__init__.py @@ -8,6 +8,7 @@ from hatchet_sdk.clients.rest.api.healthcheck_api import HealthcheckApi from hatchet_sdk.clients.rest.api.log_api import LogApi from hatchet_sdk.clients.rest.api.metadata_api import MetadataApi +from hatchet_sdk.clients.rest.api.rate_limits_api import RateLimitsApi from hatchet_sdk.clients.rest.api.slack_api import SlackApi from hatchet_sdk.clients.rest.api.sns_api import SNSApi from hatchet_sdk.clients.rest.api.step_run_api import StepRunApi diff --git a/hatchet_sdk/clients/rest/api/api_token_api.py b/hatchet_sdk/clients/rest/api/api_token_api.py index 32faf798..5b32d0aa 100644 --- a/hatchet_sdk/clients/rest/api/api_token_api.py +++ b/hatchet_sdk/clients/rest/api/api_token_api.py @@ -296,10 +296,9 @@ def _api_token_create_serialize( _body_params = create_api_token_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -567,10 +566,9 @@ def _api_token_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -828,10 +826,9 @@ def _api_token_update_revoke_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] diff --git a/hatchet_sdk/clients/rest/api/default_api.py b/hatchet_sdk/clients/rest/api/default_api.py index bdb00ebe..5cd078e4 100644 --- a/hatchet_sdk/clients/rest/api/default_api.py +++ b/hatchet_sdk/clients/rest/api/default_api.py @@ -322,10 +322,9 @@ def _tenant_invite_delete_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -640,10 +639,9 @@ def _tenant_invite_update_serialize( _body_params = update_tenant_invite_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -929,10 +927,9 @@ def _webhook_create_serialize( _body_params = webhook_worker_create_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -1203,10 +1200,9 @@ def _webhook_delete_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1467,10 +1463,9 @@ def _webhook_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1731,10 +1726,9 @@ def _webhook_requests_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] diff --git a/hatchet_sdk/clients/rest/api/event_api.py b/hatchet_sdk/clients/rest/api/event_api.py index febdf436..e7544196 100644 --- a/hatchet_sdk/clients/rest/api/event_api.py +++ b/hatchet_sdk/clients/rest/api/event_api.py @@ -317,10 +317,9 @@ def _event_create_serialize( _body_params = create_event_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -612,10 +611,9 @@ def _event_create_bulk_serialize( _body_params = bulk_create_event_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -883,10 +881,9 @@ def _event_data_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1144,10 +1141,9 @@ def _event_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1405,10 +1401,9 @@ def _event_key_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1920,10 +1915,9 @@ def _event_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -2205,10 +2199,9 @@ def _event_update_cancel_serialize( _body_params = cancel_event_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -2500,10 +2493,9 @@ def _event_update_replay_serialize( _body_params = replay_event_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: diff --git a/hatchet_sdk/clients/rest/api/github_api.py b/hatchet_sdk/clients/rest/api/github_api.py index 6d584c01..121441df 100644 --- a/hatchet_sdk/clients/rest/api/github_api.py +++ b/hatchet_sdk/clients/rest/api/github_api.py @@ -305,10 +305,9 @@ def _sns_update_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = [] diff --git a/hatchet_sdk/clients/rest/api/log_api.py b/hatchet_sdk/clients/rest/api/log_api.py index 8643d563..dd941af0 100644 --- a/hatchet_sdk/clients/rest/api/log_api.py +++ b/hatchet_sdk/clients/rest/api/log_api.py @@ -421,10 +421,9 @@ def _log_line_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] diff --git a/hatchet_sdk/clients/rest/api/metadata_api.py b/hatchet_sdk/clients/rest/api/metadata_api.py index 2954440a..44248e20 100644 --- a/hatchet_sdk/clients/rest/api/metadata_api.py +++ b/hatchet_sdk/clients/rest/api/metadata_api.py @@ -242,10 +242,9 @@ def _cloud_metadata_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = [] @@ -470,10 +469,9 @@ def _metadata_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = [] @@ -698,10 +696,9 @@ def _metadata_list_integrations_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] diff --git a/hatchet_sdk/clients/rest/api/rate_limits_api.py b/hatchet_sdk/clients/rest/api/rate_limits_api.py new file mode 100644 index 00000000..3445856c --- /dev/null +++ b/hatchet_sdk/clients/rest/api/rate_limits_api.py @@ -0,0 +1,420 @@ +# coding: utf-8 + +""" + Hatchet API + + The Hatchet API + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +import warnings +from typing import Any, Dict, List, Optional, Tuple, Union + +from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call +from typing_extensions import Annotated + +from hatchet_sdk.clients.rest.api_client import ApiClient, RequestSerialized +from hatchet_sdk.clients.rest.api_response import ApiResponse +from hatchet_sdk.clients.rest.models.rate_limit_list import RateLimitList +from hatchet_sdk.clients.rest.models.rate_limit_order_by_direction import ( + RateLimitOrderByDirection, +) +from hatchet_sdk.clients.rest.models.rate_limit_order_by_field import ( + RateLimitOrderByField, +) +from hatchet_sdk.clients.rest.rest import RESTResponseType + + +class RateLimitsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + @validate_call + async def rate_limit_list( + self, + tenant: Annotated[ + str, + Field( + min_length=36, strict=True, max_length=36, description="The tenant id" + ), + ], + offset: Annotated[ + Optional[StrictInt], Field(description="The number to skip") + ] = None, + limit: Annotated[ + Optional[StrictInt], Field(description="The number to limit by") + ] = None, + search: Annotated[ + Optional[StrictStr], Field(description="The search query to filter for") + ] = None, + order_by_field: Annotated[ + Optional[RateLimitOrderByField], Field(description="What to order by") + ] = None, + order_by_direction: Annotated[ + Optional[RateLimitOrderByDirection], + Field(description="The order direction"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RateLimitList: + """List rate limits + + Lists all rate limits for a tenant. + + :param tenant: The tenant id (required) + :type tenant: str + :param offset: The number to skip + :type offset: int + :param limit: The number to limit by + :type limit: int + :param search: The search query to filter for + :type search: str + :param order_by_field: What to order by + :type order_by_field: RateLimitOrderByField + :param order_by_direction: The order direction + :type order_by_direction: RateLimitOrderByDirection + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rate_limit_list_serialize( + tenant=tenant, + offset=offset, + limit=limit, + search=search, + order_by_field=order_by_field, + order_by_direction=order_by_direction, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "RateLimitList", + "400": "APIErrors", + "403": "APIErrors", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def rate_limit_list_with_http_info( + self, + tenant: Annotated[ + str, + Field( + min_length=36, strict=True, max_length=36, description="The tenant id" + ), + ], + offset: Annotated[ + Optional[StrictInt], Field(description="The number to skip") + ] = None, + limit: Annotated[ + Optional[StrictInt], Field(description="The number to limit by") + ] = None, + search: Annotated[ + Optional[StrictStr], Field(description="The search query to filter for") + ] = None, + order_by_field: Annotated[ + Optional[RateLimitOrderByField], Field(description="What to order by") + ] = None, + order_by_direction: Annotated[ + Optional[RateLimitOrderByDirection], + Field(description="The order direction"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RateLimitList]: + """List rate limits + + Lists all rate limits for a tenant. + + :param tenant: The tenant id (required) + :type tenant: str + :param offset: The number to skip + :type offset: int + :param limit: The number to limit by + :type limit: int + :param search: The search query to filter for + :type search: str + :param order_by_field: What to order by + :type order_by_field: RateLimitOrderByField + :param order_by_direction: The order direction + :type order_by_direction: RateLimitOrderByDirection + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rate_limit_list_serialize( + tenant=tenant, + offset=offset, + limit=limit, + search=search, + order_by_field=order_by_field, + order_by_direction=order_by_direction, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "RateLimitList", + "400": "APIErrors", + "403": "APIErrors", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def rate_limit_list_without_preload_content( + self, + tenant: Annotated[ + str, + Field( + min_length=36, strict=True, max_length=36, description="The tenant id" + ), + ], + offset: Annotated[ + Optional[StrictInt], Field(description="The number to skip") + ] = None, + limit: Annotated[ + Optional[StrictInt], Field(description="The number to limit by") + ] = None, + search: Annotated[ + Optional[StrictStr], Field(description="The search query to filter for") + ] = None, + order_by_field: Annotated[ + Optional[RateLimitOrderByField], Field(description="What to order by") + ] = None, + order_by_direction: Annotated[ + Optional[RateLimitOrderByDirection], + Field(description="The order direction"), + ] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """List rate limits + + Lists all rate limits for a tenant. + + :param tenant: The tenant id (required) + :type tenant: str + :param offset: The number to skip + :type offset: int + :param limit: The number to limit by + :type limit: int + :param search: The search query to filter for + :type search: str + :param order_by_field: What to order by + :type order_by_field: RateLimitOrderByField + :param order_by_direction: The order direction + :type order_by_direction: RateLimitOrderByDirection + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._rate_limit_list_serialize( + tenant=tenant, + offset=offset, + limit=limit, + search=search, + order_by_field=order_by_field, + order_by_direction=order_by_direction, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "RateLimitList", + "400": "APIErrors", + "403": "APIErrors", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _rate_limit_list_serialize( + self, + tenant, + offset, + limit, + search, + order_by_field, + order_by_direction, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if tenant is not None: + _path_params["tenant"] = tenant + # process the query parameters + if offset is not None: + + _query_params.append(("offset", offset)) + + if limit is not None: + + _query_params.append(("limit", limit)) + + if search is not None: + + _query_params.append(("search", search)) + + if order_by_field is not None: + + _query_params.append(("orderByField", order_by_field.value)) + + if order_by_direction is not None: + + _query_params.append(("orderByDirection", order_by_direction.value)) + + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/tenants/{tenant}/rate-limits", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) diff --git a/hatchet_sdk/clients/rest/api/slack_api.py b/hatchet_sdk/clients/rest/api/slack_api.py index e12b65ab..6a0a0e43 100644 --- a/hatchet_sdk/clients/rest/api/slack_api.py +++ b/hatchet_sdk/clients/rest/api/slack_api.py @@ -285,10 +285,9 @@ def _slack_webhook_delete_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -549,10 +548,9 @@ def _slack_webhook_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] diff --git a/hatchet_sdk/clients/rest/api/sns_api.py b/hatchet_sdk/clients/rest/api/sns_api.py index d09763f7..f3214c03 100644 --- a/hatchet_sdk/clients/rest/api/sns_api.py +++ b/hatchet_sdk/clients/rest/api/sns_api.py @@ -295,10 +295,9 @@ def _sns_create_serialize( _body_params = create_sns_integration_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -578,10 +577,9 @@ def _sns_delete_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -842,10 +840,9 @@ def _sns_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] diff --git a/hatchet_sdk/clients/rest/api/step_run_api.py b/hatchet_sdk/clients/rest/api/step_run_api.py index 1a3db17c..5c60f199 100644 --- a/hatchet_sdk/clients/rest/api/step_run_api.py +++ b/hatchet_sdk/clients/rest/api/step_run_api.py @@ -309,10 +309,9 @@ def _step_run_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -603,10 +602,9 @@ def _step_run_get_schema_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -913,10 +911,9 @@ def _step_run_list_archives_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1223,10 +1220,9 @@ def _step_run_list_events_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1514,10 +1510,9 @@ def _step_run_update_cancel_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1826,10 +1821,9 @@ def _step_run_update_rerun_serialize( _body_params = rerun_step_run_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -2162,10 +2156,9 @@ def _workflow_run_list_step_run_events_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] diff --git a/hatchet_sdk/clients/rest/api/tenant_api.py b/hatchet_sdk/clients/rest/api/tenant_api.py index cacd78b8..16fe9310 100644 --- a/hatchet_sdk/clients/rest/api/tenant_api.py +++ b/hatchet_sdk/clients/rest/api/tenant_api.py @@ -43,6 +43,9 @@ from hatchet_sdk.clients.rest.models.tenant_member import TenantMember from hatchet_sdk.clients.rest.models.tenant_member_list import TenantMemberList from hatchet_sdk.clients.rest.models.tenant_resource_policy import TenantResourcePolicy +from hatchet_sdk.clients.rest.models.tenant_step_run_queue_metrics import ( + TenantStepRunQueueMetrics, +) from hatchet_sdk.clients.rest.models.update_tenant_alert_email_group_request import ( UpdateTenantAlertEmailGroupRequest, ) @@ -324,10 +327,9 @@ def _alert_email_group_create_serialize( _body_params = create_tenant_alert_email_group_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -604,10 +606,9 @@ def _alert_email_group_delete_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -865,10 +866,9 @@ def _alert_email_group_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1159,10 +1159,9 @@ def _alert_email_group_update_serialize( _body_params = update_tenant_alert_email_group_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -1430,10 +1429,9 @@ def _tenant_alerting_settings_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1682,10 +1680,9 @@ def _tenant_create_serialize( _body_params = create_tenant_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -1715,6 +1712,269 @@ def _tenant_create_serialize( _request_auth=_request_auth, ) + @validate_call + async def tenant_get_step_run_queue_metrics( + self, + tenant: Annotated[ + str, + Field( + min_length=36, strict=True, max_length=36, description="The tenant id" + ), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TenantStepRunQueueMetrics: + """Get step run metrics + + Get the queue metrics for the tenant + + :param tenant: The tenant id (required) + :type tenant: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._tenant_get_step_run_queue_metrics_serialize( + tenant=tenant, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TenantStepRunQueueMetrics", + "400": "APIErrors", + "403": "APIErrors", + "404": "APIErrors", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def tenant_get_step_run_queue_metrics_with_http_info( + self, + tenant: Annotated[ + str, + Field( + min_length=36, strict=True, max_length=36, description="The tenant id" + ), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TenantStepRunQueueMetrics]: + """Get step run metrics + + Get the queue metrics for the tenant + + :param tenant: The tenant id (required) + :type tenant: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._tenant_get_step_run_queue_metrics_serialize( + tenant=tenant, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TenantStepRunQueueMetrics", + "400": "APIErrors", + "403": "APIErrors", + "404": "APIErrors", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def tenant_get_step_run_queue_metrics_without_preload_content( + self, + tenant: Annotated[ + str, + Field( + min_length=36, strict=True, max_length=36, description="The tenant id" + ), + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Get step run metrics + + Get the queue metrics for the tenant + + :param tenant: The tenant id (required) + :type tenant: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._tenant_get_step_run_queue_metrics_serialize( + tenant=tenant, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "TenantStepRunQueueMetrics", + "400": "APIErrors", + "403": "APIErrors", + "404": "APIErrors", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _tenant_get_step_run_queue_metrics_serialize( + self, + tenant, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if tenant is not None: + _path_params["tenant"] = tenant + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # authentication setting + _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] + + return self.api_client.param_serialize( + method="GET", + resource_path="/api/v1/tenants/{tenant}/step-run-queue-metrics", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + @validate_call async def tenant_invite_accept( self, @@ -1938,10 +2198,9 @@ def _tenant_invite_accept_serialize( _body_params = accept_invite_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -2230,10 +2489,9 @@ def _tenant_invite_create_serialize( _body_params = create_tenant_invite_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -2501,10 +2759,9 @@ def _tenant_invite_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -2747,10 +3004,9 @@ def _tenant_invite_reject_serialize( _body_params = reject_invite_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -3060,10 +3316,9 @@ def _tenant_member_delete_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -3321,10 +3576,9 @@ def _tenant_member_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -3582,10 +3836,9 @@ def _tenant_resource_policy_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -3864,10 +4117,9 @@ def _tenant_update_serialize( _body_params = update_tenant_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -4105,10 +4357,9 @@ def _user_list_tenant_invites_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth"] diff --git a/hatchet_sdk/clients/rest/api/user_api.py b/hatchet_sdk/clients/rest/api/user_api.py index 2c32e668..a0617fd3 100644 --- a/hatchet_sdk/clients/rest/api/user_api.py +++ b/hatchet_sdk/clients/rest/api/user_api.py @@ -251,10 +251,9 @@ def _tenant_memberships_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth"] @@ -500,10 +499,9 @@ def _user_create_serialize( _body_params = user_register_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -744,10 +742,9 @@ def _user_get_current_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth"] @@ -1869,10 +1866,9 @@ def _user_update_login_serialize( _body_params = user_login_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -2113,10 +2109,9 @@ def _user_update_logout_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth"] @@ -2362,10 +2357,9 @@ def _user_update_password_serialize( _body_params = user_change_password_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: diff --git a/hatchet_sdk/clients/rest/api/worker_api.py b/hatchet_sdk/clients/rest/api/worker_api.py index 81bc7696..e50f80b9 100644 --- a/hatchet_sdk/clients/rest/api/worker_api.py +++ b/hatchet_sdk/clients/rest/api/worker_api.py @@ -275,10 +275,9 @@ def _worker_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -536,10 +535,9 @@ def _worker_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -818,10 +816,9 @@ def _worker_update_serialize( _body_params = update_worker_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: diff --git a/hatchet_sdk/clients/rest/api/workflow_api.py b/hatchet_sdk/clients/rest/api/workflow_api.py index 19d150e9..0c0beefd 100644 --- a/hatchet_sdk/clients/rest/api/workflow_api.py +++ b/hatchet_sdk/clients/rest/api/workflow_api.py @@ -36,6 +36,9 @@ from hatchet_sdk.clients.rest.models.workflow_run_shape import WorkflowRunShape from hatchet_sdk.clients.rest.models.workflow_run_status import WorkflowRunStatus from hatchet_sdk.clients.rest.models.workflow_runs_metrics import WorkflowRunsMetrics +from hatchet_sdk.clients.rest.models.workflow_update_request import ( + WorkflowUpdateRequest, +) from hatchet_sdk.clients.rest.models.workflow_version import WorkflowVersion from hatchet_sdk.clients.rest.models.workflow_workers_count import WorkflowWorkersCount from hatchet_sdk.clients.rest.rest import RESTResponseType @@ -349,10 +352,9 @@ def _tenant_get_queue_metrics_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -613,10 +615,9 @@ def _workflow_delete_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -877,10 +878,9 @@ def _workflow_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1190,10 +1190,9 @@ def _workflow_get_metrics_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1481,10 +1480,9 @@ def _workflow_get_workers_count_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1742,10 +1740,9 @@ def _workflow_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -2042,10 +2039,9 @@ def _workflow_run_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -2501,10 +2497,9 @@ def _workflow_run_get_metrics_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -2801,10 +2796,9 @@ def _workflow_run_get_shape_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -2875,6 +2869,14 @@ async def workflow_run_list( Optional[datetime], Field(description="The time before the workflow run was created"), ] = None, + finished_after: Annotated[ + Optional[datetime], + Field(description="The time after the workflow run was finished"), + ] = None, + finished_before: Annotated[ + Optional[datetime], + Field(description="The time before the workflow run was finished"), + ] = None, order_by_field: Annotated[ Optional[WorkflowRunOrderByField], Field(description="The order by field") ] = None, @@ -2922,6 +2924,10 @@ async def workflow_run_list( :type created_after: datetime :param created_before: The time before the workflow run was created :type created_before: datetime + :param finished_after: The time after the workflow run was finished + :type finished_after: datetime + :param finished_before: The time before the workflow run was finished + :type finished_before: datetime :param order_by_field: The order by field :type order_by_field: WorkflowRunOrderByField :param order_by_direction: The order by direction @@ -2961,6 +2967,8 @@ async def workflow_run_list( additional_metadata=additional_metadata, created_after=created_after, created_before=created_before, + finished_after=finished_after, + finished_before=finished_before, order_by_field=order_by_field, order_by_direction=order_by_direction, _request_auth=_request_auth, @@ -3034,6 +3042,14 @@ async def workflow_run_list_with_http_info( Optional[datetime], Field(description="The time before the workflow run was created"), ] = None, + finished_after: Annotated[ + Optional[datetime], + Field(description="The time after the workflow run was finished"), + ] = None, + finished_before: Annotated[ + Optional[datetime], + Field(description="The time before the workflow run was finished"), + ] = None, order_by_field: Annotated[ Optional[WorkflowRunOrderByField], Field(description="The order by field") ] = None, @@ -3081,6 +3097,10 @@ async def workflow_run_list_with_http_info( :type created_after: datetime :param created_before: The time before the workflow run was created :type created_before: datetime + :param finished_after: The time after the workflow run was finished + :type finished_after: datetime + :param finished_before: The time before the workflow run was finished + :type finished_before: datetime :param order_by_field: The order by field :type order_by_field: WorkflowRunOrderByField :param order_by_direction: The order by direction @@ -3120,6 +3140,8 @@ async def workflow_run_list_with_http_info( additional_metadata=additional_metadata, created_after=created_after, created_before=created_before, + finished_after=finished_after, + finished_before=finished_before, order_by_field=order_by_field, order_by_direction=order_by_direction, _request_auth=_request_auth, @@ -3193,6 +3215,14 @@ async def workflow_run_list_without_preload_content( Optional[datetime], Field(description="The time before the workflow run was created"), ] = None, + finished_after: Annotated[ + Optional[datetime], + Field(description="The time after the workflow run was finished"), + ] = None, + finished_before: Annotated[ + Optional[datetime], + Field(description="The time before the workflow run was finished"), + ] = None, order_by_field: Annotated[ Optional[WorkflowRunOrderByField], Field(description="The order by field") ] = None, @@ -3240,6 +3270,10 @@ async def workflow_run_list_without_preload_content( :type created_after: datetime :param created_before: The time before the workflow run was created :type created_before: datetime + :param finished_after: The time after the workflow run was finished + :type finished_after: datetime + :param finished_before: The time before the workflow run was finished + :type finished_before: datetime :param order_by_field: The order by field :type order_by_field: WorkflowRunOrderByField :param order_by_direction: The order by direction @@ -3279,6 +3313,8 @@ async def workflow_run_list_without_preload_content( additional_metadata=additional_metadata, created_after=created_after, created_before=created_before, + finished_after=finished_after, + finished_before=finished_before, order_by_field=order_by_field, order_by_direction=order_by_direction, _request_auth=_request_auth, @@ -3311,6 +3347,8 @@ def _workflow_run_list_serialize( additional_metadata, created_after, created_before, + finished_after, + finished_before, order_by_field, order_by_direction, _request_auth, @@ -3396,6 +3434,32 @@ def _workflow_run_list_serialize( else: _query_params.append(("createdBefore", created_before)) + if finished_after is not None: + if isinstance(finished_after, datetime): + _query_params.append( + ( + "finishedAfter", + finished_after.strftime( + self.api_client.configuration.datetime_format + ), + ) + ) + else: + _query_params.append(("finishedAfter", finished_after)) + + if finished_before is not None: + if isinstance(finished_before, datetime): + _query_params.append( + ( + "finishedBefore", + finished_before.strftime( + self.api_client.configuration.datetime_format + ), + ) + ) + else: + _query_params.append(("finishedBefore", finished_before)) + if order_by_field is not None: _query_params.append(("orderByField", order_by_field.value)) @@ -3409,10 +3473,9 @@ def _workflow_run_list_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -3432,6 +3495,297 @@ def _workflow_run_list_serialize( _request_auth=_request_auth, ) + @validate_call + async def workflow_update( + self, + workflow: Annotated[ + str, + Field( + min_length=36, strict=True, max_length=36, description="The workflow id" + ), + ], + workflow_update_request: Annotated[ + WorkflowUpdateRequest, Field(description="The input to update the workflow") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Workflow: + """Update workflow + + Update a workflow for a tenant + + :param workflow: The workflow id (required) + :type workflow: str + :param workflow_update_request: The input to update the workflow (required) + :type workflow_update_request: WorkflowUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._workflow_update_serialize( + workflow=workflow, + workflow_update_request=workflow_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Workflow", + "400": "APIErrors", + "403": "APIErrors", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + @validate_call + async def workflow_update_with_http_info( + self, + workflow: Annotated[ + str, + Field( + min_length=36, strict=True, max_length=36, description="The workflow id" + ), + ], + workflow_update_request: Annotated[ + WorkflowUpdateRequest, Field(description="The input to update the workflow") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Workflow]: + """Update workflow + + Update a workflow for a tenant + + :param workflow: The workflow id (required) + :type workflow: str + :param workflow_update_request: The input to update the workflow (required) + :type workflow_update_request: WorkflowUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._workflow_update_serialize( + workflow=workflow, + workflow_update_request=workflow_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Workflow", + "400": "APIErrors", + "403": "APIErrors", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + @validate_call + async def workflow_update_without_preload_content( + self, + workflow: Annotated[ + str, + Field( + min_length=36, strict=True, max_length=36, description="The workflow id" + ), + ], + workflow_update_request: Annotated[ + WorkflowUpdateRequest, Field(description="The input to update the workflow") + ], + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)] + ], + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """Update workflow + + Update a workflow for a tenant + + :param workflow: The workflow id (required) + :type workflow: str + :param workflow_update_request: The input to update the workflow (required) + :type workflow_update_request: WorkflowUpdateRequest + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._workflow_update_serialize( + workflow=workflow, + workflow_update_request=workflow_update_request, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index, + ) + + _response_types_map: Dict[str, Optional[str]] = { + "200": "Workflow", + "400": "APIErrors", + "403": "APIErrors", + } + response_data = await self.api_client.call_api( + *_param, _request_timeout=_request_timeout + ) + return response_data.response + + def _workflow_update_serialize( + self, + workflow, + workflow_update_request, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = {} + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + if workflow is not None: + _path_params["workflow"] = workflow + # process the query parameters + # process the header parameters + # process the form parameters + # process the body parameter + if workflow_update_request is not None: + _body_params = workflow_update_request + + # set the HTTP header `Accept` + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params["Content-Type"] = _content_type + else: + _default_content_type = self.api_client.select_header_content_type( + ["application/json"] + ) + if _default_content_type is not None: + _header_params["Content-Type"] = _default_content_type + + # authentication setting + _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] + + return self.api_client.param_serialize( + method="PATCH", + resource_path="/api/v1/workflows/{workflow}", + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth, + ) + @validate_call async def workflow_version_get( self, @@ -3705,10 +4059,9 @@ def _workflow_version_get_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] diff --git a/hatchet_sdk/clients/rest/api/workflow_run_api.py b/hatchet_sdk/clients/rest/api/workflow_run_api.py index 5583e223..7a4c6c6b 100644 --- a/hatchet_sdk/clients/rest/api/workflow_run_api.py +++ b/hatchet_sdk/clients/rest/api/workflow_run_api.py @@ -312,10 +312,9 @@ def _workflow_run_cancel_serialize( _body_params = workflow_runs_cancel_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -645,10 +644,9 @@ def _workflow_run_create_serialize( _body_params = trigger_workflow_run_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: @@ -958,10 +956,9 @@ def _workflow_run_get_input_serialize( # process the body parameter # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # authentication setting _auth_settings: List[str] = ["cookieAuth", "bearerAuth"] @@ -1246,10 +1243,9 @@ def _workflow_run_update_replay_serialize( _body_params = replay_workflow_runs_request # set the HTTP header `Accept` - if "Accept" not in _header_params: - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) + _header_params["Accept"] = self.api_client.select_header_accept( + ["application/json"] + ) # set the HTTP header `Content-Type` if _content_type: diff --git a/hatchet_sdk/clients/rest/api_client.py b/hatchet_sdk/clients/rest/api_client.py index a35d765c..2980d8c1 100644 --- a/hatchet_sdk/clients/rest/api_client.py +++ b/hatchet_sdk/clients/rest/api_client.py @@ -13,7 +13,6 @@ import datetime -import decimal import json import mimetypes import os @@ -69,7 +68,6 @@ class ApiClient: "bool": bool, "date": datetime.date, "datetime": datetime.datetime, - "decimal": decimal.Decimal, "object": object, } _pool = None @@ -222,7 +220,7 @@ def param_serialize( body = self.sanitize_for_serialization(body) # request url - if _host is None or self.configuration.ignore_operation_servers: + if _host is None: url = self.configuration.host + resource_path else: # use server/host defined in path or operation instead @@ -313,9 +311,12 @@ def response_deserialize( match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) encoding = match.group(1) if match else "utf-8" response_text = response_data.data.decode(encoding) - return_data = self.deserialize( - response_text, response_type, content_type - ) + if response_type in ["bytearray", "str"]: + return_data = self.__deserialize_primitive( + response_text, response_type + ) + else: + return_data = self.deserialize(response_text, response_type) finally: if not 200 <= response_data.status <= 299: raise ApiException.from_response( @@ -339,7 +340,6 @@ def sanitize_for_serialization(self, obj): If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. - If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. @@ -361,8 +361,6 @@ def sanitize_for_serialization(self, obj): return tuple(self.sanitize_for_serialization(sub_obj) for sub_obj in obj) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() - elif isinstance(obj, decimal.Decimal): - return str(obj) elif isinstance(obj, dict): obj_dict = obj @@ -381,36 +379,21 @@ def sanitize_for_serialization(self, obj): key: self.sanitize_for_serialization(val) for key, val in obj_dict.items() } - def deserialize( - self, response_text: str, response_type: str, content_type: Optional[str] - ): + def deserialize(self, response_text, response_type): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. :param response_type: class literal for deserialized object, or string of class name. - :param content_type: content type of response. :return: deserialized object. """ # fetch data from response object - if content_type is None: - try: - data = json.loads(response_text) - except ValueError: - data = response_text - elif content_type.startswith("application/json"): - if response_text == "": - data = "" - else: - data = json.loads(response_text) - elif content_type.startswith("text/plain"): + try: + data = json.loads(response_text) + except ValueError: data = response_text - else: - raise ApiException( - status=0, reason="Unsupported content type: {0}".format(content_type) - ) return self.__deserialize(data, response_type) @@ -452,8 +435,6 @@ def __deserialize(self, data, klass): return self.__deserialize_date(data) elif klass == datetime.datetime: return self.__deserialize_datetime(data) - elif klass == decimal.Decimal: - return decimal.Decimal(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: diff --git a/hatchet_sdk/clients/rest/configuration.py b/hatchet_sdk/clients/rest/configuration.py index 03743d0b..e33efa68 100644 --- a/hatchet_sdk/clients/rest/configuration.py +++ b/hatchet_sdk/clients/rest/configuration.py @@ -39,9 +39,6 @@ class Configuration: """This class contains various settings of the API client. :param host: Base url. - :param ignore_operation_servers - Boolean to ignore operation servers for the API client. - Config will use `host` as the base url regardless of the operation servers. :param api_key: Dict to store API key(s). Each entry in the dict specifies an API key. The dict key is the name of the security scheme in the OAS specification. @@ -64,7 +61,6 @@ class Configuration: values before. :param ssl_ca_cert: str - the path to a file of concatenated CA certificates in PEM format. - :param retries: Number of retries for API requests. :Example: @@ -102,11 +98,7 @@ def __init__( server_variables=None, server_operation_index=None, server_operation_variables=None, - ignore_operation_servers=False, ssl_ca_cert=None, - retries=None, - *, - debug: Optional[bool] = None ) -> None: """Constructor""" self._base_path = "http://localhost" if host is None else host @@ -120,9 +112,6 @@ def __init__( self.server_operation_variables = server_operation_variables or {} """Default server variables """ - self.ignore_operation_servers = ignore_operation_servers - """Ignore operation servers - """ self.temp_folder_path = None """Temp file folder for downloading files """ @@ -166,10 +155,7 @@ def __init__( self.logger_file = None """Debug file location """ - if debug is not None: - self.debug = debug - else: - self.__debug = False + self.debug = False """Debug switch """ @@ -209,7 +195,7 @@ def __init__( self.safe_chars_for_path_param = "" """Safe chars for path_param """ - self.retries = retries + self.retries = None """Adding retries to override urllib3 default value 3 """ # Enable client side validation diff --git a/hatchet_sdk/clients/rest/models/__init__.py b/hatchet_sdk/clients/rest/models/__init__.py index fab0ace1..9c550c2e 100644 --- a/hatchet_sdk/clients/rest/models/__init__.py +++ b/hatchet_sdk/clients/rest/models/__init__.py @@ -90,6 +90,14 @@ from hatchet_sdk.clients.rest.models.pull_request import PullRequest from hatchet_sdk.clients.rest.models.pull_request_state import PullRequestState from hatchet_sdk.clients.rest.models.queue_metrics import QueueMetrics +from hatchet_sdk.clients.rest.models.rate_limit import RateLimit +from hatchet_sdk.clients.rest.models.rate_limit_list import RateLimitList +from hatchet_sdk.clients.rest.models.rate_limit_order_by_direction import ( + RateLimitOrderByDirection, +) +from hatchet_sdk.clients.rest.models.rate_limit_order_by_field import ( + RateLimitOrderByField, +) from hatchet_sdk.clients.rest.models.recent_step_runs import RecentStepRuns from hatchet_sdk.clients.rest.models.reject_invite_request import RejectInviteRequest from hatchet_sdk.clients.rest.models.replay_event_request import ReplayEventRequest @@ -133,6 +141,9 @@ from hatchet_sdk.clients.rest.models.tenant_resource import TenantResource from hatchet_sdk.clients.rest.models.tenant_resource_limit import TenantResourceLimit from hatchet_sdk.clients.rest.models.tenant_resource_policy import TenantResourcePolicy +from hatchet_sdk.clients.rest.models.tenant_step_run_queue_metrics import ( + TenantStepRunQueueMetrics, +) from hatchet_sdk.clients.rest.models.trigger_workflow_run_request import ( TriggerWorkflowRunRequest, ) @@ -208,6 +219,9 @@ WorkflowTriggerEventRef, ) from hatchet_sdk.clients.rest.models.workflow_triggers import WorkflowTriggers +from hatchet_sdk.clients.rest.models.workflow_update_request import ( + WorkflowUpdateRequest, +) from hatchet_sdk.clients.rest.models.workflow_version import WorkflowVersion from hatchet_sdk.clients.rest.models.workflow_version_definition import ( WorkflowVersionDefinition, diff --git a/hatchet_sdk/clients/rest/models/api_errors.py b/hatchet_sdk/clients/rest/models/api_errors.py index e4dfed11..e41cf5fc 100644 --- a/hatchet_sdk/clients/rest/models/api_errors.py +++ b/hatchet_sdk/clients/rest/models/api_errors.py @@ -73,9 +73,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in errors (list) _items = [] if self.errors: - for _item_errors in self.errors: - if _item_errors: - _items.append(_item_errors.to_dict()) + for _item in self.errors: + if _item: + _items.append(_item.to_dict()) _dict["errors"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/bulk_create_event_request.py b/hatchet_sdk/clients/rest/models/bulk_create_event_request.py index 8d08d394..2c053ee1 100644 --- a/hatchet_sdk/clients/rest/models/bulk_create_event_request.py +++ b/hatchet_sdk/clients/rest/models/bulk_create_event_request.py @@ -73,9 +73,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in events (list) _items = [] if self.events: - for _item_events in self.events: - if _item_events: - _items.append(_item_events.to_dict()) + for _item in self.events: + if _item: + _items.append(_item.to_dict()) _dict["events"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/bulk_create_event_response.py b/hatchet_sdk/clients/rest/models/bulk_create_event_response.py index fd084252..5fd1f3a1 100644 --- a/hatchet_sdk/clients/rest/models/bulk_create_event_response.py +++ b/hatchet_sdk/clients/rest/models/bulk_create_event_response.py @@ -24,7 +24,6 @@ from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta from hatchet_sdk.clients.rest.models.event import Event -from hatchet_sdk.clients.rest.models.pagination_response import PaginationResponse class BulkCreateEventResponse(BaseModel): @@ -34,8 +33,7 @@ class BulkCreateEventResponse(BaseModel): metadata: APIResourceMeta events: List[Event] = Field(description="The events.") - pagination: PaginationResponse = Field(description="The pagination information.") - __properties: ClassVar[List[str]] = ["metadata", "events", "pagination"] + __properties: ClassVar[List[str]] = ["metadata", "events"] model_config = ConfigDict( populate_by_name=True, @@ -80,13 +78,10 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in events (list) _items = [] if self.events: - for _item_events in self.events: - if _item_events: - _items.append(_item_events.to_dict()) + for _item in self.events: + if _item: + _items.append(_item.to_dict()) _dict["events"] = _items - # override the default output from pydantic by calling `to_dict()` of pagination - if self.pagination: - _dict["pagination"] = self.pagination.to_dict() return _dict @classmethod @@ -110,11 +105,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if obj.get("events") is not None else None ), - "pagination": ( - PaginationResponse.from_dict(obj["pagination"]) - if obj.get("pagination") is not None - else None - ), } ) return _obj diff --git a/hatchet_sdk/clients/rest/models/event_list.py b/hatchet_sdk/clients/rest/models/event_list.py index 5c928005..e12aa656 100644 --- a/hatchet_sdk/clients/rest/models/event_list.py +++ b/hatchet_sdk/clients/rest/models/event_list.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/get_step_run_diff_response.py b/hatchet_sdk/clients/rest/models/get_step_run_diff_response.py index b9dbc435..c01018b6 100644 --- a/hatchet_sdk/clients/rest/models/get_step_run_diff_response.py +++ b/hatchet_sdk/clients/rest/models/get_step_run_diff_response.py @@ -73,9 +73,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in diffs (list) _items = [] if self.diffs: - for _item_diffs in self.diffs: - if _item_diffs: - _items.append(_item_diffs.to_dict()) + for _item in self.diffs: + if _item: + _items.append(_item.to_dict()) _dict["diffs"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/job.py b/hatchet_sdk/clients/rest/models/job.py index c412ef68..aceaf6f4 100644 --- a/hatchet_sdk/clients/rest/models/job.py +++ b/hatchet_sdk/clients/rest/models/job.py @@ -95,9 +95,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in steps (list) _items = [] if self.steps: - for _item_steps in self.steps: - if _item_steps: - _items.append(_item_steps.to_dict()) + for _item in self.steps: + if _item: + _items.append(_item.to_dict()) _dict["steps"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/job_run.py b/hatchet_sdk/clients/rest/models/job_run.py index 3a7ec051..a9b0da3b 100644 --- a/hatchet_sdk/clients/rest/models/job_run.py +++ b/hatchet_sdk/clients/rest/models/job_run.py @@ -117,9 +117,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in step_runs (list) _items = [] if self.step_runs: - for _item_step_runs in self.step_runs: - if _item_step_runs: - _items.append(_item_step_runs.to_dict()) + for _item in self.step_runs: + if _item: + _items.append(_item.to_dict()) _dict["stepRuns"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/list_api_tokens_response.py b/hatchet_sdk/clients/rest/models/list_api_tokens_response.py index b3590ab3..df9b60ac 100644 --- a/hatchet_sdk/clients/rest/models/list_api_tokens_response.py +++ b/hatchet_sdk/clients/rest/models/list_api_tokens_response.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/list_pull_requests_response.py b/hatchet_sdk/clients/rest/models/list_pull_requests_response.py index 589d4c45..6cfd61bb 100644 --- a/hatchet_sdk/clients/rest/models/list_pull_requests_response.py +++ b/hatchet_sdk/clients/rest/models/list_pull_requests_response.py @@ -73,9 +73,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in pull_requests (list) _items = [] if self.pull_requests: - for _item_pull_requests in self.pull_requests: - if _item_pull_requests: - _items.append(_item_pull_requests.to_dict()) + for _item in self.pull_requests: + if _item: + _items.append(_item.to_dict()) _dict["pullRequests"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/list_slack_webhooks.py b/hatchet_sdk/clients/rest/models/list_slack_webhooks.py index e86956d3..647bc276 100644 --- a/hatchet_sdk/clients/rest/models/list_slack_webhooks.py +++ b/hatchet_sdk/clients/rest/models/list_slack_webhooks.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/list_sns_integrations.py b/hatchet_sdk/clients/rest/models/list_sns_integrations.py index 130e9127..ecf67484 100644 --- a/hatchet_sdk/clients/rest/models/list_sns_integrations.py +++ b/hatchet_sdk/clients/rest/models/list_sns_integrations.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/log_line_list.py b/hatchet_sdk/clients/rest/models/log_line_list.py index e05d186a..306ee2c7 100644 --- a/hatchet_sdk/clients/rest/models/log_line_list.py +++ b/hatchet_sdk/clients/rest/models/log_line_list.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/rate_limit.py b/hatchet_sdk/clients/rest/models/rate_limit.py new file mode 100644 index 00000000..0bf88522 --- /dev/null +++ b/hatchet_sdk/clients/rest/models/rate_limit.py @@ -0,0 +1,117 @@ +# coding: utf-8 + +""" + Hatchet API + + The Hatchet API + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from datetime import datetime +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing_extensions import Self + + +class RateLimit(BaseModel): + """ + RateLimit + """ # noqa: E501 + + key: StrictStr = Field(description="The key for the rate limit.") + tenant_id: StrictStr = Field( + description="The ID of the tenant associated with this rate limit.", + alias="tenantId", + ) + limit_value: StrictInt = Field( + description="The maximum number of requests allowed within the window.", + alias="limitValue", + ) + value: StrictInt = Field( + description="The current number of requests made within the window." + ) + window: StrictStr = Field( + description="The window of time in which the limitValue is enforced." + ) + last_refill: datetime = Field( + description="The last time the rate limit was refilled.", alias="lastRefill" + ) + __properties: ClassVar[List[str]] = [ + "key", + "tenantId", + "limitValue", + "value", + "window", + "lastRefill", + ] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RateLimit from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RateLimit from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "key": obj.get("key"), + "tenantId": obj.get("tenantId"), + "limitValue": obj.get("limitValue"), + "value": obj.get("value"), + "window": obj.get("window"), + "lastRefill": obj.get("lastRefill"), + } + ) + return _obj diff --git a/hatchet_sdk/clients/rest/models/rate_limit_list.py b/hatchet_sdk/clients/rest/models/rate_limit_list.py new file mode 100644 index 00000000..24df2f3a --- /dev/null +++ b/hatchet_sdk/clients/rest/models/rate_limit_list.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + Hatchet API + + The Hatchet API + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict +from typing_extensions import Self + +from hatchet_sdk.clients.rest.models.pagination_response import PaginationResponse +from hatchet_sdk.clients.rest.models.rate_limit import RateLimit + + +class RateLimitList(BaseModel): + """ + RateLimitList + """ # noqa: E501 + + pagination: Optional[PaginationResponse] = None + rows: Optional[List[RateLimit]] = None + __properties: ClassVar[List[str]] = ["pagination", "rows"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RateLimitList from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of pagination + if self.pagination: + _dict["pagination"] = self.pagination.to_dict() + # override the default output from pydantic by calling `to_dict()` of each item in rows (list) + _items = [] + if self.rows: + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) + _dict["rows"] = _items + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RateLimitList from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate( + { + "pagination": ( + PaginationResponse.from_dict(obj["pagination"]) + if obj.get("pagination") is not None + else None + ), + "rows": ( + [RateLimit.from_dict(_item) for _item in obj["rows"]] + if obj.get("rows") is not None + else None + ), + } + ) + return _obj diff --git a/hatchet_sdk/clients/rest/models/rate_limit_order_by_direction.py b/hatchet_sdk/clients/rest/models/rate_limit_order_by_direction.py new file mode 100644 index 00000000..64451da9 --- /dev/null +++ b/hatchet_sdk/clients/rest/models/rate_limit_order_by_direction.py @@ -0,0 +1,37 @@ +# coding: utf-8 + +""" + Hatchet API + + The Hatchet API + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations + +import json +from enum import Enum + +from typing_extensions import Self + + +class RateLimitOrderByDirection(str, Enum): + """ + RateLimitOrderByDirection + """ + + """ + allowed enum values + """ + ASC = "asc" + DESC = "desc" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of RateLimitOrderByDirection from a JSON string""" + return cls(json.loads(json_str)) diff --git a/hatchet_sdk/clients/rest/models/rate_limit_order_by_field.py b/hatchet_sdk/clients/rest/models/rate_limit_order_by_field.py new file mode 100644 index 00000000..6b5077be --- /dev/null +++ b/hatchet_sdk/clients/rest/models/rate_limit_order_by_field.py @@ -0,0 +1,38 @@ +# coding: utf-8 + +""" + Hatchet API + + The Hatchet API + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations + +import json +from enum import Enum + +from typing_extensions import Self + + +class RateLimitOrderByField(str, Enum): + """ + RateLimitOrderByField + """ + + """ + allowed enum values + """ + KEY = "key" + VALUE = "value" + LIMITVALUE = "limitValue" + + @classmethod + def from_json(cls, json_str: str) -> Self: + """Create an instance of RateLimitOrderByField from a JSON string""" + return cls(json.loads(json_str)) diff --git a/hatchet_sdk/clients/rest/models/replay_workflow_runs_response.py b/hatchet_sdk/clients/rest/models/replay_workflow_runs_response.py index d8a9609d..6f0f780f 100644 --- a/hatchet_sdk/clients/rest/models/replay_workflow_runs_response.py +++ b/hatchet_sdk/clients/rest/models/replay_workflow_runs_response.py @@ -73,9 +73,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in workflow_runs (list) _items = [] if self.workflow_runs: - for _item_workflow_runs in self.workflow_runs: - if _item_workflow_runs: - _items.append(_item_workflow_runs.to_dict()) + for _item in self.workflow_runs: + if _item: + _items.append(_item.to_dict()) _dict["workflowRuns"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/step_run_archive_list.py b/hatchet_sdk/clients/rest/models/step_run_archive_list.py index eb4bcef2..fcc1419c 100644 --- a/hatchet_sdk/clients/rest/models/step_run_archive_list.py +++ b/hatchet_sdk/clients/rest/models/step_run_archive_list.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/step_run_event_list.py b/hatchet_sdk/clients/rest/models/step_run_event_list.py index f146eb8e..a46f2089 100644 --- a/hatchet_sdk/clients/rest/models/step_run_event_list.py +++ b/hatchet_sdk/clients/rest/models/step_run_event_list.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/step_run_event_reason.py b/hatchet_sdk/clients/rest/models/step_run_event_reason.py index 348f7596..fb06bc67 100644 --- a/hatchet_sdk/clients/rest/models/step_run_event_reason.py +++ b/hatchet_sdk/clients/rest/models/step_run_event_reason.py @@ -33,6 +33,8 @@ class StepRunEventReason(str, Enum): SCHEDULING_TIMED_OUT = "SCHEDULING_TIMED_OUT" ASSIGNED = "ASSIGNED" STARTED = "STARTED" + ACKNOWLEDGED = "ACKNOWLEDGED" + REJECTED = "REJECTED" FINISHED = "FINISHED" FAILED = "FAILED" RETRYING = "RETRYING" diff --git a/hatchet_sdk/clients/rest/models/tenant_alert_email_group_list.py b/hatchet_sdk/clients/rest/models/tenant_alert_email_group_list.py index 73d67df4..9e1a4fc1 100644 --- a/hatchet_sdk/clients/rest/models/tenant_alert_email_group_list.py +++ b/hatchet_sdk/clients/rest/models/tenant_alert_email_group_list.py @@ -80,9 +80,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/tenant_invite_list.py b/hatchet_sdk/clients/rest/models/tenant_invite_list.py index 0ed078ef..95e4ba4d 100644 --- a/hatchet_sdk/clients/rest/models/tenant_invite_list.py +++ b/hatchet_sdk/clients/rest/models/tenant_invite_list.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/tenant_list.py b/hatchet_sdk/clients/rest/models/tenant_list.py index 2dbb320e..623d6206 100644 --- a/hatchet_sdk/clients/rest/models/tenant_list.py +++ b/hatchet_sdk/clients/rest/models/tenant_list.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/tenant_member_list.py b/hatchet_sdk/clients/rest/models/tenant_member_list.py index 5aabdcd1..6627c281 100644 --- a/hatchet_sdk/clients/rest/models/tenant_member_list.py +++ b/hatchet_sdk/clients/rest/models/tenant_member_list.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/tenant_queue_metrics.py b/hatchet_sdk/clients/rest/models/tenant_queue_metrics.py index 5b83ae45..02807090 100644 --- a/hatchet_sdk/clients/rest/models/tenant_queue_metrics.py +++ b/hatchet_sdk/clients/rest/models/tenant_queue_metrics.py @@ -19,7 +19,7 @@ import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field +from pydantic import BaseModel, ConfigDict, Field, StrictInt from typing_extensions import Self from hatchet_sdk.clients.rest.models.queue_metrics import QueueMetrics @@ -34,7 +34,8 @@ class TenantQueueMetrics(BaseModel): default=None, description="The total queue metrics." ) workflow: Optional[Dict[str, QueueMetrics]] = None - __properties: ClassVar[List[str]] = ["total", "workflow"] + queues: Optional[Dict[str, StrictInt]] = None + __properties: ClassVar[List[str]] = ["total", "workflow", "queues"] model_config = ConfigDict( populate_by_name=True, @@ -76,13 +77,6 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of total if self.total: _dict["total"] = self.total.to_dict() - # override the default output from pydantic by calling `to_dict()` of each value in workflow (dict) - _field_dict = {} - if self.workflow: - for _key_workflow in self.workflow: - if self.workflow[_key_workflow]: - _field_dict[_key_workflow] = self.workflow[_key_workflow].to_dict() - _dict["workflow"] = _field_dict return _dict @classmethod @@ -101,14 +95,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if obj.get("total") is not None else None ), - "workflow": ( - dict( - (_k, QueueMetrics.from_dict(_v)) - for _k, _v in obj["workflow"].items() - ) - if obj.get("workflow") is not None - else None - ), } ) return _obj diff --git a/hatchet_sdk/clients/rest/models/tenant_resource_policy.py b/hatchet_sdk/clients/rest/models/tenant_resource_policy.py index b9e5181f..c8f10af0 100644 --- a/hatchet_sdk/clients/rest/models/tenant_resource_policy.py +++ b/hatchet_sdk/clients/rest/models/tenant_resource_policy.py @@ -75,9 +75,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in limits (list) _items = [] if self.limits: - for _item_limits in self.limits: - if _item_limits: - _items.append(_item_limits.to_dict()) + for _item in self.limits: + if _item: + _items.append(_item.to_dict()) _dict["limits"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/tenant_step_run_queue_metrics.py b/hatchet_sdk/clients/rest/models/tenant_step_run_queue_metrics.py new file mode 100644 index 00000000..90f85ae6 --- /dev/null +++ b/hatchet_sdk/clients/rest/models/tenant_step_run_queue_metrics.py @@ -0,0 +1,83 @@ +# coding: utf-8 + +""" + Hatchet API + + The Hatchet API + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing_extensions import Self + + +class TenantStepRunQueueMetrics(BaseModel): + """ + TenantStepRunQueueMetrics + """ # noqa: E501 + + queues: Optional[Dict[str, StrictInt]] = None + __properties: ClassVar[List[str]] = ["queues"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TenantStepRunQueueMetrics from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TenantStepRunQueueMetrics from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({}) + return _obj diff --git a/hatchet_sdk/clients/rest/models/user_tenant_memberships_list.py b/hatchet_sdk/clients/rest/models/user_tenant_memberships_list.py index 98b8041b..1f45b260 100644 --- a/hatchet_sdk/clients/rest/models/user_tenant_memberships_list.py +++ b/hatchet_sdk/clients/rest/models/user_tenant_memberships_list.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/webhook_worker_list_response.py b/hatchet_sdk/clients/rest/models/webhook_worker_list_response.py index a221e182..2d9e08c7 100644 --- a/hatchet_sdk/clients/rest/models/webhook_worker_list_response.py +++ b/hatchet_sdk/clients/rest/models/webhook_worker_list_response.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/webhook_worker_request_list_response.py b/hatchet_sdk/clients/rest/models/webhook_worker_request_list_response.py index ec813a38..30915cd0 100644 --- a/hatchet_sdk/clients/rest/models/webhook_worker_request_list_response.py +++ b/hatchet_sdk/clients/rest/models/webhook_worker_request_list_response.py @@ -75,9 +75,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in requests (list) _items = [] if self.requests: - for _item_requests in self.requests: - if _item_requests: - _items.append(_item_requests.to_dict()) + for _item in self.requests: + if _item: + _items.append(_item.to_dict()) _dict["requests"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/worker.py b/hatchet_sdk/clients/rest/models/worker.py index 0d89492a..48e6eda8 100644 --- a/hatchet_sdk/clients/rest/models/worker.py +++ b/hatchet_sdk/clients/rest/models/worker.py @@ -169,23 +169,23 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in slots (list) _items = [] if self.slots: - for _item_slots in self.slots: - if _item_slots: - _items.append(_item_slots.to_dict()) + for _item in self.slots: + if _item: + _items.append(_item.to_dict()) _dict["slots"] = _items # override the default output from pydantic by calling `to_dict()` of each item in recent_step_runs (list) _items = [] if self.recent_step_runs: - for _item_recent_step_runs in self.recent_step_runs: - if _item_recent_step_runs: - _items.append(_item_recent_step_runs.to_dict()) + for _item in self.recent_step_runs: + if _item: + _items.append(_item.to_dict()) _dict["recentStepRuns"] = _items # override the default output from pydantic by calling `to_dict()` of each item in labels (list) _items = [] if self.labels: - for _item_labels in self.labels: - if _item_labels: - _items.append(_item_labels.to_dict()) + for _item in self.labels: + if _item: + _items.append(_item.to_dict()) _dict["labels"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/worker_list.py b/hatchet_sdk/clients/rest/models/worker_list.py index bb02d792..3ffa4349 100644 --- a/hatchet_sdk/clients/rest/models/worker_list.py +++ b/hatchet_sdk/clients/rest/models/worker_list.py @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/workflow.py b/hatchet_sdk/clients/rest/models/workflow.py index 59e07b08..42fd94dd 100644 --- a/hatchet_sdk/clients/rest/models/workflow.py +++ b/hatchet_sdk/clients/rest/models/workflow.py @@ -19,7 +19,7 @@ import re # noqa: F401 from typing import Any, ClassVar, Dict, List, Optional, Set -from pydantic import BaseModel, ConfigDict, Field, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr from typing_extensions import Self from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta @@ -37,6 +37,9 @@ class Workflow(BaseModel): description: Optional[StrictStr] = Field( default=None, description="The description of the workflow." ) + is_paused: Optional[StrictBool] = Field( + default=None, description="Whether the workflow is paused.", alias="isPaused" + ) versions: Optional[List[WorkflowVersionMeta]] = None tags: Optional[List[WorkflowTag]] = Field( default=None, description="The tags of the workflow." @@ -48,6 +51,7 @@ class Workflow(BaseModel): "metadata", "name", "description", + "isPaused", "versions", "tags", "jobs", @@ -96,23 +100,23 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in versions (list) _items = [] if self.versions: - for _item_versions in self.versions: - if _item_versions: - _items.append(_item_versions.to_dict()) + for _item in self.versions: + if _item: + _items.append(_item.to_dict()) _dict["versions"] = _items # override the default output from pydantic by calling `to_dict()` of each item in tags (list) _items = [] if self.tags: - for _item_tags in self.tags: - if _item_tags: - _items.append(_item_tags.to_dict()) + for _item in self.tags: + if _item: + _items.append(_item.to_dict()) _dict["tags"] = _items # override the default output from pydantic by calling `to_dict()` of each item in jobs (list) _items = [] if self.jobs: - for _item_jobs in self.jobs: - if _item_jobs: - _items.append(_item_jobs.to_dict()) + for _item in self.jobs: + if _item: + _items.append(_item.to_dict()) _dict["jobs"] = _items return _dict @@ -134,6 +138,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: ), "name": obj.get("name"), "description": obj.get("description"), + "isPaused": obj.get("isPaused"), "versions": ( [WorkflowVersionMeta.from_dict(_item) for _item in obj["versions"]] if obj.get("versions") is not None diff --git a/hatchet_sdk/clients/rest/models/workflow_list.py b/hatchet_sdk/clients/rest/models/workflow_list.py index 9eb14aee..72f9fb90 100644 --- a/hatchet_sdk/clients/rest/models/workflow_list.py +++ b/hatchet_sdk/clients/rest/models/workflow_list.py @@ -80,9 +80,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items # override the default output from pydantic by calling `to_dict()` of pagination if self.pagination: diff --git a/hatchet_sdk/clients/rest/models/workflow_run.py b/hatchet_sdk/clients/rest/models/workflow_run.py index 903da30f..3362b830 100644 --- a/hatchet_sdk/clients/rest/models/workflow_run.py +++ b/hatchet_sdk/clients/rest/models/workflow_run.py @@ -125,9 +125,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in job_runs (list) _items = [] if self.job_runs: - for _item_job_runs in self.job_runs: - if _item_job_runs: - _items.append(_item_job_runs.to_dict()) + for _item in self.job_runs: + if _item: + _items.append(_item.to_dict()) _dict["jobRuns"] = _items # override the default output from pydantic by calling `to_dict()` of triggered_by if self.triggered_by: diff --git a/hatchet_sdk/clients/rest/models/workflow_run_list.py b/hatchet_sdk/clients/rest/models/workflow_run_list.py index a56d3feb..e57a14f4 100644 --- a/hatchet_sdk/clients/rest/models/workflow_run_list.py +++ b/hatchet_sdk/clients/rest/models/workflow_run_list.py @@ -75,9 +75,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in rows (list) _items = [] if self.rows: - for _item_rows in self.rows: - if _item_rows: - _items.append(_item_rows.to_dict()) + for _item in self.rows: + if _item: + _items.append(_item.to_dict()) _dict["rows"] = _items # override the default output from pydantic by calling `to_dict()` of pagination if self.pagination: diff --git a/hatchet_sdk/clients/rest/models/workflow_run_shape.py b/hatchet_sdk/clients/rest/models/workflow_run_shape.py index 426e7ef9..dec6a4fd 100644 --- a/hatchet_sdk/clients/rest/models/workflow_run_shape.py +++ b/hatchet_sdk/clients/rest/models/workflow_run_shape.py @@ -128,9 +128,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in job_runs (list) _items = [] if self.job_runs: - for _item_job_runs in self.job_runs: - if _item_job_runs: - _items.append(_item_job_runs.to_dict()) + for _item in self.job_runs: + if _item: + _items.append(_item.to_dict()) _dict["jobRuns"] = _items # override the default output from pydantic by calling `to_dict()` of triggered_by if self.triggered_by: diff --git a/hatchet_sdk/clients/rest/models/workflow_triggers.py b/hatchet_sdk/clients/rest/models/workflow_triggers.py index fd2f07ef..d3fff3f1 100644 --- a/hatchet_sdk/clients/rest/models/workflow_triggers.py +++ b/hatchet_sdk/clients/rest/models/workflow_triggers.py @@ -92,16 +92,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in events (list) _items = [] if self.events: - for _item_events in self.events: - if _item_events: - _items.append(_item_events.to_dict()) + for _item in self.events: + if _item: + _items.append(_item.to_dict()) _dict["events"] = _items # override the default output from pydantic by calling `to_dict()` of each item in crons (list) _items = [] if self.crons: - for _item_crons in self.crons: - if _item_crons: - _items.append(_item_crons.to_dict()) + for _item in self.crons: + if _item: + _items.append(_item.to_dict()) _dict["crons"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/models/workflow_update_request.py b/hatchet_sdk/clients/rest/models/workflow_update_request.py new file mode 100644 index 00000000..5ec56835 --- /dev/null +++ b/hatchet_sdk/clients/rest/models/workflow_update_request.py @@ -0,0 +1,85 @@ +# coding: utf-8 + +""" + Hatchet API + + The Hatchet API + + The version of the OpenAPI document: 1.0.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations + +import json +import pprint +import re # noqa: F401 +from typing import Any, ClassVar, Dict, List, Optional, Set + +from pydantic import BaseModel, ConfigDict, Field, StrictBool +from typing_extensions import Self + + +class WorkflowUpdateRequest(BaseModel): + """ + WorkflowUpdateRequest + """ # noqa: E501 + + is_paused: Optional[StrictBool] = Field( + default=None, description="Whether the workflow is paused.", alias="isPaused" + ) + __properties: ClassVar[List[str]] = ["isPaused"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WorkflowUpdateRequest from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + """ + excluded_fields: Set[str] = set([]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WorkflowUpdateRequest from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({"isPaused": obj.get("isPaused")}) + return _obj diff --git a/hatchet_sdk/clients/rest/models/workflow_version.py b/hatchet_sdk/clients/rest/models/workflow_version.py index 47554e56..87d0cb29 100644 --- a/hatchet_sdk/clients/rest/models/workflow_version.py +++ b/hatchet_sdk/clients/rest/models/workflow_version.py @@ -117,9 +117,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in jobs (list) _items = [] if self.jobs: - for _item_jobs in self.jobs: - if _item_jobs: - _items.append(_item_jobs.to_dict()) + for _item in self.jobs: + if _item: + _items.append(_item.to_dict()) _dict["jobs"] = _items return _dict diff --git a/hatchet_sdk/clients/rest/rest.py b/hatchet_sdk/clients/rest/rest.py index 35284aab..67566fa1 100644 --- a/hatchet_sdk/clients/rest/rest.py +++ b/hatchet_sdk/clients/rest/rest.py @@ -81,7 +81,7 @@ def __init__(self, configuration) -> None: self.retry_client = aiohttp_retry.RetryClient( client_session=self.pool_manager, retry_options=aiohttp_retry.ExponentialRetry( - attempts=retries, factor=2.0, start_timeout=0.1, max_timeout=120.0 + attempts=retries, factor=0.0, start_timeout=0.0, max_timeout=120.0 ), ) else: @@ -159,10 +159,10 @@ async def request( data.add_field(k, v) args["data"] = data - # Pass a `bytes` or `str` parameter directly in the body to support + # Pass a `bytes` parameter directly in the body to support # other content types than Json when `body` argument is provided # in serialized form - elif isinstance(body, str) or isinstance(body, bytes): + elif isinstance(body, bytes): args["data"] = body else: # Cannot generate the request from given parameters diff --git a/hatchet_sdk/contracts/dispatcher_pb2.py b/hatchet_sdk/contracts/dispatcher_pb2.py index 699cfe33..d2616204 100644 --- a/hatchet_sdk/contracts/dispatcher_pb2.py +++ b/hatchet_sdk/contracts/dispatcher_pb2.py @@ -15,7 +15,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x64ispatcher.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"V\n\x0cWorkerLabels\x12\x15\n\x08strValue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08intValue\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x0b\n\t_strValueB\x0b\n\t_intValue\"\x88\x02\n\x15WorkerRegisterRequest\x12\x12\n\nworkerName\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x63tions\x18\x02 \x03(\t\x12\x10\n\x08services\x18\x03 \x03(\t\x12\x14\n\x07maxRuns\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12\x32\n\x06labels\x18\x05 \x03(\x0b\x32\".WorkerRegisterRequest.LabelsEntry\x12\x16\n\twebhookId\x18\x06 \x01(\tH\x01\x88\x01\x01\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\x42\n\n\x08_maxRunsB\x0c\n\n_webhookId\"P\n\x16WorkerRegisterResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\x12\x12\n\nworkerName\x18\x03 \x01(\t\"\xa3\x01\n\x19UpsertWorkerLabelsRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\x36\n\x06labels\x18\x02 \x03(\x0b\x32&.UpsertWorkerLabelsRequest.LabelsEntry\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\"@\n\x1aUpsertWorkerLabelsResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\x86\x04\n\x0e\x41ssignedAction\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x15\n\rworkflowRunId\x18\x02 \x01(\t\x12\x18\n\x10getGroupKeyRunId\x18\x03 \x01(\t\x12\r\n\x05jobId\x18\x04 \x01(\t\x12\x0f\n\x07jobName\x18\x05 \x01(\t\x12\x10\n\x08jobRunId\x18\x06 \x01(\t\x12\x0e\n\x06stepId\x18\x07 \x01(\t\x12\x11\n\tstepRunId\x18\x08 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\t \x01(\t\x12\x1f\n\nactionType\x18\n \x01(\x0e\x32\x0b.ActionType\x12\x15\n\ractionPayload\x18\x0b \x01(\t\x12\x10\n\x08stepName\x18\x0c \x01(\t\x12\x12\n\nretryCount\x18\r \x01(\x05\x12 \n\x13\x61\x64\x64itional_metadata\x18\x0e \x01(\tH\x00\x88\x01\x01\x12!\n\x14\x63hild_workflow_index\x18\x0f \x01(\x05H\x01\x88\x01\x01\x12\x1f\n\x12\x63hild_workflow_key\x18\x10 \x01(\tH\x02\x88\x01\x01\x12#\n\x16parent_workflow_run_id\x18\x11 \x01(\tH\x03\x88\x01\x01\x42\x16\n\x14_additional_metadataB\x17\n\x15_child_workflow_indexB\x15\n\x13_child_workflow_keyB\x19\n\x17_parent_workflow_run_id\"\'\n\x13WorkerListenRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\",\n\x18WorkerUnsubscribeRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\"?\n\x19WorkerUnsubscribeResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\xe1\x01\n\x13GroupKeyActionEvent\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\x15\n\rworkflowRunId\x18\x02 \x01(\t\x12\x18\n\x10getGroupKeyRunId\x18\x03 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\x04 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\teventType\x18\x06 \x01(\x0e\x32\x18.GroupKeyActionEventType\x12\x14\n\x0c\x65ventPayload\x18\x07 \x01(\t\"\xec\x01\n\x0fStepActionEvent\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\r\n\x05jobId\x18\x02 \x01(\t\x12\x10\n\x08jobRunId\x18\x03 \x01(\t\x12\x0e\n\x06stepId\x18\x04 \x01(\t\x12\x11\n\tstepRunId\x18\x05 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\x06 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\teventType\x18\x08 \x01(\x0e\x32\x14.StepActionEventType\x12\x14\n\x0c\x65ventPayload\x18\t \x01(\t\"9\n\x13\x41\x63tionEventResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\xc0\x01\n SubscribeToWorkflowEventsRequest\x12\x1a\n\rworkflowRunId\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11\x61\x64\x64itionalMetaKey\x18\x02 \x01(\tH\x01\x88\x01\x01\x12 \n\x13\x61\x64\x64itionalMetaValue\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_workflowRunIdB\x14\n\x12_additionalMetaKeyB\x16\n\x14_additionalMetaValue\"7\n\x1eSubscribeToWorkflowRunsRequest\x12\x15\n\rworkflowRunId\x18\x01 \x01(\t\"\xb2\x02\n\rWorkflowEvent\x12\x15\n\rworkflowRunId\x18\x01 \x01(\t\x12#\n\x0cresourceType\x18\x02 \x01(\x0e\x32\r.ResourceType\x12%\n\teventType\x18\x03 \x01(\x0e\x32\x12.ResourceEventType\x12\x12\n\nresourceId\x18\x04 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0c\x65ventPayload\x18\x06 \x01(\t\x12\x0e\n\x06hangup\x18\x07 \x01(\x08\x12\x18\n\x0bstepRetries\x18\x08 \x01(\x05H\x00\x88\x01\x01\x12\x17\n\nretryCount\x18\t \x01(\x05H\x01\x88\x01\x01\x42\x0e\n\x0c_stepRetriesB\r\n\x0b_retryCount\"\xa8\x01\n\x10WorkflowRunEvent\x12\x15\n\rworkflowRunId\x18\x01 \x01(\t\x12(\n\teventType\x18\x02 \x01(\x0e\x32\x15.WorkflowRunEventType\x12\x32\n\x0e\x65ventTimestamp\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1f\n\x07results\x18\x04 \x03(\x0b\x32\x0e.StepRunResult\"\x8a\x01\n\rStepRunResult\x12\x11\n\tstepRunId\x18\x01 \x01(\t\x12\x16\n\x0estepReadableId\x18\x02 \x01(\t\x12\x10\n\x08jobRunId\x18\x03 \x01(\t\x12\x12\n\x05\x65rror\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06output\x18\x05 \x01(\tH\x01\x88\x01\x01\x42\x08\n\x06_errorB\t\n\x07_output\"W\n\rOverridesData\x12\x11\n\tstepRunId\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t\x12\x16\n\x0e\x63\x61llerFilename\x18\x04 \x01(\t\"\x17\n\x15OverridesDataResponse\"U\n\x10HeartbeatRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12/\n\x0bheartbeatAt\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x13\n\x11HeartbeatResponse\"F\n\x15RefreshTimeoutRequest\x12\x11\n\tstepRunId\x18\x01 \x01(\t\x12\x1a\n\x12incrementTimeoutBy\x18\x02 \x01(\t\"G\n\x16RefreshTimeoutResponse\x12-\n\ttimeoutAt\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\'\n\x12ReleaseSlotRequest\x12\x11\n\tstepRunId\x18\x01 \x01(\t\"\x15\n\x13ReleaseSlotResponse*N\n\nActionType\x12\x12\n\x0eSTART_STEP_RUN\x10\x00\x12\x13\n\x0f\x43\x41NCEL_STEP_RUN\x10\x01\x12\x17\n\x13START_GET_GROUP_KEY\x10\x02*\xa2\x01\n\x17GroupKeyActionEventType\x12 \n\x1cGROUP_KEY_EVENT_TYPE_UNKNOWN\x10\x00\x12 \n\x1cGROUP_KEY_EVENT_TYPE_STARTED\x10\x01\x12\"\n\x1eGROUP_KEY_EVENT_TYPE_COMPLETED\x10\x02\x12\x1f\n\x1bGROUP_KEY_EVENT_TYPE_FAILED\x10\x03*\x8a\x01\n\x13StepActionEventType\x12\x1b\n\x17STEP_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1b\n\x17STEP_EVENT_TYPE_STARTED\x10\x01\x12\x1d\n\x19STEP_EVENT_TYPE_COMPLETED\x10\x02\x12\x1a\n\x16STEP_EVENT_TYPE_FAILED\x10\x03*e\n\x0cResourceType\x12\x19\n\x15RESOURCE_TYPE_UNKNOWN\x10\x00\x12\x1a\n\x16RESOURCE_TYPE_STEP_RUN\x10\x01\x12\x1e\n\x1aRESOURCE_TYPE_WORKFLOW_RUN\x10\x02*\xfe\x01\n\x11ResourceEventType\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_STARTED\x10\x01\x12!\n\x1dRESOURCE_EVENT_TYPE_COMPLETED\x10\x02\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_FAILED\x10\x03\x12!\n\x1dRESOURCE_EVENT_TYPE_CANCELLED\x10\x04\x12!\n\x1dRESOURCE_EVENT_TYPE_TIMED_OUT\x10\x05\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_STREAM\x10\x06*<\n\x14WorkflowRunEventType\x12$\n WORKFLOW_RUN_EVENT_TYPE_FINISHED\x10\x00\x32\xf8\x06\n\nDispatcher\x12=\n\x08Register\x12\x16.WorkerRegisterRequest\x1a\x17.WorkerRegisterResponse\"\x00\x12\x33\n\x06Listen\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x35\n\x08ListenV2\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x34\n\tHeartbeat\x12\x11.HeartbeatRequest\x1a\x12.HeartbeatResponse\"\x00\x12R\n\x19SubscribeToWorkflowEvents\x12!.SubscribeToWorkflowEventsRequest\x1a\x0e.WorkflowEvent\"\x00\x30\x01\x12S\n\x17SubscribeToWorkflowRuns\x12\x1f.SubscribeToWorkflowRunsRequest\x1a\x11.WorkflowRunEvent\"\x00(\x01\x30\x01\x12?\n\x13SendStepActionEvent\x12\x10.StepActionEvent\x1a\x14.ActionEventResponse\"\x00\x12G\n\x17SendGroupKeyActionEvent\x12\x14.GroupKeyActionEvent\x1a\x14.ActionEventResponse\"\x00\x12<\n\x10PutOverridesData\x12\x0e.OverridesData\x1a\x16.OverridesDataResponse\"\x00\x12\x46\n\x0bUnsubscribe\x12\x19.WorkerUnsubscribeRequest\x1a\x1a.WorkerUnsubscribeResponse\"\x00\x12\x43\n\x0eRefreshTimeout\x12\x16.RefreshTimeoutRequest\x1a\x17.RefreshTimeoutResponse\"\x00\x12:\n\x0bReleaseSlot\x12\x13.ReleaseSlotRequest\x1a\x14.ReleaseSlotResponse\"\x00\x12O\n\x12UpsertWorkerLabels\x12\x1a.UpsertWorkerLabelsRequest\x1a\x1b.UpsertWorkerLabelsResponse\"\x00\x42GZEgithub.com/hatchet-dev/hatchet/internal/services/dispatcher/contractsb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x10\x64ispatcher.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"V\n\x0cWorkerLabels\x12\x15\n\x08strValue\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08intValue\x18\x02 \x01(\x05H\x01\x88\x01\x01\x42\x0b\n\t_strValueB\x0b\n\t_intValue\"\x88\x02\n\x15WorkerRegisterRequest\x12\x12\n\nworkerName\x18\x01 \x01(\t\x12\x0f\n\x07\x61\x63tions\x18\x02 \x03(\t\x12\x10\n\x08services\x18\x03 \x03(\t\x12\x14\n\x07maxRuns\x18\x04 \x01(\x05H\x00\x88\x01\x01\x12\x32\n\x06labels\x18\x05 \x03(\x0b\x32\".WorkerRegisterRequest.LabelsEntry\x12\x16\n\twebhookId\x18\x06 \x01(\tH\x01\x88\x01\x01\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\x42\n\n\x08_maxRunsB\x0c\n\n_webhookId\"P\n\x16WorkerRegisterResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\x12\x12\n\nworkerName\x18\x03 \x01(\t\"\xa3\x01\n\x19UpsertWorkerLabelsRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\x36\n\x06labels\x18\x02 \x03(\x0b\x32&.UpsertWorkerLabelsRequest.LabelsEntry\x1a<\n\x0bLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x1c\n\x05value\x18\x02 \x01(\x0b\x32\r.WorkerLabels:\x02\x38\x01\"@\n\x1aUpsertWorkerLabelsResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\x86\x04\n\x0e\x41ssignedAction\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x15\n\rworkflowRunId\x18\x02 \x01(\t\x12\x18\n\x10getGroupKeyRunId\x18\x03 \x01(\t\x12\r\n\x05jobId\x18\x04 \x01(\t\x12\x0f\n\x07jobName\x18\x05 \x01(\t\x12\x10\n\x08jobRunId\x18\x06 \x01(\t\x12\x0e\n\x06stepId\x18\x07 \x01(\t\x12\x11\n\tstepRunId\x18\x08 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\t \x01(\t\x12\x1f\n\nactionType\x18\n \x01(\x0e\x32\x0b.ActionType\x12\x15\n\ractionPayload\x18\x0b \x01(\t\x12\x10\n\x08stepName\x18\x0c \x01(\t\x12\x12\n\nretryCount\x18\r \x01(\x05\x12 \n\x13\x61\x64\x64itional_metadata\x18\x0e \x01(\tH\x00\x88\x01\x01\x12!\n\x14\x63hild_workflow_index\x18\x0f \x01(\x05H\x01\x88\x01\x01\x12\x1f\n\x12\x63hild_workflow_key\x18\x10 \x01(\tH\x02\x88\x01\x01\x12#\n\x16parent_workflow_run_id\x18\x11 \x01(\tH\x03\x88\x01\x01\x42\x16\n\x14_additional_metadataB\x17\n\x15_child_workflow_indexB\x15\n\x13_child_workflow_keyB\x19\n\x17_parent_workflow_run_id\"\'\n\x13WorkerListenRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\",\n\x18WorkerUnsubscribeRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\"?\n\x19WorkerUnsubscribeResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\xe1\x01\n\x13GroupKeyActionEvent\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\x15\n\rworkflowRunId\x18\x02 \x01(\t\x12\x18\n\x10getGroupKeyRunId\x18\x03 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\x04 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12+\n\teventType\x18\x06 \x01(\x0e\x32\x18.GroupKeyActionEventType\x12\x14\n\x0c\x65ventPayload\x18\x07 \x01(\t\"\xec\x01\n\x0fStepActionEvent\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12\r\n\x05jobId\x18\x02 \x01(\t\x12\x10\n\x08jobRunId\x18\x03 \x01(\t\x12\x0e\n\x06stepId\x18\x04 \x01(\t\x12\x11\n\tstepRunId\x18\x05 \x01(\t\x12\x10\n\x08\x61\x63tionId\x18\x06 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\'\n\teventType\x18\x08 \x01(\x0e\x32\x14.StepActionEventType\x12\x14\n\x0c\x65ventPayload\x18\t \x01(\t\"9\n\x13\x41\x63tionEventResponse\x12\x10\n\x08tenantId\x18\x01 \x01(\t\x12\x10\n\x08workerId\x18\x02 \x01(\t\"\xc0\x01\n SubscribeToWorkflowEventsRequest\x12\x1a\n\rworkflowRunId\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x1e\n\x11\x61\x64\x64itionalMetaKey\x18\x02 \x01(\tH\x01\x88\x01\x01\x12 \n\x13\x61\x64\x64itionalMetaValue\x18\x03 \x01(\tH\x02\x88\x01\x01\x42\x10\n\x0e_workflowRunIdB\x14\n\x12_additionalMetaKeyB\x16\n\x14_additionalMetaValue\"7\n\x1eSubscribeToWorkflowRunsRequest\x12\x15\n\rworkflowRunId\x18\x01 \x01(\t\"\xb2\x02\n\rWorkflowEvent\x12\x15\n\rworkflowRunId\x18\x01 \x01(\t\x12#\n\x0cresourceType\x18\x02 \x01(\x0e\x32\r.ResourceType\x12%\n\teventType\x18\x03 \x01(\x0e\x32\x12.ResourceEventType\x12\x12\n\nresourceId\x18\x04 \x01(\t\x12\x32\n\x0e\x65ventTimestamp\x18\x05 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0c\x65ventPayload\x18\x06 \x01(\t\x12\x0e\n\x06hangup\x18\x07 \x01(\x08\x12\x18\n\x0bstepRetries\x18\x08 \x01(\x05H\x00\x88\x01\x01\x12\x17\n\nretryCount\x18\t \x01(\x05H\x01\x88\x01\x01\x42\x0e\n\x0c_stepRetriesB\r\n\x0b_retryCount\"\xa8\x01\n\x10WorkflowRunEvent\x12\x15\n\rworkflowRunId\x18\x01 \x01(\t\x12(\n\teventType\x18\x02 \x01(\x0e\x32\x15.WorkflowRunEventType\x12\x32\n\x0e\x65ventTimestamp\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x1f\n\x07results\x18\x04 \x03(\x0b\x32\x0e.StepRunResult\"\x8a\x01\n\rStepRunResult\x12\x11\n\tstepRunId\x18\x01 \x01(\t\x12\x16\n\x0estepReadableId\x18\x02 \x01(\t\x12\x10\n\x08jobRunId\x18\x03 \x01(\t\x12\x12\n\x05\x65rror\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x13\n\x06output\x18\x05 \x01(\tH\x01\x88\x01\x01\x42\x08\n\x06_errorB\t\n\x07_output\"W\n\rOverridesData\x12\x11\n\tstepRunId\x18\x01 \x01(\t\x12\x0c\n\x04path\x18\x02 \x01(\t\x12\r\n\x05value\x18\x03 \x01(\t\x12\x16\n\x0e\x63\x61llerFilename\x18\x04 \x01(\t\"\x17\n\x15OverridesDataResponse\"U\n\x10HeartbeatRequest\x12\x10\n\x08workerId\x18\x01 \x01(\t\x12/\n\x0bheartbeatAt\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\x13\n\x11HeartbeatResponse\"F\n\x15RefreshTimeoutRequest\x12\x11\n\tstepRunId\x18\x01 \x01(\t\x12\x1a\n\x12incrementTimeoutBy\x18\x02 \x01(\t\"G\n\x16RefreshTimeoutResponse\x12-\n\ttimeoutAt\x18\x01 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\"\'\n\x12ReleaseSlotRequest\x12\x11\n\tstepRunId\x18\x01 \x01(\t\"\x15\n\x13ReleaseSlotResponse*N\n\nActionType\x12\x12\n\x0eSTART_STEP_RUN\x10\x00\x12\x13\n\x0f\x43\x41NCEL_STEP_RUN\x10\x01\x12\x17\n\x13START_GET_GROUP_KEY\x10\x02*\xa2\x01\n\x17GroupKeyActionEventType\x12 \n\x1cGROUP_KEY_EVENT_TYPE_UNKNOWN\x10\x00\x12 \n\x1cGROUP_KEY_EVENT_TYPE_STARTED\x10\x01\x12\"\n\x1eGROUP_KEY_EVENT_TYPE_COMPLETED\x10\x02\x12\x1f\n\x1bGROUP_KEY_EVENT_TYPE_FAILED\x10\x03*\xca\x01\n\x13StepActionEventType\x12\x1b\n\x17STEP_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1b\n\x17STEP_EVENT_TYPE_STARTED\x10\x01\x12\x1d\n\x19STEP_EVENT_TYPE_COMPLETED\x10\x02\x12\x1a\n\x16STEP_EVENT_TYPE_FAILED\x10\x03\x12 \n\x1cSTEP_EVENT_TYPE_ACKNOWLEDGED\x10\x04\x12\x1c\n\x18STEP_EVENT_TYPE_REJECTED\x10\x05*e\n\x0cResourceType\x12\x19\n\x15RESOURCE_TYPE_UNKNOWN\x10\x00\x12\x1a\n\x16RESOURCE_TYPE_STEP_RUN\x10\x01\x12\x1e\n\x1aRESOURCE_TYPE_WORKFLOW_RUN\x10\x02*\xfe\x01\n\x11ResourceEventType\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_UNKNOWN\x10\x00\x12\x1f\n\x1bRESOURCE_EVENT_TYPE_STARTED\x10\x01\x12!\n\x1dRESOURCE_EVENT_TYPE_COMPLETED\x10\x02\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_FAILED\x10\x03\x12!\n\x1dRESOURCE_EVENT_TYPE_CANCELLED\x10\x04\x12!\n\x1dRESOURCE_EVENT_TYPE_TIMED_OUT\x10\x05\x12\x1e\n\x1aRESOURCE_EVENT_TYPE_STREAM\x10\x06*<\n\x14WorkflowRunEventType\x12$\n WORKFLOW_RUN_EVENT_TYPE_FINISHED\x10\x00\x32\xf8\x06\n\nDispatcher\x12=\n\x08Register\x12\x16.WorkerRegisterRequest\x1a\x17.WorkerRegisterResponse\"\x00\x12\x33\n\x06Listen\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x35\n\x08ListenV2\x12\x14.WorkerListenRequest\x1a\x0f.AssignedAction\"\x00\x30\x01\x12\x34\n\tHeartbeat\x12\x11.HeartbeatRequest\x1a\x12.HeartbeatResponse\"\x00\x12R\n\x19SubscribeToWorkflowEvents\x12!.SubscribeToWorkflowEventsRequest\x1a\x0e.WorkflowEvent\"\x00\x30\x01\x12S\n\x17SubscribeToWorkflowRuns\x12\x1f.SubscribeToWorkflowRunsRequest\x1a\x11.WorkflowRunEvent\"\x00(\x01\x30\x01\x12?\n\x13SendStepActionEvent\x12\x10.StepActionEvent\x1a\x14.ActionEventResponse\"\x00\x12G\n\x17SendGroupKeyActionEvent\x12\x14.GroupKeyActionEvent\x1a\x14.ActionEventResponse\"\x00\x12<\n\x10PutOverridesData\x12\x0e.OverridesData\x1a\x16.OverridesDataResponse\"\x00\x12\x46\n\x0bUnsubscribe\x12\x19.WorkerUnsubscribeRequest\x1a\x1a.WorkerUnsubscribeResponse\"\x00\x12\x43\n\x0eRefreshTimeout\x12\x16.RefreshTimeoutRequest\x1a\x17.RefreshTimeoutResponse\"\x00\x12:\n\x0bReleaseSlot\x12\x13.ReleaseSlotRequest\x1a\x14.ReleaseSlotResponse\"\x00\x12O\n\x12UpsertWorkerLabels\x12\x1a.UpsertWorkerLabelsRequest\x1a\x1b.UpsertWorkerLabelsResponse\"\x00\x42GZEgithub.com/hatchet-dev/hatchet/internal/services/dispatcher/contractsb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -32,13 +32,13 @@ _globals['_GROUPKEYACTIONEVENTTYPE']._serialized_start=3306 _globals['_GROUPKEYACTIONEVENTTYPE']._serialized_end=3468 _globals['_STEPACTIONEVENTTYPE']._serialized_start=3471 - _globals['_STEPACTIONEVENTTYPE']._serialized_end=3609 - _globals['_RESOURCETYPE']._serialized_start=3611 - _globals['_RESOURCETYPE']._serialized_end=3712 - _globals['_RESOURCEEVENTTYPE']._serialized_start=3715 - _globals['_RESOURCEEVENTTYPE']._serialized_end=3969 - _globals['_WORKFLOWRUNEVENTTYPE']._serialized_start=3971 - _globals['_WORKFLOWRUNEVENTTYPE']._serialized_end=4031 + _globals['_STEPACTIONEVENTTYPE']._serialized_end=3673 + _globals['_RESOURCETYPE']._serialized_start=3675 + _globals['_RESOURCETYPE']._serialized_end=3776 + _globals['_RESOURCEEVENTTYPE']._serialized_start=3779 + _globals['_RESOURCEEVENTTYPE']._serialized_end=4033 + _globals['_WORKFLOWRUNEVENTTYPE']._serialized_start=4035 + _globals['_WORKFLOWRUNEVENTTYPE']._serialized_end=4095 _globals['_WORKERLABELS']._serialized_start=53 _globals['_WORKERLABELS']._serialized_end=139 _globals['_WORKERREGISTERREQUEST']._serialized_start=142 @@ -93,6 +93,6 @@ _globals['_RELEASESLOTREQUEST']._serialized_end=3200 _globals['_RELEASESLOTRESPONSE']._serialized_start=3202 _globals['_RELEASESLOTRESPONSE']._serialized_end=3223 - _globals['_DISPATCHER']._serialized_start=4034 - _globals['_DISPATCHER']._serialized_end=4922 + _globals['_DISPATCHER']._serialized_start=4098 + _globals['_DISPATCHER']._serialized_end=4986 # @@protoc_insertion_point(module_scope) diff --git a/hatchet_sdk/contracts/dispatcher_pb2.pyi b/hatchet_sdk/contracts/dispatcher_pb2.pyi index 206dd4b5..274bbf11 100644 --- a/hatchet_sdk/contracts/dispatcher_pb2.pyi +++ b/hatchet_sdk/contracts/dispatcher_pb2.pyi @@ -26,6 +26,8 @@ class StepActionEventType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): STEP_EVENT_TYPE_STARTED: _ClassVar[StepActionEventType] STEP_EVENT_TYPE_COMPLETED: _ClassVar[StepActionEventType] STEP_EVENT_TYPE_FAILED: _ClassVar[StepActionEventType] + STEP_EVENT_TYPE_ACKNOWLEDGED: _ClassVar[StepActionEventType] + STEP_EVENT_TYPE_REJECTED: _ClassVar[StepActionEventType] class ResourceType(int, metaclass=_enum_type_wrapper.EnumTypeWrapper): __slots__ = () @@ -57,6 +59,8 @@ STEP_EVENT_TYPE_UNKNOWN: StepActionEventType STEP_EVENT_TYPE_STARTED: StepActionEventType STEP_EVENT_TYPE_COMPLETED: StepActionEventType STEP_EVENT_TYPE_FAILED: StepActionEventType +STEP_EVENT_TYPE_ACKNOWLEDGED: StepActionEventType +STEP_EVENT_TYPE_REJECTED: StepActionEventType RESOURCE_TYPE_UNKNOWN: ResourceType RESOURCE_TYPE_STEP_RUN: ResourceType RESOURCE_TYPE_WORKFLOW_RUN: ResourceType diff --git a/hatchet_sdk/contracts/workflows_pb2.py b/hatchet_sdk/contracts/workflows_pb2.py index 0d4a0c6e..b7daaefa 100644 --- a/hatchet_sdk/contracts/workflows_pb2.py +++ b/hatchet_sdk/contracts/workflows_pb2.py @@ -15,7 +15,7 @@ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2 -DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fworkflows.proto\x1a\x1fgoogle/protobuf/timestamp.proto\">\n\x12PutWorkflowRequest\x12(\n\x04opts\x18\x01 \x01(\x0b\x32\x1a.CreateWorkflowVersionOpts\"\xbf\x04\n\x19\x43reateWorkflowVersionOpts\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\x36\n\x12scheduled_triggers\x18\x06 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\x12$\n\x04jobs\x18\x07 \x03(\x0b\x32\x16.CreateWorkflowJobOpts\x12-\n\x0b\x63oncurrency\x18\x08 \x01(\x0b\x32\x18.WorkflowConcurrencyOpts\x12\x1d\n\x10schedule_timeout\x18\t \x01(\tH\x00\x88\x01\x01\x12\x17\n\ncron_input\x18\n \x01(\tH\x01\x88\x01\x01\x12\x33\n\x0eon_failure_job\x18\x0b \x01(\x0b\x32\x16.CreateWorkflowJobOptsH\x02\x88\x01\x01\x12$\n\x06sticky\x18\x0c \x01(\x0e\x32\x0f.StickyStrategyH\x03\x88\x01\x01\x12 \n\x04kind\x18\r \x01(\x0e\x32\r.WorkflowKindH\x04\x88\x01\x01\x12\x1d\n\x10\x64\x65\x66\x61ult_priority\x18\x0e \x01(\x05H\x05\x88\x01\x01\x42\x13\n\x11_schedule_timeoutB\r\n\x0b_cron_inputB\x11\n\x0f_on_failure_jobB\t\n\x07_stickyB\x07\n\x05_kindB\x13\n\x11_default_priority\"\xd0\x01\n\x17WorkflowConcurrencyOpts\x12\x13\n\x06\x61\x63tion\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08max_runs\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x36\n\x0elimit_strategy\x18\x03 \x01(\x0e\x32\x19.ConcurrencyLimitStrategyH\x02\x88\x01\x01\x12\x17\n\nexpression\x18\x04 \x01(\tH\x03\x88\x01\x01\x42\t\n\x07_actionB\x0b\n\t_max_runsB\x11\n\x0f_limit_strategyB\r\n\x0b_expression\"h\n\x15\x43reateWorkflowJobOpts\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12&\n\x05steps\x18\x04 \x03(\x0b\x32\x17.CreateWorkflowStepOptsJ\x04\x08\x03\x10\x04\"\xe1\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/\n\ncomparator\x18\x04 \x01(\x0e\x32\x16.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\"\xcb\x02\n\x16\x43reateWorkflowStepOpts\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\x11\n\tuser_data\x18\x06 \x01(\t\x12\x0f\n\x07retries\x18\x07 \x01(\x05\x12)\n\x0brate_limits\x18\x08 \x03(\x0b\x32\x14.CreateStepRateLimit\x12@\n\rworker_labels\x18\t \x03(\x0b\x32).CreateWorkflowStepOpts.WorkerLabelsEntry\x1aI\n\x11WorkerLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.DesiredWorkerLabels:\x02\x38\x01\"1\n\x13\x43reateStepRateLimit\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05units\x18\x02 \x01(\x05\"\x16\n\x14ListWorkflowsRequest\"\x93\x02\n\x17ScheduleWorkflowRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12-\n\tschedules\x18\x02 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05input\x18\x03 \x01(\t\x12\x16\n\tparent_id\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12parent_step_run_id\x18\x05 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x63hild_index\x18\x06 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\tchild_key\x18\x07 \x01(\tH\x03\x88\x01\x01\x42\x0c\n\n_parent_idB\x15\n\x13_parent_step_run_idB\x0e\n\x0c_child_indexB\x0c\n\n_child_key\"\xb2\x01\n\x0fWorkflowVersion\x12\n\n\x02id\x18\x01 \x01(\t\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nupdated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07version\x18\x05 \x01(\t\x12\r\n\x05order\x18\x06 \x01(\x05\x12\x13\n\x0bworkflow_id\x18\x07 \x01(\t\"?\n\x17WorkflowTriggerEventRef\x12\x11\n\tparent_id\x18\x01 \x01(\t\x12\x11\n\tevent_key\x18\x02 \x01(\t\"9\n\x16WorkflowTriggerCronRef\x12\x11\n\tparent_id\x18\x01 \x01(\t\x12\x0c\n\x04\x63ron\x18\x02 \x01(\t\"\xf7\x02\n\x16TriggerWorkflowRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05input\x18\x02 \x01(\t\x12\x16\n\tparent_id\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12parent_step_run_id\x18\x04 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x63hild_index\x18\x05 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\tchild_key\x18\x06 \x01(\tH\x03\x88\x01\x01\x12 \n\x13\x61\x64\x64itional_metadata\x18\x07 \x01(\tH\x04\x88\x01\x01\x12\x1e\n\x11\x64\x65sired_worker_id\x18\x08 \x01(\tH\x05\x88\x01\x01\x12\x15\n\x08priority\x18\t \x01(\x05H\x06\x88\x01\x01\x42\x0c\n\n_parent_idB\x15\n\x13_parent_step_run_idB\x0e\n\x0c_child_indexB\x0c\n\n_child_keyB\x16\n\x14_additional_metadataB\x14\n\x12_desired_worker_idB\x0b\n\t_priority\"2\n\x17TriggerWorkflowResponse\x12\x17\n\x0fworkflow_run_id\x18\x01 \x01(\t\"W\n\x13PutRateLimitRequest\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05limit\x18\x02 \x01(\x05\x12$\n\x08\x64uration\x18\x03 \x01(\x0e\x32\x12.RateLimitDuration\"\x16\n\x14PutRateLimitResponse*$\n\x0eStickyStrategy\x12\x08\n\x04SOFT\x10\x00\x12\x08\n\x04HARD\x10\x01*2\n\x0cWorkflowKind\x12\x0c\n\x08\x46UNCTION\x10\x00\x12\x0b\n\x07\x44URABLE\x10\x01\x12\x07\n\x03\x44\x41G\x10\x02*l\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*\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*]\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\x32\x8a\x02\n\x0fWorkflowService\x12\x34\n\x0bPutWorkflow\x12\x13.PutWorkflowRequest\x1a\x10.WorkflowVersion\x12>\n\x10ScheduleWorkflow\x12\x18.ScheduleWorkflowRequest\x1a\x10.WorkflowVersion\x12\x44\n\x0fTriggerWorkflow\x12\x17.TriggerWorkflowRequest\x1a\x18.TriggerWorkflowResponse\x12;\n\x0cPutRateLimit\x12\x14.PutRateLimitRequest\x1a\x15.PutRateLimitResponseBBZ@github.com/hatchet-dev/hatchet/internal/services/admin/contractsb\x06proto3') +DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0fworkflows.proto\x1a\x1fgoogle/protobuf/timestamp.proto\">\n\x12PutWorkflowRequest\x12(\n\x04opts\x18\x01 \x01(\x0b\x32\x1a.CreateWorkflowVersionOpts\"\xbf\x04\n\x19\x43reateWorkflowVersionOpts\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\x36\n\x12scheduled_triggers\x18\x06 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\x12$\n\x04jobs\x18\x07 \x03(\x0b\x32\x16.CreateWorkflowJobOpts\x12-\n\x0b\x63oncurrency\x18\x08 \x01(\x0b\x32\x18.WorkflowConcurrencyOpts\x12\x1d\n\x10schedule_timeout\x18\t \x01(\tH\x00\x88\x01\x01\x12\x17\n\ncron_input\x18\n \x01(\tH\x01\x88\x01\x01\x12\x33\n\x0eon_failure_job\x18\x0b \x01(\x0b\x32\x16.CreateWorkflowJobOptsH\x02\x88\x01\x01\x12$\n\x06sticky\x18\x0c \x01(\x0e\x32\x0f.StickyStrategyH\x03\x88\x01\x01\x12 \n\x04kind\x18\r \x01(\x0e\x32\r.WorkflowKindH\x04\x88\x01\x01\x12\x1d\n\x10\x64\x65\x66\x61ult_priority\x18\x0e \x01(\x05H\x05\x88\x01\x01\x42\x13\n\x11_schedule_timeoutB\r\n\x0b_cron_inputB\x11\n\x0f_on_failure_jobB\t\n\x07_stickyB\x07\n\x05_kindB\x13\n\x11_default_priority\"\xd0\x01\n\x17WorkflowConcurrencyOpts\x12\x13\n\x06\x61\x63tion\x18\x01 \x01(\tH\x00\x88\x01\x01\x12\x15\n\x08max_runs\x18\x02 \x01(\x05H\x01\x88\x01\x01\x12\x36\n\x0elimit_strategy\x18\x03 \x01(\x0e\x32\x19.ConcurrencyLimitStrategyH\x02\x88\x01\x01\x12\x17\n\nexpression\x18\x04 \x01(\tH\x03\x88\x01\x01\x42\t\n\x07_actionB\x0b\n\t_max_runsB\x11\n\x0f_limit_strategyB\r\n\x0b_expression\"h\n\x15\x43reateWorkflowJobOpts\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x13\n\x0b\x64\x65scription\x18\x02 \x01(\t\x12&\n\x05steps\x18\x04 \x03(\x0b\x32\x17.CreateWorkflowStepOptsJ\x04\x08\x03\x10\x04\"\xe1\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/\n\ncomparator\x18\x04 \x01(\x0e\x32\x16.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\"\xcb\x02\n\x16\x43reateWorkflowStepOpts\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\x11\n\tuser_data\x18\x06 \x01(\t\x12\x0f\n\x07retries\x18\x07 \x01(\x05\x12)\n\x0brate_limits\x18\x08 \x03(\x0b\x32\x14.CreateStepRateLimit\x12@\n\rworker_labels\x18\t \x03(\x0b\x32).CreateWorkflowStepOpts.WorkerLabelsEntry\x1aI\n\x11WorkerLabelsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.DesiredWorkerLabels:\x02\x38\x01\"\xfa\x01\n\x13\x43reateStepRateLimit\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\x12.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\"\x16\n\x14ListWorkflowsRequest\"\x93\x02\n\x17ScheduleWorkflowRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12-\n\tschedules\x18\x02 \x03(\x0b\x32\x1a.google.protobuf.Timestamp\x12\r\n\x05input\x18\x03 \x01(\t\x12\x16\n\tparent_id\x18\x04 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12parent_step_run_id\x18\x05 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x63hild_index\x18\x06 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\tchild_key\x18\x07 \x01(\tH\x03\x88\x01\x01\x42\x0c\n\n_parent_idB\x15\n\x13_parent_step_run_idB\x0e\n\x0c_child_indexB\x0c\n\n_child_key\"\xb2\x01\n\x0fWorkflowVersion\x12\n\n\x02id\x18\x01 \x01(\t\x12.\n\ncreated_at\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nupdated_at\x18\x03 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x0f\n\x07version\x18\x05 \x01(\t\x12\r\n\x05order\x18\x06 \x01(\x05\x12\x13\n\x0bworkflow_id\x18\x07 \x01(\t\"?\n\x17WorkflowTriggerEventRef\x12\x11\n\tparent_id\x18\x01 \x01(\t\x12\x11\n\tevent_key\x18\x02 \x01(\t\"9\n\x16WorkflowTriggerCronRef\x12\x11\n\tparent_id\x18\x01 \x01(\t\x12\x0c\n\x04\x63ron\x18\x02 \x01(\t\"\xf7\x02\n\x16TriggerWorkflowRequest\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05input\x18\x02 \x01(\t\x12\x16\n\tparent_id\x18\x03 \x01(\tH\x00\x88\x01\x01\x12\x1f\n\x12parent_step_run_id\x18\x04 \x01(\tH\x01\x88\x01\x01\x12\x18\n\x0b\x63hild_index\x18\x05 \x01(\x05H\x02\x88\x01\x01\x12\x16\n\tchild_key\x18\x06 \x01(\tH\x03\x88\x01\x01\x12 \n\x13\x61\x64\x64itional_metadata\x18\x07 \x01(\tH\x04\x88\x01\x01\x12\x1e\n\x11\x64\x65sired_worker_id\x18\x08 \x01(\tH\x05\x88\x01\x01\x12\x15\n\x08priority\x18\t \x01(\x05H\x06\x88\x01\x01\x42\x0c\n\n_parent_idB\x15\n\x13_parent_step_run_idB\x0e\n\x0c_child_indexB\x0c\n\n_child_keyB\x16\n\x14_additional_metadataB\x14\n\x12_desired_worker_idB\x0b\n\t_priority\"2\n\x17TriggerWorkflowResponse\x12\x17\n\x0fworkflow_run_id\x18\x01 \x01(\t\"W\n\x13PutRateLimitRequest\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\r\n\x05limit\x18\x02 \x01(\x05\x12$\n\x08\x64uration\x18\x03 \x01(\x0e\x32\x12.RateLimitDuration\"\x16\n\x14PutRateLimitResponse*$\n\x0eStickyStrategy\x12\x08\n\x04SOFT\x10\x00\x12\x08\n\x04HARD\x10\x01*2\n\x0cWorkflowKind\x12\x0c\n\x08\x46UNCTION\x10\x00\x12\x0b\n\x07\x44URABLE\x10\x01\x12\x07\n\x03\x44\x41G\x10\x02*l\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*\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*]\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\x32\x8a\x02\n\x0fWorkflowService\x12\x34\n\x0bPutWorkflow\x12\x13.PutWorkflowRequest\x1a\x10.WorkflowVersion\x12>\n\x10ScheduleWorkflow\x12\x18.ScheduleWorkflowRequest\x1a\x10.WorkflowVersion\x12\x44\n\x0fTriggerWorkflow\x12\x17.TriggerWorkflowRequest\x1a\x18.TriggerWorkflowResponse\x12;\n\x0cPutRateLimit\x12\x14.PutRateLimitRequest\x1a\x15.PutRateLimitResponseBBZ@github.com/hatchet-dev/hatchet/internal/services/admin/contractsb\x06proto3') _globals = globals() _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals) @@ -25,16 +25,16 @@ _globals['DESCRIPTOR']._serialized_options = b'Z@github.com/hatchet-dev/hatchet/internal/services/admin/contracts' _globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._options = None _globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._serialized_options = b'8\001' - _globals['_STICKYSTRATEGY']._serialized_start=2774 - _globals['_STICKYSTRATEGY']._serialized_end=2810 - _globals['_WORKFLOWKIND']._serialized_start=2812 - _globals['_WORKFLOWKIND']._serialized_end=2862 - _globals['_CONCURRENCYLIMITSTRATEGY']._serialized_start=2864 - _globals['_CONCURRENCYLIMITSTRATEGY']._serialized_end=2972 - _globals['_WORKERLABELCOMPARATOR']._serialized_start=2975 - _globals['_WORKERLABELCOMPARATOR']._serialized_end=3108 - _globals['_RATELIMITDURATION']._serialized_start=3110 - _globals['_RATELIMITDURATION']._serialized_end=3203 + _globals['_STICKYSTRATEGY']._serialized_start=2976 + _globals['_STICKYSTRATEGY']._serialized_end=3012 + _globals['_WORKFLOWKIND']._serialized_start=3014 + _globals['_WORKFLOWKIND']._serialized_end=3064 + _globals['_CONCURRENCYLIMITSTRATEGY']._serialized_start=3066 + _globals['_CONCURRENCYLIMITSTRATEGY']._serialized_end=3174 + _globals['_WORKERLABELCOMPARATOR']._serialized_start=3177 + _globals['_WORKERLABELCOMPARATOR']._serialized_end=3310 + _globals['_RATELIMITDURATION']._serialized_start=3312 + _globals['_RATELIMITDURATION']._serialized_end=3405 _globals['_PUTWORKFLOWREQUEST']._serialized_start=52 _globals['_PUTWORKFLOWREQUEST']._serialized_end=114 _globals['_CREATEWORKFLOWVERSIONOPTS']._serialized_start=117 @@ -49,26 +49,26 @@ _globals['_CREATEWORKFLOWSTEPOPTS']._serialized_end=1571 _globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._serialized_start=1498 _globals['_CREATEWORKFLOWSTEPOPTS_WORKERLABELSENTRY']._serialized_end=1571 - _globals['_CREATESTEPRATELIMIT']._serialized_start=1573 - _globals['_CREATESTEPRATELIMIT']._serialized_end=1622 - _globals['_LISTWORKFLOWSREQUEST']._serialized_start=1624 - _globals['_LISTWORKFLOWSREQUEST']._serialized_end=1646 - _globals['_SCHEDULEWORKFLOWREQUEST']._serialized_start=1649 - _globals['_SCHEDULEWORKFLOWREQUEST']._serialized_end=1924 - _globals['_WORKFLOWVERSION']._serialized_start=1927 - _globals['_WORKFLOWVERSION']._serialized_end=2105 - _globals['_WORKFLOWTRIGGEREVENTREF']._serialized_start=2107 - _globals['_WORKFLOWTRIGGEREVENTREF']._serialized_end=2170 - _globals['_WORKFLOWTRIGGERCRONREF']._serialized_start=2172 - _globals['_WORKFLOWTRIGGERCRONREF']._serialized_end=2229 - _globals['_TRIGGERWORKFLOWREQUEST']._serialized_start=2232 - _globals['_TRIGGERWORKFLOWREQUEST']._serialized_end=2607 - _globals['_TRIGGERWORKFLOWRESPONSE']._serialized_start=2609 - _globals['_TRIGGERWORKFLOWRESPONSE']._serialized_end=2659 - _globals['_PUTRATELIMITREQUEST']._serialized_start=2661 - _globals['_PUTRATELIMITREQUEST']._serialized_end=2748 - _globals['_PUTRATELIMITRESPONSE']._serialized_start=2750 - _globals['_PUTRATELIMITRESPONSE']._serialized_end=2772 - _globals['_WORKFLOWSERVICE']._serialized_start=3206 - _globals['_WORKFLOWSERVICE']._serialized_end=3472 + _globals['_CREATESTEPRATELIMIT']._serialized_start=1574 + _globals['_CREATESTEPRATELIMIT']._serialized_end=1824 + _globals['_LISTWORKFLOWSREQUEST']._serialized_start=1826 + _globals['_LISTWORKFLOWSREQUEST']._serialized_end=1848 + _globals['_SCHEDULEWORKFLOWREQUEST']._serialized_start=1851 + _globals['_SCHEDULEWORKFLOWREQUEST']._serialized_end=2126 + _globals['_WORKFLOWVERSION']._serialized_start=2129 + _globals['_WORKFLOWVERSION']._serialized_end=2307 + _globals['_WORKFLOWTRIGGEREVENTREF']._serialized_start=2309 + _globals['_WORKFLOWTRIGGEREVENTREF']._serialized_end=2372 + _globals['_WORKFLOWTRIGGERCRONREF']._serialized_start=2374 + _globals['_WORKFLOWTRIGGERCRONREF']._serialized_end=2431 + _globals['_TRIGGERWORKFLOWREQUEST']._serialized_start=2434 + _globals['_TRIGGERWORKFLOWREQUEST']._serialized_end=2809 + _globals['_TRIGGERWORKFLOWRESPONSE']._serialized_start=2811 + _globals['_TRIGGERWORKFLOWRESPONSE']._serialized_end=2861 + _globals['_PUTRATELIMITREQUEST']._serialized_start=2863 + _globals['_PUTRATELIMITREQUEST']._serialized_end=2950 + _globals['_PUTRATELIMITRESPONSE']._serialized_start=2952 + _globals['_PUTRATELIMITRESPONSE']._serialized_end=2974 + _globals['_WORKFLOWSERVICE']._serialized_start=3408 + _globals['_WORKFLOWSERVICE']._serialized_end=3674 # @@protoc_insertion_point(module_scope) diff --git a/hatchet_sdk/contracts/workflows_pb2.pyi b/hatchet_sdk/contracts/workflows_pb2.pyi index bd9f058a..c092334a 100644 --- a/hatchet_sdk/contracts/workflows_pb2.pyi +++ b/hatchet_sdk/contracts/workflows_pb2.pyi @@ -170,12 +170,20 @@ class CreateWorkflowStepOpts(_message.Message): def __init__(self, readable_id: _Optional[str] = ..., action: _Optional[str] = ..., timeout: _Optional[str] = ..., inputs: _Optional[str] = ..., parents: _Optional[_Iterable[str]] = ..., user_data: _Optional[str] = ..., retries: _Optional[int] = ..., rate_limits: _Optional[_Iterable[_Union[CreateStepRateLimit, _Mapping]]] = ..., worker_labels: _Optional[_Mapping[str, DesiredWorkerLabels]] = ...) -> None: ... class CreateStepRateLimit(_message.Message): - __slots__ = ("key", "units") + __slots__ = ("key", "units", "key_expr", "units_expr", "limit_values_expr", "duration") KEY_FIELD_NUMBER: _ClassVar[int] UNITS_FIELD_NUMBER: _ClassVar[int] + KEY_EXPR_FIELD_NUMBER: _ClassVar[int] + UNITS_EXPR_FIELD_NUMBER: _ClassVar[int] + LIMIT_VALUES_EXPR_FIELD_NUMBER: _ClassVar[int] + DURATION_FIELD_NUMBER: _ClassVar[int] key: str units: int - def __init__(self, key: _Optional[str] = ..., units: _Optional[int] = ...) -> None: ... + key_expr: str + units_expr: str + limit_values_expr: str + duration: RateLimitDuration + def __init__(self, key: _Optional[str] = ..., units: _Optional[int] = ..., key_expr: _Optional[str] = ..., units_expr: _Optional[str] = ..., limit_values_expr: _Optional[str] = ..., duration: _Optional[_Union[RateLimitDuration, str]] = ...) -> None: ... class ListWorkflowsRequest(_message.Message): __slots__ = () diff --git a/hatchet_sdk/worker/action_listener_process.py b/hatchet_sdk/worker/action_listener_process.py index 3d5bfc22..e911e061 100644 --- a/hatchet_sdk/worker/action_listener_process.py +++ b/hatchet_sdk/worker/action_listener_process.py @@ -16,6 +16,7 @@ ) from hatchet_sdk.contracts.dispatcher_pb2 import ( GROUP_KEY_EVENT_TYPE_STARTED, + STEP_EVENT_TYPE_ACKNOWLEDGED, STEP_EVENT_TYPE_STARTED, ActionType, ) @@ -140,29 +141,22 @@ async def start_blocked_main_loop(self): async def send_event(self, event: ActionEvent, retry_attempt: int = 1): try: match event.action.action_type: - # FIXME: all events sent from an execution of a function are of type ActionType.START_STEP_RUN since - # the action is re-used. We should change this. case ActionType.START_STEP_RUN: - # TODO right now we're sending two start_step_run events - # one on the action loop and one on the event loop - # ideally we change the first to an ack to set the time + if event.type == STEP_EVENT_TYPE_ACKNOWLEDGED: + print(f"ACK{event.action.step_run_id}") + self.running_step_runs[event.action.step_run_id] = self.now() if event.type == STEP_EVENT_TYPE_STARTED: - if event.action.step_run_id in self.running_step_runs: - diff = ( - self.now() - - self.running_step_runs[event.action.step_run_id] + diff = ( + self.now() + - self.running_step_runs[event.action.step_run_id] + ) + if diff > 0.1: + logger.warning( + f"{BLOCKED_THREAD_WARNING}: time to start: {diff}s" ) - if diff > 0.1: - logger.warning( - f"{BLOCKED_THREAD_WARNING}: time to start: {diff}s" - ) - else: - logger.debug(f"start time: {diff}") - del self.running_step_runs[event.action.step_run_id] else: - self.running_step_runs[event.action.step_run_id] = ( - self.now() - ) + logger.debug(f"start time: {diff}") + del self.running_step_runs[event.action.step_run_id] asyncio.create_task( self.dispatcher_client.send_step_action_event( @@ -201,8 +195,7 @@ async def start_action_loop(self): case ActionType.START_STEP_RUN: self.event_queue.put( ActionEvent( - action=action, - type=STEP_EVENT_TYPE_STARTED, # TODO ack type + action=action, type=STEP_EVENT_TYPE_ACKNOWLEDGED ) ) logger.info(