gcore 0.1.0a1__py3-none-any.whl → 0.2.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 gcore might be problematic. Click here for more details.
- gcore/__init__.py +5 -0
- gcore/_client.py +9 -0
- gcore/_utils/_proxy.py +4 -1
- gcore/_utils/_resources_proxy.py +24 -0
- gcore/_version.py +1 -1
- gcore/resources/__init__.py +14 -0
- gcore/resources/cloud/baremetal/servers.py +234 -0
- gcore/resources/cloud/billing_reservations.py +24 -0
- gcore/resources/cloud/file_shares/file_shares.py +16 -0
- gcore/resources/cloud/gpu_baremetal_clusters/gpu_baremetal_clusters.py +352 -2
- gcore/resources/cloud/gpu_baremetal_clusters/images.py +204 -0
- gcore/resources/cloud/gpu_baremetal_clusters/servers.py +80 -0
- gcore/resources/cloud/inference/deployments/deployments.py +322 -4
- gcore/resources/cloud/instances/images.py +316 -0
- gcore/resources/cloud/instances/instances.py +472 -0
- gcore/resources/cloud/load_balancers/l7_policies/l7_policies.py +282 -0
- gcore/resources/cloud/load_balancers/l7_policies/rules.py +326 -0
- gcore/resources/cloud/load_balancers/listeners.py +371 -6
- gcore/resources/cloud/load_balancers/load_balancers.py +364 -0
- gcore/resources/cloud/load_balancers/pools/health_monitors.py +24 -0
- gcore/resources/cloud/load_balancers/pools/members.py +28 -0
- gcore/resources/cloud/load_balancers/pools/pools.py +388 -8
- gcore/resources/cloud/networks/networks.py +72 -16
- gcore/resources/cloud/secrets.py +56 -11
- gcore/resources/cloud/tasks.py +107 -96
- gcore/resources/waap/__init__.py +33 -0
- gcore/resources/waap/domains/__init__.py +33 -0
- gcore/resources/waap/domains/domains.py +515 -0
- gcore/resources/waap/domains/settings.py +271 -0
- gcore/resources/waap/waap.py +102 -0
- gcore/types/cloud/__init__.py +1 -0
- gcore/types/cloud/billing_reservation_list_params.py +5 -0
- gcore/types/cloud/container_probe_config_create_param.py +1 -2
- gcore/types/cloud/file_share.py +3 -0
- gcore/types/cloud/file_share_list_params.py +7 -1
- gcore/types/cloud/gpu_baremetal_cluster_create_params.py +20 -0
- gcore/types/cloud/inference/deployment_update_params.py +203 -6
- gcore/types/cloud/inference/inference.py +3 -1
- gcore/types/cloud/load_balancer_listener_detail.py +13 -13
- gcore/types/cloud/load_balancer_pool.py +13 -13
- gcore/types/cloud/load_balancer_pool_list.py +99 -4
- gcore/types/cloud/load_balancers/listener_create_params.py +2 -0
- gcore/types/cloud/load_balancers/listener_get_params.py +3 -1
- gcore/types/cloud/load_balancers/listener_list_params.py +4 -2
- gcore/types/cloud/load_balancers/listener_update_params.py +2 -0
- gcore/types/cloud/load_balancers/pool_create_params.py +2 -0
- gcore/types/cloud/load_balancers/pool_list_params.py +5 -6
- gcore/types/cloud/load_balancers/pool_update_params.py +2 -0
- gcore/types/cloud/load_balancers/pools/health_monitor_create_params.py +2 -0
- gcore/types/cloud/load_balancers/pools/member_add_params.py +2 -0
- gcore/types/cloud/network.py +21 -21
- gcore/types/cloud/network_create_params.py +2 -0
- gcore/types/cloud/network_details.py +24 -23
- gcore/types/cloud/network_list_params.py +15 -10
- gcore/types/cloud/network_update_params.py +2 -0
- gcore/types/cloud/quota_get_all_response.py +18 -0
- gcore/types/cloud/quota_get_by_region_response.py +18 -0
- gcore/types/cloud/quotas/request_create_params.py +9 -0
- gcore/types/cloud/quotas/request_get_response.py +9 -0
- gcore/types/cloud/quotas/request_list_response.py +9 -0
- gcore/types/cloud/secret_list_params.py +24 -0
- gcore/types/cloud/task.py +0 -3
- gcore/types/cloud/task_list_params.py +8 -2
- gcore/types/waap/__init__.py +12 -0
- gcore/types/waap/domain_list_params.py +30 -0
- gcore/types/waap/domain_update_params.py +12 -0
- gcore/types/waap/domains/__init__.py +5 -0
- gcore/types/waap/domains/setting_update_params.py +41 -0
- gcore/types/waap/waap_api_urls.py +15 -0
- gcore/types/waap/waap_detailed_domain.py +37 -0
- gcore/types/waap/waap_domain_ddos_settings.py +31 -0
- gcore/types/waap/waap_domain_settings.py +15 -0
- gcore/types/waap/waap_domain_status.py +7 -0
- gcore/types/waap/waap_summary_domain.py +26 -0
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/METADATA +4 -7
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/RECORD +78 -60
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/WHEEL +0 -0
- {gcore-0.1.0a1.dist-info → gcore-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -100,6 +100,46 @@ class ServersResource(SyncAPIResource):
|
|
|
100
100
|
cast_to=TaskIDList,
|
|
101
101
|
)
|
|
102
102
|
|
|
103
|
+
def delete_and_poll(
|
|
104
|
+
self,
|
|
105
|
+
instance_id: str,
|
|
106
|
+
*,
|
|
107
|
+
project_id: int | None = None,
|
|
108
|
+
region_id: int | None = None,
|
|
109
|
+
cluster_id: str,
|
|
110
|
+
delete_floatings: bool | NotGiven = NOT_GIVEN,
|
|
111
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
112
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
113
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
114
|
+
extra_headers: Headers | None = None,
|
|
115
|
+
extra_query: Query | None = None,
|
|
116
|
+
extra_body: Body | None = None,
|
|
117
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
118
|
+
) -> None:
|
|
119
|
+
"""
|
|
120
|
+
Delete a bare metal GPU server from cluster and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
121
|
+
"""
|
|
122
|
+
response = self.delete(
|
|
123
|
+
instance_id=instance_id,
|
|
124
|
+
project_id=project_id,
|
|
125
|
+
region_id=region_id,
|
|
126
|
+
cluster_id=cluster_id,
|
|
127
|
+
delete_floatings=delete_floatings,
|
|
128
|
+
extra_headers=extra_headers,
|
|
129
|
+
extra_query=extra_query,
|
|
130
|
+
extra_body=extra_body,
|
|
131
|
+
timeout=timeout,
|
|
132
|
+
)
|
|
133
|
+
if not response.tasks or len(response.tasks) < 1:
|
|
134
|
+
raise ValueError("Expected at least one task to be created")
|
|
135
|
+
self._client.cloud.tasks.poll(
|
|
136
|
+
response.tasks[0],
|
|
137
|
+
extra_headers=extra_headers,
|
|
138
|
+
extra_query=extra_query,
|
|
139
|
+
extra_body=extra_body,
|
|
140
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
141
|
+
)
|
|
142
|
+
|
|
103
143
|
@overload
|
|
104
144
|
def attach_interface(
|
|
105
145
|
self,
|
|
@@ -587,6 +627,46 @@ class AsyncServersResource(AsyncAPIResource):
|
|
|
587
627
|
cast_to=TaskIDList,
|
|
588
628
|
)
|
|
589
629
|
|
|
630
|
+
async def delete_and_poll(
|
|
631
|
+
self,
|
|
632
|
+
instance_id: str,
|
|
633
|
+
*,
|
|
634
|
+
project_id: int | None = None,
|
|
635
|
+
region_id: int | None = None,
|
|
636
|
+
cluster_id: str,
|
|
637
|
+
delete_floatings: bool | NotGiven = NOT_GIVEN,
|
|
638
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
639
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
640
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
641
|
+
extra_headers: Headers | None = None,
|
|
642
|
+
extra_query: Query | None = None,
|
|
643
|
+
extra_body: Body | None = None,
|
|
644
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
645
|
+
) -> None:
|
|
646
|
+
"""
|
|
647
|
+
Delete a bare metal GPU server from cluster and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
648
|
+
"""
|
|
649
|
+
response = await self.delete(
|
|
650
|
+
instance_id=instance_id,
|
|
651
|
+
project_id=project_id,
|
|
652
|
+
region_id=region_id,
|
|
653
|
+
cluster_id=cluster_id,
|
|
654
|
+
delete_floatings=delete_floatings,
|
|
655
|
+
extra_headers=extra_headers,
|
|
656
|
+
extra_query=extra_query,
|
|
657
|
+
extra_body=extra_body,
|
|
658
|
+
timeout=timeout,
|
|
659
|
+
)
|
|
660
|
+
if not response.tasks or len(response.tasks) < 1:
|
|
661
|
+
raise ValueError("Expected at least one task to be created")
|
|
662
|
+
await self._client.cloud.tasks.poll(
|
|
663
|
+
response.tasks[0],
|
|
664
|
+
extra_headers=extra_headers,
|
|
665
|
+
extra_query=extra_query,
|
|
666
|
+
extra_body=extra_body,
|
|
667
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
668
|
+
)
|
|
669
|
+
|
|
590
670
|
@overload
|
|
591
671
|
async def attach_interface(
|
|
592
672
|
self,
|
|
@@ -171,13 +171,13 @@ class DeploymentsResource(SyncAPIResource):
|
|
|
171
171
|
deployment_name: str,
|
|
172
172
|
*,
|
|
173
173
|
project_id: int | None = None,
|
|
174
|
-
auth_enabled:
|
|
174
|
+
auth_enabled: bool | NotGiven = NOT_GIVEN,
|
|
175
175
|
command: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
176
176
|
containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN,
|
|
177
177
|
credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
178
178
|
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
179
179
|
envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
180
|
-
flavor_name:
|
|
180
|
+
flavor_name: str | NotGiven = NOT_GIVEN,
|
|
181
181
|
image: Optional[str] | NotGiven = NOT_GIVEN,
|
|
182
182
|
ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
|
|
183
183
|
listening_port: Optional[int] | NotGiven = NOT_GIVEN,
|
|
@@ -542,6 +542,165 @@ class DeploymentsResource(SyncAPIResource):
|
|
|
542
542
|
cast_to=NoneType,
|
|
543
543
|
)
|
|
544
544
|
|
|
545
|
+
def create_and_poll(
|
|
546
|
+
self,
|
|
547
|
+
*,
|
|
548
|
+
project_id: int | None = None,
|
|
549
|
+
containers: Iterable[deployment_create_params.Container],
|
|
550
|
+
flavor_name: str,
|
|
551
|
+
image: str,
|
|
552
|
+
listening_port: int,
|
|
553
|
+
name: str,
|
|
554
|
+
auth_enabled: bool | NotGiven = NOT_GIVEN,
|
|
555
|
+
command: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
556
|
+
credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
557
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
558
|
+
envs: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
559
|
+
ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
|
|
560
|
+
logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN,
|
|
561
|
+
probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN,
|
|
562
|
+
api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
|
|
563
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
564
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
565
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
566
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
567
|
+
extra_headers: Headers | None = None,
|
|
568
|
+
extra_query: Query | None = None,
|
|
569
|
+
extra_body: Body | None = None,
|
|
570
|
+
) -> Inference:
|
|
571
|
+
response = self.create(
|
|
572
|
+
project_id=project_id,
|
|
573
|
+
containers=containers,
|
|
574
|
+
flavor_name=flavor_name,
|
|
575
|
+
image=image,
|
|
576
|
+
listening_port=listening_port,
|
|
577
|
+
name=name,
|
|
578
|
+
auth_enabled=auth_enabled,
|
|
579
|
+
command=command,
|
|
580
|
+
credentials_name=credentials_name,
|
|
581
|
+
description=description,
|
|
582
|
+
envs=envs,
|
|
583
|
+
ingress_opts=ingress_opts,
|
|
584
|
+
logging=logging,
|
|
585
|
+
probes=probes,
|
|
586
|
+
api_timeout=api_timeout,
|
|
587
|
+
extra_headers=extra_headers,
|
|
588
|
+
extra_query=extra_query,
|
|
589
|
+
extra_body=extra_body,
|
|
590
|
+
timeout=timeout,
|
|
591
|
+
)
|
|
592
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
593
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
594
|
+
task = self._client.cloud.tasks.poll(
|
|
595
|
+
task_id=response.tasks[0],
|
|
596
|
+
extra_headers=extra_headers,
|
|
597
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
598
|
+
)
|
|
599
|
+
if not task.created_resources or not task.created_resources.inference_instances or len(task.created_resources.inference_instances) != 1:
|
|
600
|
+
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
601
|
+
return self.get(
|
|
602
|
+
deployment_name=task.created_resources.inference_instances[0],
|
|
603
|
+
project_id=project_id,
|
|
604
|
+
extra_headers=extra_headers,
|
|
605
|
+
timeout=timeout,
|
|
606
|
+
)
|
|
607
|
+
|
|
608
|
+
def update_and_poll(
|
|
609
|
+
self,
|
|
610
|
+
deployment_name: str,
|
|
611
|
+
*,
|
|
612
|
+
project_id: int | None = None,
|
|
613
|
+
auth_enabled: bool | NotGiven = NOT_GIVEN,
|
|
614
|
+
command: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
615
|
+
containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN,
|
|
616
|
+
credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
617
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
618
|
+
envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
619
|
+
flavor_name: str | NotGiven = NOT_GIVEN,
|
|
620
|
+
image: Optional[str] | NotGiven = NOT_GIVEN,
|
|
621
|
+
ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
|
|
622
|
+
listening_port: Optional[int] | NotGiven = NOT_GIVEN,
|
|
623
|
+
logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN,
|
|
624
|
+
probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN,
|
|
625
|
+
api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
|
|
626
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
627
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
628
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
629
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
630
|
+
extra_headers: Headers | None = None,
|
|
631
|
+
extra_query: Query | None = None,
|
|
632
|
+
extra_body: Body | None = None,
|
|
633
|
+
) -> Inference:
|
|
634
|
+
"""
|
|
635
|
+
Update inference deployment and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
636
|
+
"""
|
|
637
|
+
response = self.update(
|
|
638
|
+
deployment_name=deployment_name,
|
|
639
|
+
project_id=project_id,
|
|
640
|
+
auth_enabled=auth_enabled,
|
|
641
|
+
command=command,
|
|
642
|
+
containers=containers,
|
|
643
|
+
credentials_name=credentials_name,
|
|
644
|
+
description=description,
|
|
645
|
+
envs=envs,
|
|
646
|
+
flavor_name=flavor_name,
|
|
647
|
+
image=image,
|
|
648
|
+
ingress_opts=ingress_opts,
|
|
649
|
+
listening_port=listening_port,
|
|
650
|
+
logging=logging,
|
|
651
|
+
probes=probes,
|
|
652
|
+
api_timeout=api_timeout,
|
|
653
|
+
extra_headers=extra_headers,
|
|
654
|
+
extra_query=extra_query,
|
|
655
|
+
extra_body=extra_body,
|
|
656
|
+
timeout=timeout,
|
|
657
|
+
)
|
|
658
|
+
if not response.tasks or len(response.tasks) < 1:
|
|
659
|
+
raise ValueError("Expected at least one task to be created")
|
|
660
|
+
self._client.cloud.tasks.poll(
|
|
661
|
+
task_id=response.tasks[0],
|
|
662
|
+
extra_headers=extra_headers,
|
|
663
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
664
|
+
)
|
|
665
|
+
return self.get(
|
|
666
|
+
deployment_name=deployment_name,
|
|
667
|
+
project_id=project_id,
|
|
668
|
+
extra_headers=extra_headers,
|
|
669
|
+
timeout=timeout,
|
|
670
|
+
)
|
|
671
|
+
|
|
672
|
+
def delete_and_poll(
|
|
673
|
+
self,
|
|
674
|
+
deployment_name: str,
|
|
675
|
+
*,
|
|
676
|
+
project_id: int | None = None,
|
|
677
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
678
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
679
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
680
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
681
|
+
extra_headers: Headers | None = None,
|
|
682
|
+
extra_query: Query | None = None,
|
|
683
|
+
extra_body: Body | None = None,
|
|
684
|
+
) -> None:
|
|
685
|
+
"""
|
|
686
|
+
Delete inference deployment and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
687
|
+
"""
|
|
688
|
+
response = self.delete(
|
|
689
|
+
deployment_name=deployment_name,
|
|
690
|
+
project_id=project_id,
|
|
691
|
+
extra_headers=extra_headers,
|
|
692
|
+
extra_query=extra_query,
|
|
693
|
+
extra_body=extra_body,
|
|
694
|
+
timeout=timeout,
|
|
695
|
+
)
|
|
696
|
+
if not response.tasks or len(response.tasks) < 1:
|
|
697
|
+
raise ValueError("Expected at least one task to be created")
|
|
698
|
+
self._client.cloud.tasks.poll(
|
|
699
|
+
task_id=response.tasks[0],
|
|
700
|
+
extra_headers=extra_headers,
|
|
701
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
702
|
+
)
|
|
703
|
+
|
|
545
704
|
|
|
546
705
|
class AsyncDeploymentsResource(AsyncAPIResource):
|
|
547
706
|
@cached_property
|
|
@@ -679,13 +838,13 @@ class AsyncDeploymentsResource(AsyncAPIResource):
|
|
|
679
838
|
deployment_name: str,
|
|
680
839
|
*,
|
|
681
840
|
project_id: int | None = None,
|
|
682
|
-
auth_enabled:
|
|
841
|
+
auth_enabled: bool | NotGiven = NOT_GIVEN,
|
|
683
842
|
command: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
684
843
|
containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN,
|
|
685
844
|
credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
686
845
|
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
687
846
|
envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
688
|
-
flavor_name:
|
|
847
|
+
flavor_name: str | NotGiven = NOT_GIVEN,
|
|
689
848
|
image: Optional[str] | NotGiven = NOT_GIVEN,
|
|
690
849
|
ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
|
|
691
850
|
listening_port: Optional[int] | NotGiven = NOT_GIVEN,
|
|
@@ -1050,6 +1209,165 @@ class AsyncDeploymentsResource(AsyncAPIResource):
|
|
|
1050
1209
|
cast_to=NoneType,
|
|
1051
1210
|
)
|
|
1052
1211
|
|
|
1212
|
+
async def create_and_poll(
|
|
1213
|
+
self,
|
|
1214
|
+
*,
|
|
1215
|
+
project_id: int | None = None,
|
|
1216
|
+
containers: Iterable[deployment_create_params.Container],
|
|
1217
|
+
flavor_name: str,
|
|
1218
|
+
image: str,
|
|
1219
|
+
listening_port: int,
|
|
1220
|
+
name: str,
|
|
1221
|
+
auth_enabled: bool | NotGiven = NOT_GIVEN,
|
|
1222
|
+
command: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
1223
|
+
credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1224
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1225
|
+
envs: Dict[str, str] | NotGiven = NOT_GIVEN,
|
|
1226
|
+
ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
|
|
1227
|
+
logging: Optional[deployment_create_params.Logging] | NotGiven = NOT_GIVEN,
|
|
1228
|
+
probes: Optional[deployment_create_params.Probes] | NotGiven = NOT_GIVEN,
|
|
1229
|
+
api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
|
|
1230
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1231
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1232
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1233
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1234
|
+
extra_headers: Headers | None = None,
|
|
1235
|
+
extra_query: Query | None = None,
|
|
1236
|
+
extra_body: Body | None = None,
|
|
1237
|
+
) -> Inference:
|
|
1238
|
+
response = await self.create(
|
|
1239
|
+
project_id=project_id,
|
|
1240
|
+
containers=containers,
|
|
1241
|
+
flavor_name=flavor_name,
|
|
1242
|
+
image=image,
|
|
1243
|
+
listening_port=listening_port,
|
|
1244
|
+
name=name,
|
|
1245
|
+
auth_enabled=auth_enabled,
|
|
1246
|
+
command=command,
|
|
1247
|
+
credentials_name=credentials_name,
|
|
1248
|
+
description=description,
|
|
1249
|
+
envs=envs,
|
|
1250
|
+
ingress_opts=ingress_opts,
|
|
1251
|
+
logging=logging,
|
|
1252
|
+
probes=probes,
|
|
1253
|
+
api_timeout=api_timeout,
|
|
1254
|
+
extra_headers=extra_headers,
|
|
1255
|
+
extra_query=extra_query,
|
|
1256
|
+
extra_body=extra_body,
|
|
1257
|
+
timeout=timeout,
|
|
1258
|
+
)
|
|
1259
|
+
if not response.tasks or len(response.tasks) != 1:
|
|
1260
|
+
raise ValueError(f"Expected exactly one task to be created")
|
|
1261
|
+
task = await self._client.cloud.tasks.poll(
|
|
1262
|
+
task_id=response.tasks[0],
|
|
1263
|
+
extra_headers=extra_headers,
|
|
1264
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1265
|
+
)
|
|
1266
|
+
if not task.created_resources or not task.created_resources.inference_instances or len(task.created_resources.inference_instances) != 1:
|
|
1267
|
+
raise ValueError(f"Expected exactly one resource to be created in a task")
|
|
1268
|
+
return await self.get(
|
|
1269
|
+
deployment_name=task.created_resources.inference_instances[0],
|
|
1270
|
+
project_id=project_id,
|
|
1271
|
+
extra_headers=extra_headers,
|
|
1272
|
+
timeout=timeout,
|
|
1273
|
+
)
|
|
1274
|
+
|
|
1275
|
+
async def update_and_poll(
|
|
1276
|
+
self,
|
|
1277
|
+
deployment_name: str,
|
|
1278
|
+
*,
|
|
1279
|
+
project_id: int | None = None,
|
|
1280
|
+
auth_enabled: bool | NotGiven = NOT_GIVEN,
|
|
1281
|
+
command: Optional[List[str]] | NotGiven = NOT_GIVEN,
|
|
1282
|
+
containers: Optional[Iterable[deployment_update_params.Container]] | NotGiven = NOT_GIVEN,
|
|
1283
|
+
credentials_name: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1284
|
+
description: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1285
|
+
envs: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
|
|
1286
|
+
flavor_name: str | NotGiven = NOT_GIVEN,
|
|
1287
|
+
image: Optional[str] | NotGiven = NOT_GIVEN,
|
|
1288
|
+
ingress_opts: Optional[IngressOptsParam] | NotGiven = NOT_GIVEN,
|
|
1289
|
+
listening_port: Optional[int] | NotGiven = NOT_GIVEN,
|
|
1290
|
+
logging: Optional[deployment_update_params.Logging] | NotGiven = NOT_GIVEN,
|
|
1291
|
+
probes: Optional[deployment_update_params.Probes] | NotGiven = NOT_GIVEN,
|
|
1292
|
+
api_timeout: Optional[int] | NotGiven = NOT_GIVEN,
|
|
1293
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1294
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1295
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1296
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1297
|
+
extra_headers: Headers | None = None,
|
|
1298
|
+
extra_query: Query | None = None,
|
|
1299
|
+
extra_body: Body | None = None,
|
|
1300
|
+
) -> Inference:
|
|
1301
|
+
"""
|
|
1302
|
+
Update inference deployment and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1303
|
+
"""
|
|
1304
|
+
response = await self.update(
|
|
1305
|
+
deployment_name=deployment_name,
|
|
1306
|
+
project_id=project_id,
|
|
1307
|
+
auth_enabled=auth_enabled,
|
|
1308
|
+
command=command,
|
|
1309
|
+
containers=containers,
|
|
1310
|
+
credentials_name=credentials_name,
|
|
1311
|
+
description=description,
|
|
1312
|
+
envs=envs,
|
|
1313
|
+
flavor_name=flavor_name,
|
|
1314
|
+
image=image,
|
|
1315
|
+
ingress_opts=ingress_opts,
|
|
1316
|
+
listening_port=listening_port,
|
|
1317
|
+
logging=logging,
|
|
1318
|
+
probes=probes,
|
|
1319
|
+
api_timeout=api_timeout,
|
|
1320
|
+
extra_headers=extra_headers,
|
|
1321
|
+
extra_query=extra_query,
|
|
1322
|
+
extra_body=extra_body,
|
|
1323
|
+
timeout=timeout,
|
|
1324
|
+
)
|
|
1325
|
+
if not response.tasks or len(response.tasks) < 1:
|
|
1326
|
+
raise ValueError("Expected at least one task to be created")
|
|
1327
|
+
await self._client.cloud.tasks.poll(
|
|
1328
|
+
task_id=response.tasks[0],
|
|
1329
|
+
extra_headers=extra_headers,
|
|
1330
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1331
|
+
)
|
|
1332
|
+
return await self.get(
|
|
1333
|
+
deployment_name=deployment_name,
|
|
1334
|
+
project_id=project_id,
|
|
1335
|
+
extra_headers=extra_headers,
|
|
1336
|
+
timeout=timeout,
|
|
1337
|
+
)
|
|
1338
|
+
|
|
1339
|
+
async def delete_and_poll(
|
|
1340
|
+
self,
|
|
1341
|
+
deployment_name: str,
|
|
1342
|
+
*,
|
|
1343
|
+
project_id: int | None = None,
|
|
1344
|
+
polling_interval_seconds: int | NotGiven = NOT_GIVEN,
|
|
1345
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
1346
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
1347
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
1348
|
+
extra_headers: Headers | None = None,
|
|
1349
|
+
extra_query: Query | None = None,
|
|
1350
|
+
extra_body: Body | None = None,
|
|
1351
|
+
) -> None:
|
|
1352
|
+
"""
|
|
1353
|
+
Delete inference deployment and poll for the result. Only the first task will be polled. If you need to poll more tasks, use the `tasks.poll` method.
|
|
1354
|
+
"""
|
|
1355
|
+
response = await self.delete(
|
|
1356
|
+
deployment_name=deployment_name,
|
|
1357
|
+
project_id=project_id,
|
|
1358
|
+
extra_headers=extra_headers,
|
|
1359
|
+
extra_query=extra_query,
|
|
1360
|
+
extra_body=extra_body,
|
|
1361
|
+
timeout=timeout,
|
|
1362
|
+
)
|
|
1363
|
+
if not response.tasks or len(response.tasks) < 1:
|
|
1364
|
+
raise ValueError("Expected at least one task to be created")
|
|
1365
|
+
await self._client.cloud.tasks.poll(
|
|
1366
|
+
task_id=response.tasks[0],
|
|
1367
|
+
extra_headers=extra_headers,
|
|
1368
|
+
polling_interval_seconds=polling_interval_seconds,
|
|
1369
|
+
)
|
|
1370
|
+
|
|
1053
1371
|
|
|
1054
1372
|
class DeploymentsResourceWithRawResponse:
|
|
1055
1373
|
def __init__(self, deployments: DeploymentsResource) -> None:
|