hatchet-sdk 1.18.1__py3-none-any.whl → 1.19.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hatchet-sdk might be problematic. Click here for more details.
- {hatchet_sdk-1.18.1.dist-info → hatchet_sdk-1.19.0.dist-info}/METADATA +2 -3
- {hatchet_sdk-1.18.1.dist-info → hatchet_sdk-1.19.0.dist-info}/RECORD +4 -225
- hatchet_sdk/v0/__init__.py +0 -251
- hatchet_sdk/v0/client.py +0 -119
- hatchet_sdk/v0/clients/admin.py +0 -541
- hatchet_sdk/v0/clients/dispatcher/action_listener.py +0 -422
- hatchet_sdk/v0/clients/dispatcher/dispatcher.py +0 -204
- hatchet_sdk/v0/clients/event_ts.py +0 -28
- hatchet_sdk/v0/clients/events.py +0 -182
- hatchet_sdk/v0/clients/rest/__init__.py +0 -307
- hatchet_sdk/v0/clients/rest/api/__init__.py +0 -19
- hatchet_sdk/v0/clients/rest/api/api_token_api.py +0 -858
- hatchet_sdk/v0/clients/rest/api/default_api.py +0 -2259
- hatchet_sdk/v0/clients/rest/api/event_api.py +0 -2548
- hatchet_sdk/v0/clients/rest/api/github_api.py +0 -331
- hatchet_sdk/v0/clients/rest/api/healthcheck_api.py +0 -483
- hatchet_sdk/v0/clients/rest/api/log_api.py +0 -449
- hatchet_sdk/v0/clients/rest/api/metadata_api.py +0 -728
- hatchet_sdk/v0/clients/rest/api/rate_limits_api.py +0 -423
- hatchet_sdk/v0/clients/rest/api/slack_api.py +0 -577
- hatchet_sdk/v0/clients/rest/api/sns_api.py +0 -872
- hatchet_sdk/v0/clients/rest/api/step_run_api.py +0 -2202
- hatchet_sdk/v0/clients/rest/api/tenant_api.py +0 -4430
- hatchet_sdk/v0/clients/rest/api/user_api.py +0 -2888
- hatchet_sdk/v0/clients/rest/api/worker_api.py +0 -858
- hatchet_sdk/v0/clients/rest/api/workflow_api.py +0 -6312
- hatchet_sdk/v0/clients/rest/api/workflow_run_api.py +0 -1932
- hatchet_sdk/v0/clients/rest/api/workflow_runs_api.py +0 -610
- hatchet_sdk/v0/clients/rest/api_client.py +0 -759
- hatchet_sdk/v0/clients/rest/api_response.py +0 -22
- hatchet_sdk/v0/clients/rest/configuration.py +0 -611
- hatchet_sdk/v0/clients/rest/exceptions.py +0 -200
- hatchet_sdk/v0/clients/rest/models/__init__.py +0 -274
- hatchet_sdk/v0/clients/rest/models/accept_invite_request.py +0 -83
- hatchet_sdk/v0/clients/rest/models/api_error.py +0 -102
- hatchet_sdk/v0/clients/rest/models/api_errors.py +0 -100
- hatchet_sdk/v0/clients/rest/models/api_meta.py +0 -144
- hatchet_sdk/v0/clients/rest/models/api_meta_auth.py +0 -85
- hatchet_sdk/v0/clients/rest/models/api_meta_integration.py +0 -88
- hatchet_sdk/v0/clients/rest/models/api_meta_posthog.py +0 -90
- hatchet_sdk/v0/clients/rest/models/api_resource_meta.py +0 -98
- hatchet_sdk/v0/clients/rest/models/api_token.py +0 -105
- hatchet_sdk/v0/clients/rest/models/bulk_create_event_request.py +0 -100
- hatchet_sdk/v0/clients/rest/models/bulk_create_event_response.py +0 -110
- hatchet_sdk/v0/clients/rest/models/cancel_event_request.py +0 -85
- hatchet_sdk/v0/clients/rest/models/cancel_step_run_request.py +0 -83
- hatchet_sdk/v0/clients/rest/models/concurrency_limit_strategy.py +0 -39
- hatchet_sdk/v0/clients/rest/models/create_api_token_request.py +0 -92
- hatchet_sdk/v0/clients/rest/models/create_api_token_response.py +0 -83
- hatchet_sdk/v0/clients/rest/models/create_cron_workflow_trigger_request.py +0 -98
- hatchet_sdk/v0/clients/rest/models/create_event_request.py +0 -95
- hatchet_sdk/v0/clients/rest/models/create_pull_request_from_step_run.py +0 -83
- hatchet_sdk/v0/clients/rest/models/create_sns_integration_request.py +0 -85
- hatchet_sdk/v0/clients/rest/models/create_tenant_alert_email_group_request.py +0 -83
- hatchet_sdk/v0/clients/rest/models/create_tenant_invite_request.py +0 -86
- hatchet_sdk/v0/clients/rest/models/create_tenant_request.py +0 -84
- hatchet_sdk/v0/clients/rest/models/cron_workflows.py +0 -131
- hatchet_sdk/v0/clients/rest/models/cron_workflows_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/cron_workflows_method.py +0 -37
- hatchet_sdk/v0/clients/rest/models/cron_workflows_order_by_field.py +0 -37
- hatchet_sdk/v0/clients/rest/models/event.py +0 -143
- hatchet_sdk/v0/clients/rest/models/event_data.py +0 -83
- hatchet_sdk/v0/clients/rest/models/event_key_list.py +0 -98
- hatchet_sdk/v0/clients/rest/models/event_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/event_order_by_direction.py +0 -37
- hatchet_sdk/v0/clients/rest/models/event_order_by_field.py +0 -36
- hatchet_sdk/v0/clients/rest/models/event_update_cancel200_response.py +0 -85
- hatchet_sdk/v0/clients/rest/models/event_workflow_run_summary.py +0 -116
- hatchet_sdk/v0/clients/rest/models/events.py +0 -110
- hatchet_sdk/v0/clients/rest/models/get_step_run_diff_response.py +0 -100
- hatchet_sdk/v0/clients/rest/models/github_app_installation.py +0 -107
- hatchet_sdk/v0/clients/rest/models/github_branch.py +0 -86
- hatchet_sdk/v0/clients/rest/models/github_repo.py +0 -86
- hatchet_sdk/v0/clients/rest/models/info_get_version200_response.py +0 -83
- hatchet_sdk/v0/clients/rest/models/job.py +0 -132
- hatchet_sdk/v0/clients/rest/models/job_run.py +0 -176
- hatchet_sdk/v0/clients/rest/models/job_run_status.py +0 -41
- hatchet_sdk/v0/clients/rest/models/link_github_repository_request.py +0 -106
- hatchet_sdk/v0/clients/rest/models/list_api_tokens_response.py +0 -110
- hatchet_sdk/v0/clients/rest/models/list_github_app_installations_response.py +0 -112
- hatchet_sdk/v0/clients/rest/models/list_pull_requests_response.py +0 -100
- hatchet_sdk/v0/clients/rest/models/list_slack_webhooks.py +0 -110
- hatchet_sdk/v0/clients/rest/models/list_sns_integrations.py +0 -110
- hatchet_sdk/v0/clients/rest/models/log_line.py +0 -94
- hatchet_sdk/v0/clients/rest/models/log_line_level.py +0 -39
- hatchet_sdk/v0/clients/rest/models/log_line_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/log_line_order_by_direction.py +0 -37
- hatchet_sdk/v0/clients/rest/models/log_line_order_by_field.py +0 -36
- hatchet_sdk/v0/clients/rest/models/pagination_response.py +0 -95
- hatchet_sdk/v0/clients/rest/models/pull_request.py +0 -112
- hatchet_sdk/v0/clients/rest/models/pull_request_state.py +0 -37
- hatchet_sdk/v0/clients/rest/models/queue_metrics.py +0 -97
- hatchet_sdk/v0/clients/rest/models/rate_limit.py +0 -117
- hatchet_sdk/v0/clients/rest/models/rate_limit_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/rate_limit_order_by_direction.py +0 -37
- hatchet_sdk/v0/clients/rest/models/rate_limit_order_by_field.py +0 -38
- hatchet_sdk/v0/clients/rest/models/recent_step_runs.py +0 -118
- hatchet_sdk/v0/clients/rest/models/reject_invite_request.py +0 -83
- hatchet_sdk/v0/clients/rest/models/replay_event_request.py +0 -85
- hatchet_sdk/v0/clients/rest/models/replay_workflow_runs_request.py +0 -85
- hatchet_sdk/v0/clients/rest/models/replay_workflow_runs_response.py +0 -100
- hatchet_sdk/v0/clients/rest/models/rerun_step_run_request.py +0 -83
- hatchet_sdk/v0/clients/rest/models/schedule_workflow_run_request.py +0 -92
- hatchet_sdk/v0/clients/rest/models/scheduled_run_status.py +0 -42
- hatchet_sdk/v0/clients/rest/models/scheduled_workflows.py +0 -149
- hatchet_sdk/v0/clients/rest/models/scheduled_workflows_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/scheduled_workflows_method.py +0 -37
- hatchet_sdk/v0/clients/rest/models/scheduled_workflows_order_by_field.py +0 -37
- hatchet_sdk/v0/clients/rest/models/semaphore_slots.py +0 -113
- hatchet_sdk/v0/clients/rest/models/slack_webhook.py +0 -127
- hatchet_sdk/v0/clients/rest/models/sns_integration.py +0 -114
- hatchet_sdk/v0/clients/rest/models/step.py +0 -123
- hatchet_sdk/v0/clients/rest/models/step_run.py +0 -202
- hatchet_sdk/v0/clients/rest/models/step_run_archive.py +0 -142
- hatchet_sdk/v0/clients/rest/models/step_run_archive_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/step_run_diff.py +0 -91
- hatchet_sdk/v0/clients/rest/models/step_run_event.py +0 -122
- hatchet_sdk/v0/clients/rest/models/step_run_event_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/step_run_event_reason.py +0 -52
- hatchet_sdk/v0/clients/rest/models/step_run_event_severity.py +0 -38
- hatchet_sdk/v0/clients/rest/models/step_run_status.py +0 -44
- hatchet_sdk/v0/clients/rest/models/tenant.py +0 -118
- hatchet_sdk/v0/clients/rest/models/tenant_alert_email_group.py +0 -98
- hatchet_sdk/v0/clients/rest/models/tenant_alert_email_group_list.py +0 -112
- hatchet_sdk/v0/clients/rest/models/tenant_alerting_settings.py +0 -143
- hatchet_sdk/v0/clients/rest/models/tenant_invite.py +0 -120
- hatchet_sdk/v0/clients/rest/models/tenant_invite_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/tenant_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/tenant_member.py +0 -123
- hatchet_sdk/v0/clients/rest/models/tenant_member_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/tenant_member_role.py +0 -38
- hatchet_sdk/v0/clients/rest/models/tenant_queue_metrics.py +0 -116
- hatchet_sdk/v0/clients/rest/models/tenant_resource.py +0 -40
- hatchet_sdk/v0/clients/rest/models/tenant_resource_limit.py +0 -135
- hatchet_sdk/v0/clients/rest/models/tenant_resource_policy.py +0 -102
- hatchet_sdk/v0/clients/rest/models/tenant_step_run_queue_metrics.py +0 -83
- hatchet_sdk/v0/clients/rest/models/trigger_workflow_run_request.py +0 -91
- hatchet_sdk/v0/clients/rest/models/update_tenant_alert_email_group_request.py +0 -83
- hatchet_sdk/v0/clients/rest/models/update_tenant_invite_request.py +0 -85
- hatchet_sdk/v0/clients/rest/models/update_tenant_request.py +0 -137
- hatchet_sdk/v0/clients/rest/models/update_worker_request.py +0 -87
- hatchet_sdk/v0/clients/rest/models/user.py +0 -126
- hatchet_sdk/v0/clients/rest/models/user_change_password_request.py +0 -88
- hatchet_sdk/v0/clients/rest/models/user_login_request.py +0 -86
- hatchet_sdk/v0/clients/rest/models/user_register_request.py +0 -91
- hatchet_sdk/v0/clients/rest/models/user_tenant_memberships_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/user_tenant_public.py +0 -86
- hatchet_sdk/v0/clients/rest/models/webhook_worker.py +0 -100
- hatchet_sdk/v0/clients/rest/models/webhook_worker_create_request.py +0 -94
- hatchet_sdk/v0/clients/rest/models/webhook_worker_create_response.py +0 -98
- hatchet_sdk/v0/clients/rest/models/webhook_worker_created.py +0 -102
- hatchet_sdk/v0/clients/rest/models/webhook_worker_list_response.py +0 -110
- hatchet_sdk/v0/clients/rest/models/webhook_worker_request.py +0 -102
- hatchet_sdk/v0/clients/rest/models/webhook_worker_request_list_response.py +0 -104
- hatchet_sdk/v0/clients/rest/models/webhook_worker_request_method.py +0 -38
- hatchet_sdk/v0/clients/rest/models/worker.py +0 -239
- hatchet_sdk/v0/clients/rest/models/worker_label.py +0 -102
- hatchet_sdk/v0/clients/rest/models/worker_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/worker_runtime_info.py +0 -103
- hatchet_sdk/v0/clients/rest/models/worker_runtime_sdks.py +0 -38
- hatchet_sdk/v0/clients/rest/models/worker_type.py +0 -38
- hatchet_sdk/v0/clients/rest/models/workflow.py +0 -165
- hatchet_sdk/v0/clients/rest/models/workflow_concurrency.py +0 -107
- hatchet_sdk/v0/clients/rest/models/workflow_deployment_config.py +0 -136
- hatchet_sdk/v0/clients/rest/models/workflow_kind.py +0 -38
- hatchet_sdk/v0/clients/rest/models/workflow_list.py +0 -120
- hatchet_sdk/v0/clients/rest/models/workflow_metrics.py +0 -97
- hatchet_sdk/v0/clients/rest/models/workflow_run.py +0 -188
- hatchet_sdk/v0/clients/rest/models/workflow_run_cancel200_response.py +0 -85
- hatchet_sdk/v0/clients/rest/models/workflow_run_list.py +0 -110
- hatchet_sdk/v0/clients/rest/models/workflow_run_order_by_direction.py +0 -37
- hatchet_sdk/v0/clients/rest/models/workflow_run_order_by_field.py +0 -39
- hatchet_sdk/v0/clients/rest/models/workflow_run_shape.py +0 -186
- hatchet_sdk/v0/clients/rest/models/workflow_run_status.py +0 -42
- hatchet_sdk/v0/clients/rest/models/workflow_run_triggered_by.py +0 -112
- hatchet_sdk/v0/clients/rest/models/workflow_runs_cancel_request.py +0 -85
- hatchet_sdk/v0/clients/rest/models/workflow_runs_metrics.py +0 -94
- hatchet_sdk/v0/clients/rest/models/workflow_runs_metrics_counts.py +0 -104
- hatchet_sdk/v0/clients/rest/models/workflow_tag.py +0 -84
- hatchet_sdk/v0/clients/rest/models/workflow_trigger_cron_ref.py +0 -86
- hatchet_sdk/v0/clients/rest/models/workflow_trigger_event_ref.py +0 -86
- hatchet_sdk/v0/clients/rest/models/workflow_triggers.py +0 -141
- hatchet_sdk/v0/clients/rest/models/workflow_update_request.py +0 -85
- hatchet_sdk/v0/clients/rest/models/workflow_version.py +0 -170
- hatchet_sdk/v0/clients/rest/models/workflow_version_concurrency.py +0 -114
- hatchet_sdk/v0/clients/rest/models/workflow_version_definition.py +0 -85
- hatchet_sdk/v0/clients/rest/models/workflow_version_meta.py +0 -123
- hatchet_sdk/v0/clients/rest/models/workflow_workers_count.py +0 -95
- hatchet_sdk/v0/clients/rest/rest.py +0 -187
- hatchet_sdk/v0/clients/rest/tenacity_utils.py +0 -39
- hatchet_sdk/v0/clients/rest_client.py +0 -622
- hatchet_sdk/v0/clients/run_event_listener.py +0 -260
- hatchet_sdk/v0/clients/workflow_listener.py +0 -277
- hatchet_sdk/v0/connection.py +0 -63
- hatchet_sdk/v0/context/__init__.py +0 -1
- hatchet_sdk/v0/context/context.py +0 -446
- hatchet_sdk/v0/context/worker_context.py +0 -28
- hatchet_sdk/v0/features/cron.py +0 -286
- hatchet_sdk/v0/features/scheduled.py +0 -248
- hatchet_sdk/v0/hatchet.py +0 -310
- hatchet_sdk/v0/labels.py +0 -10
- hatchet_sdk/v0/loader.py +0 -244
- hatchet_sdk/v0/metadata.py +0 -2
- hatchet_sdk/v0/opentelemetry/instrumentor.py +0 -393
- hatchet_sdk/v0/rate_limit.py +0 -126
- hatchet_sdk/v0/semver.py +0 -30
- hatchet_sdk/v0/token.py +0 -27
- hatchet_sdk/v0/utils/aio_utils.py +0 -137
- hatchet_sdk/v0/utils/backoff.py +0 -9
- hatchet_sdk/v0/utils/types.py +0 -8
- hatchet_sdk/v0/utils/typing.py +0 -12
- hatchet_sdk/v0/v2/callable.py +0 -202
- hatchet_sdk/v0/v2/concurrency.py +0 -47
- hatchet_sdk/v0/v2/hatchet.py +0 -224
- hatchet_sdk/v0/worker/__init__.py +0 -1
- hatchet_sdk/v0/worker/action_listener_process.py +0 -294
- hatchet_sdk/v0/worker/runner/run_loop_manager.py +0 -112
- hatchet_sdk/v0/worker/runner/runner.py +0 -460
- hatchet_sdk/v0/worker/runner/utils/capture_logs.py +0 -81
- hatchet_sdk/v0/worker/runner/utils/error_with_traceback.py +0 -6
- hatchet_sdk/v0/worker/worker.py +0 -391
- hatchet_sdk/v0/workflow.py +0 -261
- hatchet_sdk/v0/workflow_run.py +0 -59
- {hatchet_sdk-1.18.1.dist-info → hatchet_sdk-1.19.0.dist-info}/WHEEL +0 -0
- {hatchet_sdk-1.18.1.dist-info → hatchet_sdk-1.19.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Hatchet API
|
|
5
|
-
|
|
6
|
-
The Hatchet API
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 1.0.0
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import json
|
|
18
|
-
import pprint
|
|
19
|
-
import re # noqa: F401
|
|
20
|
-
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
-
|
|
22
|
-
from pydantic import BaseModel, Field, StrictInt, StrictStr, field_validator
|
|
23
|
-
from typing_extensions import Self
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class WorkflowVersionConcurrency(BaseModel):
|
|
27
|
-
"""
|
|
28
|
-
WorkflowVersionConcurrency
|
|
29
|
-
""" # noqa: E501
|
|
30
|
-
|
|
31
|
-
max_runs: StrictInt = Field(
|
|
32
|
-
description="The maximum number of concurrent workflow runs.", alias="maxRuns"
|
|
33
|
-
)
|
|
34
|
-
limit_strategy: StrictStr = Field(
|
|
35
|
-
description="The strategy to use when the concurrency limit is reached.",
|
|
36
|
-
alias="limitStrategy",
|
|
37
|
-
)
|
|
38
|
-
get_concurrency_group: StrictStr = Field(
|
|
39
|
-
description="An action which gets the concurrency group for the WorkflowRun.",
|
|
40
|
-
alias="getConcurrencyGroup",
|
|
41
|
-
)
|
|
42
|
-
__properties: ClassVar[List[str]] = [
|
|
43
|
-
"maxRuns",
|
|
44
|
-
"limitStrategy",
|
|
45
|
-
"getConcurrencyGroup",
|
|
46
|
-
]
|
|
47
|
-
|
|
48
|
-
@field_validator("limit_strategy")
|
|
49
|
-
def limit_strategy_validate_enum(cls, value):
|
|
50
|
-
"""Validates the enum"""
|
|
51
|
-
if value not in set(
|
|
52
|
-
["CANCEL_IN_PROGRESS", "DROP_NEWEST", "QUEUE_NEWEST", "GROUP_ROUND_ROBIN"]
|
|
53
|
-
):
|
|
54
|
-
raise ValueError(
|
|
55
|
-
"must be one of enum values ('CANCEL_IN_PROGRESS', 'DROP_NEWEST', 'QUEUE_NEWEST', 'GROUP_ROUND_ROBIN')"
|
|
56
|
-
)
|
|
57
|
-
return value
|
|
58
|
-
|
|
59
|
-
model_config = {
|
|
60
|
-
"populate_by_name": True,
|
|
61
|
-
"validate_assignment": True,
|
|
62
|
-
"protected_namespaces": (),
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
def to_str(self) -> str:
|
|
66
|
-
"""Returns the string representation of the model using alias"""
|
|
67
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
68
|
-
|
|
69
|
-
def to_json(self) -> str:
|
|
70
|
-
"""Returns the JSON representation of the model using alias"""
|
|
71
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
72
|
-
return json.dumps(self.to_dict())
|
|
73
|
-
|
|
74
|
-
@classmethod
|
|
75
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
76
|
-
"""Create an instance of WorkflowVersionConcurrency from a JSON string"""
|
|
77
|
-
return cls.from_dict(json.loads(json_str))
|
|
78
|
-
|
|
79
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
80
|
-
"""Return the dictionary representation of the model using alias.
|
|
81
|
-
|
|
82
|
-
This has the following differences from calling pydantic's
|
|
83
|
-
`self.model_dump(by_alias=True)`:
|
|
84
|
-
|
|
85
|
-
* `None` is only added to the output dict for nullable fields that
|
|
86
|
-
were set at model initialization. Other fields with value `None`
|
|
87
|
-
are ignored.
|
|
88
|
-
"""
|
|
89
|
-
excluded_fields: Set[str] = set([])
|
|
90
|
-
|
|
91
|
-
_dict = self.model_dump(
|
|
92
|
-
by_alias=True,
|
|
93
|
-
exclude=excluded_fields,
|
|
94
|
-
exclude_none=True,
|
|
95
|
-
)
|
|
96
|
-
return _dict
|
|
97
|
-
|
|
98
|
-
@classmethod
|
|
99
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
100
|
-
"""Create an instance of WorkflowVersionConcurrency from a dict"""
|
|
101
|
-
if obj is None:
|
|
102
|
-
return None
|
|
103
|
-
|
|
104
|
-
if not isinstance(obj, dict):
|
|
105
|
-
return cls.model_validate(obj)
|
|
106
|
-
|
|
107
|
-
_obj = cls.model_validate(
|
|
108
|
-
{
|
|
109
|
-
"maxRuns": obj.get("maxRuns"),
|
|
110
|
-
"limitStrategy": obj.get("limitStrategy"),
|
|
111
|
-
"getConcurrencyGroup": obj.get("getConcurrencyGroup"),
|
|
112
|
-
}
|
|
113
|
-
)
|
|
114
|
-
return _obj
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Hatchet API
|
|
5
|
-
|
|
6
|
-
The Hatchet API
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 1.0.0
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import json
|
|
18
|
-
import pprint
|
|
19
|
-
import re # noqa: F401
|
|
20
|
-
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
-
|
|
22
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
23
|
-
from typing_extensions import Self
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class WorkflowVersionDefinition(BaseModel):
|
|
27
|
-
"""
|
|
28
|
-
WorkflowVersionDefinition
|
|
29
|
-
""" # noqa: E501
|
|
30
|
-
|
|
31
|
-
raw_definition: StrictStr = Field(
|
|
32
|
-
description="The raw YAML definition of the workflow.", alias="rawDefinition"
|
|
33
|
-
)
|
|
34
|
-
__properties: ClassVar[List[str]] = ["rawDefinition"]
|
|
35
|
-
|
|
36
|
-
model_config = ConfigDict(
|
|
37
|
-
populate_by_name=True,
|
|
38
|
-
validate_assignment=True,
|
|
39
|
-
protected_namespaces=(),
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
def to_str(self) -> str:
|
|
43
|
-
"""Returns the string representation of the model using alias"""
|
|
44
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
-
|
|
46
|
-
def to_json(self) -> str:
|
|
47
|
-
"""Returns the JSON representation of the model using alias"""
|
|
48
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
-
return json.dumps(self.to_dict())
|
|
50
|
-
|
|
51
|
-
@classmethod
|
|
52
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
-
"""Create an instance of WorkflowVersionDefinition from a JSON string"""
|
|
54
|
-
return cls.from_dict(json.loads(json_str))
|
|
55
|
-
|
|
56
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
-
"""Return the dictionary representation of the model using alias.
|
|
58
|
-
|
|
59
|
-
This has the following differences from calling pydantic's
|
|
60
|
-
`self.model_dump(by_alias=True)`:
|
|
61
|
-
|
|
62
|
-
* `None` is only added to the output dict for nullable fields that
|
|
63
|
-
were set at model initialization. Other fields with value `None`
|
|
64
|
-
are ignored.
|
|
65
|
-
"""
|
|
66
|
-
excluded_fields: Set[str] = set([])
|
|
67
|
-
|
|
68
|
-
_dict = self.model_dump(
|
|
69
|
-
by_alias=True,
|
|
70
|
-
exclude=excluded_fields,
|
|
71
|
-
exclude_none=True,
|
|
72
|
-
)
|
|
73
|
-
return _dict
|
|
74
|
-
|
|
75
|
-
@classmethod
|
|
76
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
77
|
-
"""Create an instance of WorkflowVersionDefinition from a dict"""
|
|
78
|
-
if obj is None:
|
|
79
|
-
return None
|
|
80
|
-
|
|
81
|
-
if not isinstance(obj, dict):
|
|
82
|
-
return cls.model_validate(obj)
|
|
83
|
-
|
|
84
|
-
_obj = cls.model_validate({"rawDefinition": obj.get("rawDefinition")})
|
|
85
|
-
return _obj
|
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Hatchet API
|
|
5
|
-
|
|
6
|
-
The Hatchet API
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 1.0.0
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import json
|
|
18
|
-
import pprint
|
|
19
|
-
import re # noqa: F401
|
|
20
|
-
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
-
|
|
22
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
23
|
-
from typing_extensions import Self
|
|
24
|
-
|
|
25
|
-
from hatchet_sdk.v0.clients.rest.models.api_resource_meta import APIResourceMeta
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
class WorkflowVersionMeta(BaseModel):
|
|
29
|
-
"""
|
|
30
|
-
WorkflowVersionMeta
|
|
31
|
-
""" # noqa: E501
|
|
32
|
-
|
|
33
|
-
metadata: APIResourceMeta
|
|
34
|
-
version: StrictStr = Field(description="The version of the workflow.")
|
|
35
|
-
order: StrictInt
|
|
36
|
-
workflow_id: StrictStr = Field(alias="workflowId")
|
|
37
|
-
workflow: Optional[Workflow] = None
|
|
38
|
-
__properties: ClassVar[List[str]] = [
|
|
39
|
-
"metadata",
|
|
40
|
-
"version",
|
|
41
|
-
"order",
|
|
42
|
-
"workflowId",
|
|
43
|
-
"workflow",
|
|
44
|
-
]
|
|
45
|
-
|
|
46
|
-
model_config = ConfigDict(
|
|
47
|
-
populate_by_name=True,
|
|
48
|
-
validate_assignment=True,
|
|
49
|
-
protected_namespaces=(),
|
|
50
|
-
)
|
|
51
|
-
|
|
52
|
-
def to_str(self) -> str:
|
|
53
|
-
"""Returns the string representation of the model using alias"""
|
|
54
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
55
|
-
|
|
56
|
-
def to_json(self) -> str:
|
|
57
|
-
"""Returns the JSON representation of the model using alias"""
|
|
58
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
59
|
-
return json.dumps(self.to_dict())
|
|
60
|
-
|
|
61
|
-
@classmethod
|
|
62
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
63
|
-
"""Create an instance of WorkflowVersionMeta from a JSON string"""
|
|
64
|
-
return cls.from_dict(json.loads(json_str))
|
|
65
|
-
|
|
66
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
67
|
-
"""Return the dictionary representation of the model using alias.
|
|
68
|
-
|
|
69
|
-
This has the following differences from calling pydantic's
|
|
70
|
-
`self.model_dump(by_alias=True)`:
|
|
71
|
-
|
|
72
|
-
* `None` is only added to the output dict for nullable fields that
|
|
73
|
-
were set at model initialization. Other fields with value `None`
|
|
74
|
-
are ignored.
|
|
75
|
-
"""
|
|
76
|
-
excluded_fields: Set[str] = set([])
|
|
77
|
-
|
|
78
|
-
_dict = self.model_dump(
|
|
79
|
-
by_alias=True,
|
|
80
|
-
exclude=excluded_fields,
|
|
81
|
-
exclude_none=True,
|
|
82
|
-
)
|
|
83
|
-
# override the default output from pydantic by calling `to_dict()` of metadata
|
|
84
|
-
if self.metadata:
|
|
85
|
-
_dict["metadata"] = self.metadata.to_dict()
|
|
86
|
-
# override the default output from pydantic by calling `to_dict()` of workflow
|
|
87
|
-
if self.workflow:
|
|
88
|
-
_dict["workflow"] = self.workflow.to_dict()
|
|
89
|
-
return _dict
|
|
90
|
-
|
|
91
|
-
@classmethod
|
|
92
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
93
|
-
"""Create an instance of WorkflowVersionMeta from a dict"""
|
|
94
|
-
if obj is None:
|
|
95
|
-
return None
|
|
96
|
-
|
|
97
|
-
if not isinstance(obj, dict):
|
|
98
|
-
return cls.model_validate(obj)
|
|
99
|
-
|
|
100
|
-
_obj = cls.model_validate(
|
|
101
|
-
{
|
|
102
|
-
"metadata": (
|
|
103
|
-
APIResourceMeta.from_dict(obj["metadata"])
|
|
104
|
-
if obj.get("metadata") is not None
|
|
105
|
-
else None
|
|
106
|
-
),
|
|
107
|
-
"version": obj.get("version"),
|
|
108
|
-
"order": obj.get("order"),
|
|
109
|
-
"workflowId": obj.get("workflowId"),
|
|
110
|
-
"workflow": (
|
|
111
|
-
Workflow.from_dict(obj["workflow"])
|
|
112
|
-
if obj.get("workflow") is not None
|
|
113
|
-
else None
|
|
114
|
-
),
|
|
115
|
-
}
|
|
116
|
-
)
|
|
117
|
-
return _obj
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
from hatchet_sdk.v0.clients.rest.models.workflow import Workflow
|
|
121
|
-
|
|
122
|
-
# TODO: Rewrite to not use raise_errors
|
|
123
|
-
WorkflowVersionMeta.model_rebuild(raise_errors=False)
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Hatchet API
|
|
5
|
-
|
|
6
|
-
The Hatchet API
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 1.0.0
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
from __future__ import annotations
|
|
16
|
-
|
|
17
|
-
import json
|
|
18
|
-
import pprint
|
|
19
|
-
import re # noqa: F401
|
|
20
|
-
from typing import Any, ClassVar, Dict, List, Optional, Set
|
|
21
|
-
|
|
22
|
-
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
23
|
-
from typing_extensions import Self
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
class WorkflowWorkersCount(BaseModel):
|
|
27
|
-
"""
|
|
28
|
-
WorkflowWorkersCount
|
|
29
|
-
""" # noqa: E501
|
|
30
|
-
|
|
31
|
-
free_slot_count: Optional[StrictInt] = Field(default=None, alias="freeSlotCount")
|
|
32
|
-
max_slot_count: Optional[StrictInt] = Field(default=None, alias="maxSlotCount")
|
|
33
|
-
workflow_run_id: Optional[StrictStr] = Field(default=None, alias="workflowRunId")
|
|
34
|
-
__properties: ClassVar[List[str]] = [
|
|
35
|
-
"freeSlotCount",
|
|
36
|
-
"maxSlotCount",
|
|
37
|
-
"workflowRunId",
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
model_config = ConfigDict(
|
|
41
|
-
populate_by_name=True,
|
|
42
|
-
validate_assignment=True,
|
|
43
|
-
protected_namespaces=(),
|
|
44
|
-
)
|
|
45
|
-
|
|
46
|
-
def to_str(self) -> str:
|
|
47
|
-
"""Returns the string representation of the model using alias"""
|
|
48
|
-
return pprint.pformat(self.model_dump(by_alias=True))
|
|
49
|
-
|
|
50
|
-
def to_json(self) -> str:
|
|
51
|
-
"""Returns the JSON representation of the model using alias"""
|
|
52
|
-
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
53
|
-
return json.dumps(self.to_dict())
|
|
54
|
-
|
|
55
|
-
@classmethod
|
|
56
|
-
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
57
|
-
"""Create an instance of WorkflowWorkersCount from a JSON string"""
|
|
58
|
-
return cls.from_dict(json.loads(json_str))
|
|
59
|
-
|
|
60
|
-
def to_dict(self) -> Dict[str, Any]:
|
|
61
|
-
"""Return the dictionary representation of the model using alias.
|
|
62
|
-
|
|
63
|
-
This has the following differences from calling pydantic's
|
|
64
|
-
`self.model_dump(by_alias=True)`:
|
|
65
|
-
|
|
66
|
-
* `None` is only added to the output dict for nullable fields that
|
|
67
|
-
were set at model initialization. Other fields with value `None`
|
|
68
|
-
are ignored.
|
|
69
|
-
"""
|
|
70
|
-
excluded_fields: Set[str] = set([])
|
|
71
|
-
|
|
72
|
-
_dict = self.model_dump(
|
|
73
|
-
by_alias=True,
|
|
74
|
-
exclude=excluded_fields,
|
|
75
|
-
exclude_none=True,
|
|
76
|
-
)
|
|
77
|
-
return _dict
|
|
78
|
-
|
|
79
|
-
@classmethod
|
|
80
|
-
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
-
"""Create an instance of WorkflowWorkersCount from a dict"""
|
|
82
|
-
if obj is None:
|
|
83
|
-
return None
|
|
84
|
-
|
|
85
|
-
if not isinstance(obj, dict):
|
|
86
|
-
return cls.model_validate(obj)
|
|
87
|
-
|
|
88
|
-
_obj = cls.model_validate(
|
|
89
|
-
{
|
|
90
|
-
"freeSlotCount": obj.get("freeSlotCount"),
|
|
91
|
-
"maxSlotCount": obj.get("maxSlotCount"),
|
|
92
|
-
"workflowRunId": obj.get("workflowRunId"),
|
|
93
|
-
}
|
|
94
|
-
)
|
|
95
|
-
return _obj
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
# coding: utf-8
|
|
2
|
-
|
|
3
|
-
"""
|
|
4
|
-
Hatchet API
|
|
5
|
-
|
|
6
|
-
The Hatchet API
|
|
7
|
-
|
|
8
|
-
The version of the OpenAPI document: 1.0.0
|
|
9
|
-
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
-
|
|
11
|
-
Do not edit the class manually.
|
|
12
|
-
""" # noqa: E501
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
import io
|
|
16
|
-
import json
|
|
17
|
-
import re
|
|
18
|
-
import ssl
|
|
19
|
-
from typing import Optional, Union
|
|
20
|
-
|
|
21
|
-
import aiohttp
|
|
22
|
-
import aiohttp_retry
|
|
23
|
-
|
|
24
|
-
from hatchet_sdk.v0.clients.rest.exceptions import ApiException, ApiValueError
|
|
25
|
-
|
|
26
|
-
RESTResponseType = aiohttp.ClientResponse
|
|
27
|
-
|
|
28
|
-
ALLOW_RETRY_METHODS = frozenset({"DELETE", "GET", "HEAD", "OPTIONS", "PUT", "TRACE"})
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class RESTResponse(io.IOBase):
|
|
32
|
-
|
|
33
|
-
def __init__(self, resp) -> None:
|
|
34
|
-
self.response = resp
|
|
35
|
-
self.status = resp.status
|
|
36
|
-
self.reason = resp.reason
|
|
37
|
-
self.data = None
|
|
38
|
-
|
|
39
|
-
async def read(self):
|
|
40
|
-
if self.data is None:
|
|
41
|
-
self.data = await self.response.read()
|
|
42
|
-
return self.data
|
|
43
|
-
|
|
44
|
-
def getheaders(self):
|
|
45
|
-
"""Returns a CIMultiDictProxy of the response headers."""
|
|
46
|
-
return self.response.headers
|
|
47
|
-
|
|
48
|
-
def getheader(self, name, default=None):
|
|
49
|
-
"""Returns a given response header."""
|
|
50
|
-
return self.response.headers.get(name, default)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
class RESTClientObject:
|
|
54
|
-
|
|
55
|
-
def __init__(self, configuration) -> None:
|
|
56
|
-
|
|
57
|
-
# maxsize is number of requests to host that are allowed in parallel
|
|
58
|
-
maxsize = configuration.connection_pool_maxsize
|
|
59
|
-
|
|
60
|
-
ssl_context = ssl.create_default_context(cafile=configuration.ssl_ca_cert)
|
|
61
|
-
if configuration.cert_file:
|
|
62
|
-
ssl_context.load_cert_chain(
|
|
63
|
-
configuration.cert_file, keyfile=configuration.key_file
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
if not configuration.verify_ssl:
|
|
67
|
-
ssl_context.check_hostname = False
|
|
68
|
-
ssl_context.verify_mode = ssl.CERT_NONE
|
|
69
|
-
|
|
70
|
-
connector = aiohttp.TCPConnector(limit=maxsize, ssl=ssl_context)
|
|
71
|
-
|
|
72
|
-
self.proxy = configuration.proxy
|
|
73
|
-
self.proxy_headers = configuration.proxy_headers
|
|
74
|
-
|
|
75
|
-
# https pool manager
|
|
76
|
-
self.pool_manager = aiohttp.ClientSession(connector=connector, trust_env=True)
|
|
77
|
-
|
|
78
|
-
retries = configuration.retries
|
|
79
|
-
self.retry_client: Optional[aiohttp_retry.RetryClient]
|
|
80
|
-
if retries is not None:
|
|
81
|
-
self.retry_client = aiohttp_retry.RetryClient(
|
|
82
|
-
client_session=self.pool_manager,
|
|
83
|
-
retry_options=aiohttp_retry.ExponentialRetry(
|
|
84
|
-
attempts=retries, factor=2.0, start_timeout=0.1, max_timeout=120.0
|
|
85
|
-
),
|
|
86
|
-
)
|
|
87
|
-
else:
|
|
88
|
-
self.retry_client = None
|
|
89
|
-
|
|
90
|
-
async def close(self):
|
|
91
|
-
await self.pool_manager.close()
|
|
92
|
-
if self.retry_client is not None:
|
|
93
|
-
await self.retry_client.close()
|
|
94
|
-
|
|
95
|
-
async def request(
|
|
96
|
-
self,
|
|
97
|
-
method,
|
|
98
|
-
url,
|
|
99
|
-
headers=None,
|
|
100
|
-
body=None,
|
|
101
|
-
post_params=None,
|
|
102
|
-
_request_timeout=None,
|
|
103
|
-
):
|
|
104
|
-
"""Execute request
|
|
105
|
-
|
|
106
|
-
:param method: http request method
|
|
107
|
-
:param url: http request url
|
|
108
|
-
:param headers: http request headers
|
|
109
|
-
:param body: request json body, for `application/json`
|
|
110
|
-
:param post_params: request post parameters,
|
|
111
|
-
`application/x-www-form-urlencoded`
|
|
112
|
-
and `multipart/form-data`
|
|
113
|
-
:param _request_timeout: timeout setting for this request. If one
|
|
114
|
-
number provided, it will be total request
|
|
115
|
-
timeout. It can also be a pair (tuple) of
|
|
116
|
-
(connection, read) timeouts.
|
|
117
|
-
"""
|
|
118
|
-
method = method.upper()
|
|
119
|
-
assert method in ["GET", "HEAD", "DELETE", "POST", "PUT", "PATCH", "OPTIONS"]
|
|
120
|
-
|
|
121
|
-
if post_params and body:
|
|
122
|
-
raise ApiValueError(
|
|
123
|
-
"body parameter cannot be used with post_params parameter."
|
|
124
|
-
)
|
|
125
|
-
|
|
126
|
-
post_params = post_params or {}
|
|
127
|
-
headers = headers or {}
|
|
128
|
-
# url already contains the URL query string
|
|
129
|
-
timeout = _request_timeout or 5 * 60
|
|
130
|
-
|
|
131
|
-
if "Content-Type" not in headers:
|
|
132
|
-
headers["Content-Type"] = "application/json"
|
|
133
|
-
|
|
134
|
-
args = {"method": method, "url": url, "timeout": timeout, "headers": headers}
|
|
135
|
-
|
|
136
|
-
if self.proxy:
|
|
137
|
-
args["proxy"] = self.proxy
|
|
138
|
-
if self.proxy_headers:
|
|
139
|
-
args["proxy_headers"] = self.proxy_headers
|
|
140
|
-
|
|
141
|
-
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
|
142
|
-
if method in ["POST", "PUT", "PATCH", "OPTIONS", "DELETE"]:
|
|
143
|
-
if re.search("json", headers["Content-Type"], re.IGNORECASE):
|
|
144
|
-
if body is not None:
|
|
145
|
-
body = json.dumps(body)
|
|
146
|
-
args["data"] = body
|
|
147
|
-
elif headers["Content-Type"] == "application/x-www-form-urlencoded":
|
|
148
|
-
args["data"] = aiohttp.FormData(post_params)
|
|
149
|
-
elif headers["Content-Type"] == "multipart/form-data":
|
|
150
|
-
# must del headers['Content-Type'], or the correct
|
|
151
|
-
# Content-Type which generated by aiohttp
|
|
152
|
-
del headers["Content-Type"]
|
|
153
|
-
data = aiohttp.FormData()
|
|
154
|
-
for param in post_params:
|
|
155
|
-
k, v = param
|
|
156
|
-
if isinstance(v, tuple) and len(v) == 3:
|
|
157
|
-
data.add_field(k, value=v[1], filename=v[0], content_type=v[2])
|
|
158
|
-
else:
|
|
159
|
-
# Ensures that dict objects are serialized
|
|
160
|
-
if isinstance(v, dict):
|
|
161
|
-
v = json.dumps(v)
|
|
162
|
-
elif isinstance(v, int):
|
|
163
|
-
v = str(v)
|
|
164
|
-
data.add_field(k, v)
|
|
165
|
-
args["data"] = data
|
|
166
|
-
|
|
167
|
-
# Pass a `bytes` or `str` parameter directly in the body to support
|
|
168
|
-
# other content types than Json when `body` argument is provided
|
|
169
|
-
# in serialized form
|
|
170
|
-
elif isinstance(body, str) or isinstance(body, bytes):
|
|
171
|
-
args["data"] = body
|
|
172
|
-
else:
|
|
173
|
-
# Cannot generate the request from given parameters
|
|
174
|
-
msg = """Cannot prepare a request message for provided
|
|
175
|
-
arguments. Please check that your arguments match
|
|
176
|
-
declared content type."""
|
|
177
|
-
raise ApiException(status=0, reason=msg)
|
|
178
|
-
|
|
179
|
-
pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient]
|
|
180
|
-
if self.retry_client is not None and method in ALLOW_RETRY_METHODS:
|
|
181
|
-
pool_manager = self.retry_client
|
|
182
|
-
else:
|
|
183
|
-
pool_manager = self.pool_manager
|
|
184
|
-
|
|
185
|
-
r = await pool_manager.request(**args)
|
|
186
|
-
|
|
187
|
-
return RESTResponse(r)
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
from typing import Callable, ParamSpec, TypeVar
|
|
2
|
-
|
|
3
|
-
import grpc
|
|
4
|
-
import tenacity
|
|
5
|
-
|
|
6
|
-
from hatchet_sdk.logger import logger
|
|
7
|
-
|
|
8
|
-
P = ParamSpec("P")
|
|
9
|
-
R = TypeVar("R")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def tenacity_retry(func: Callable[P, R]) -> Callable[P, R]:
|
|
13
|
-
return tenacity.retry(
|
|
14
|
-
reraise=True,
|
|
15
|
-
wait=tenacity.wait_exponential_jitter(),
|
|
16
|
-
stop=tenacity.stop_after_attempt(5),
|
|
17
|
-
before_sleep=tenacity_alert_retry,
|
|
18
|
-
retry=tenacity.retry_if_exception(tenacity_should_retry),
|
|
19
|
-
)(func)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def tenacity_alert_retry(retry_state: tenacity.RetryCallState) -> None:
|
|
23
|
-
"""Called between tenacity retries."""
|
|
24
|
-
logger.debug(
|
|
25
|
-
f"Retrying {retry_state.fn}: attempt "
|
|
26
|
-
f"{retry_state.attempt_number} ended with: {retry_state.outcome}",
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def tenacity_should_retry(ex: Exception) -> bool:
|
|
31
|
-
if isinstance(ex, (grpc.aio.AioRpcError, grpc.RpcError)):
|
|
32
|
-
if ex.code() in [
|
|
33
|
-
grpc.StatusCode.UNIMPLEMENTED,
|
|
34
|
-
grpc.StatusCode.NOT_FOUND,
|
|
35
|
-
]:
|
|
36
|
-
return False
|
|
37
|
-
return True
|
|
38
|
-
else:
|
|
39
|
-
return False
|