google-cloud-gke_recommender-v1 0.a → 0.1.0
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.
- checksums.yaml +4 -4
- data/.yardopts +12 -0
- data/AUTHENTICATION.md +122 -0
- data/README.md +153 -8
- data/lib/google/cloud/gke_recommender/v1/gke_inference_quickstart/client.rb +1028 -0
- data/lib/google/cloud/gke_recommender/v1/gke_inference_quickstart/credentials.rb +47 -0
- data/lib/google/cloud/gke_recommender/v1/gke_inference_quickstart/rest/client.rb +1008 -0
- data/lib/google/cloud/gke_recommender/v1/gke_inference_quickstart/rest/service_stub.rb +438 -0
- data/lib/google/cloud/gke_recommender/v1/gke_inference_quickstart/rest.rb +54 -0
- data/lib/google/cloud/gke_recommender/v1/gke_inference_quickstart.rb +57 -0
- data/lib/google/cloud/gke_recommender/v1/rest.rb +37 -0
- data/lib/google/cloud/gke_recommender/v1/version.rb +7 -2
- data/lib/google/cloud/gke_recommender/v1.rb +45 -0
- data/lib/google/cloud/gkerecommender/v1/gkerecommender_pb.rb +69 -0
- data/lib/google/cloud/gkerecommender/v1/gkerecommender_services_pb.rb +83 -0
- data/lib/google-cloud-gke_recommender-v1.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +473 -0
- data/proto_docs/google/api/field_behavior.rb +85 -0
- data/proto_docs/google/api/launch_stage.rb +71 -0
- data/proto_docs/google/api/resource.rb +227 -0
- data/proto_docs/google/cloud/gkerecommender/v1/gkerecommender.rb +558 -0
- data/proto_docs/google/protobuf/duration.rb +98 -0
- metadata +55 -9
@@ -0,0 +1,1028 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/cloud/gkerecommender/v1/gkerecommender_pb"
|
21
|
+
|
22
|
+
module Google
|
23
|
+
module Cloud
|
24
|
+
module GkeRecommender
|
25
|
+
module V1
|
26
|
+
module GkeInferenceQuickstart
|
27
|
+
##
|
28
|
+
# Client for the GkeInferenceQuickstart service.
|
29
|
+
#
|
30
|
+
# GKE Inference Quickstart (GIQ) service provides profiles with performance
|
31
|
+
# metrics for popular models and model servers across multiple accelerators.
|
32
|
+
# These profiles help generate optimized best practices for running inference
|
33
|
+
# on GKE.
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
# @private
|
37
|
+
API_VERSION = ""
|
38
|
+
|
39
|
+
# @private
|
40
|
+
DEFAULT_ENDPOINT_TEMPLATE = "gkerecommender.$UNIVERSE_DOMAIN$"
|
41
|
+
|
42
|
+
# @private
|
43
|
+
attr_reader :gke_inference_quickstart_stub
|
44
|
+
|
45
|
+
##
|
46
|
+
# Configure the GkeInferenceQuickstart Client class.
|
47
|
+
#
|
48
|
+
# See {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client::Configuration}
|
49
|
+
# for a description of the configuration fields.
|
50
|
+
#
|
51
|
+
# @example
|
52
|
+
#
|
53
|
+
# # Modify the configuration for all GkeInferenceQuickstart clients
|
54
|
+
# ::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.configure do |config|
|
55
|
+
# config.timeout = 10.0
|
56
|
+
# end
|
57
|
+
#
|
58
|
+
# @yield [config] Configure the Client client.
|
59
|
+
# @yieldparam config [Client::Configuration]
|
60
|
+
#
|
61
|
+
# @return [Client::Configuration]
|
62
|
+
#
|
63
|
+
def self.configure
|
64
|
+
@configure ||= begin
|
65
|
+
namespace = ["Google", "Cloud", "GkeRecommender", "V1"]
|
66
|
+
parent_config = while namespace.any?
|
67
|
+
parent_name = namespace.join "::"
|
68
|
+
parent_const = const_get parent_name
|
69
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
70
|
+
namespace.pop
|
71
|
+
end
|
72
|
+
default_config = Client::Configuration.new parent_config
|
73
|
+
|
74
|
+
default_config.rpcs.fetch_models.timeout = 60.0
|
75
|
+
|
76
|
+
default_config.rpcs.fetch_model_servers.timeout = 60.0
|
77
|
+
|
78
|
+
default_config.rpcs.fetch_model_server_versions.timeout = 60.0
|
79
|
+
|
80
|
+
default_config.rpcs.fetch_profiles.timeout = 60.0
|
81
|
+
|
82
|
+
default_config.rpcs.generate_optimized_manifest.timeout = 60.0
|
83
|
+
|
84
|
+
default_config.rpcs.fetch_benchmarking_data.timeout = 60.0
|
85
|
+
|
86
|
+
default_config
|
87
|
+
end
|
88
|
+
yield @configure if block_given?
|
89
|
+
@configure
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Configure the GkeInferenceQuickstart Client instance.
|
94
|
+
#
|
95
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
96
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
97
|
+
# should be made on {Client.configure}.
|
98
|
+
#
|
99
|
+
# See {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client::Configuration}
|
100
|
+
# for a description of the configuration fields.
|
101
|
+
#
|
102
|
+
# @yield [config] Configure the Client client.
|
103
|
+
# @yieldparam config [Client::Configuration]
|
104
|
+
#
|
105
|
+
# @return [Client::Configuration]
|
106
|
+
#
|
107
|
+
def configure
|
108
|
+
yield @config if block_given?
|
109
|
+
@config
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# The effective universe domain
|
114
|
+
#
|
115
|
+
# @return [String]
|
116
|
+
#
|
117
|
+
def universe_domain
|
118
|
+
@gke_inference_quickstart_stub.universe_domain
|
119
|
+
end
|
120
|
+
|
121
|
+
##
|
122
|
+
# Create a new GkeInferenceQuickstart client object.
|
123
|
+
#
|
124
|
+
# @example
|
125
|
+
#
|
126
|
+
# # Create a client using the default configuration
|
127
|
+
# client = ::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.new
|
128
|
+
#
|
129
|
+
# # Create a client using a custom configuration
|
130
|
+
# client = ::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.new do |config|
|
131
|
+
# config.timeout = 10.0
|
132
|
+
# end
|
133
|
+
#
|
134
|
+
# @yield [config] Configure the GkeInferenceQuickstart client.
|
135
|
+
# @yieldparam config [Client::Configuration]
|
136
|
+
#
|
137
|
+
def initialize
|
138
|
+
# These require statements are intentionally placed here to initialize
|
139
|
+
# the gRPC module only when it's required.
|
140
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
141
|
+
require "gapic/grpc"
|
142
|
+
require "google/cloud/gkerecommender/v1/gkerecommender_services_pb"
|
143
|
+
|
144
|
+
# Create the configuration object
|
145
|
+
@config = Configuration.new Client.configure
|
146
|
+
|
147
|
+
# Yield the configuration if needed
|
148
|
+
yield @config if block_given?
|
149
|
+
|
150
|
+
# Create credentials
|
151
|
+
credentials = @config.credentials
|
152
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
153
|
+
# but only if the default endpoint does not have a region prefix.
|
154
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
155
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
156
|
+
!@config.endpoint.split(".").first.include?("-"))
|
157
|
+
credentials ||= Credentials.default scope: @config.scope,
|
158
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
159
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
160
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
161
|
+
end
|
162
|
+
@quota_project_id = @config.quota_project
|
163
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
164
|
+
|
165
|
+
@gke_inference_quickstart_stub = ::Gapic::ServiceStub.new(
|
166
|
+
::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Stub,
|
167
|
+
credentials: credentials,
|
168
|
+
endpoint: @config.endpoint,
|
169
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
170
|
+
universe_domain: @config.universe_domain,
|
171
|
+
channel_args: @config.channel_args,
|
172
|
+
interceptors: @config.interceptors,
|
173
|
+
channel_pool_config: @config.channel_pool,
|
174
|
+
logger: @config.logger
|
175
|
+
)
|
176
|
+
|
177
|
+
@gke_inference_quickstart_stub.stub_logger&.info do |entry|
|
178
|
+
entry.set_system_name
|
179
|
+
entry.set_service
|
180
|
+
entry.message = "Created client for #{entry.service}"
|
181
|
+
entry.set_credentials_fields credentials
|
182
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
183
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
184
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
##
|
189
|
+
# The logger used for request/response debug logging.
|
190
|
+
#
|
191
|
+
# @return [Logger]
|
192
|
+
#
|
193
|
+
def logger
|
194
|
+
@gke_inference_quickstart_stub.logger
|
195
|
+
end
|
196
|
+
|
197
|
+
# Service calls
|
198
|
+
|
199
|
+
##
|
200
|
+
# Fetches available models. Open-source models follow the Huggingface Hub
|
201
|
+
# `owner/model_name` format.
|
202
|
+
#
|
203
|
+
# @overload fetch_models(request, options = nil)
|
204
|
+
# Pass arguments to `fetch_models` via a request object, either of type
|
205
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchModelsRequest} or an equivalent Hash.
|
206
|
+
#
|
207
|
+
# @param request [::Google::Cloud::GkeRecommender::V1::FetchModelsRequest, ::Hash]
|
208
|
+
# A request object representing the call parameters. Required. To specify no
|
209
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
210
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
211
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
212
|
+
#
|
213
|
+
# @overload fetch_models(page_size: nil, page_token: nil)
|
214
|
+
# Pass arguments to `fetch_models` via keyword arguments. Note that at
|
215
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
216
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
217
|
+
#
|
218
|
+
# @param page_size [::Integer]
|
219
|
+
# Optional. The target number of results to return in a single response.
|
220
|
+
# If not specified, a default value will be chosen by the service.
|
221
|
+
# Note that the response may include a partial list and a caller should
|
222
|
+
# only rely on the response's
|
223
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchModelsResponse#next_page_token next_page_token}
|
224
|
+
# to determine if there are more instances left to be queried.
|
225
|
+
# @param page_token [::String]
|
226
|
+
# Optional. The value of
|
227
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchModelsResponse#next_page_token next_page_token}
|
228
|
+
# received from a previous `FetchModelsRequest` call.
|
229
|
+
# Provide this to retrieve the subsequent page in a multi-page list of
|
230
|
+
# results. When paginating, all other parameters provided to
|
231
|
+
# `FetchModelsRequest` must match the call that provided the page token.
|
232
|
+
#
|
233
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
234
|
+
# @yieldparam response [::Google::Cloud::GkeRecommender::V1::FetchModelsResponse]
|
235
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
236
|
+
#
|
237
|
+
# @return [::Google::Cloud::GkeRecommender::V1::FetchModelsResponse]
|
238
|
+
#
|
239
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
240
|
+
#
|
241
|
+
# @example Basic example
|
242
|
+
# require "google/cloud/gke_recommender/v1"
|
243
|
+
#
|
244
|
+
# # Create a client object. The client can be reused for multiple calls.
|
245
|
+
# client = Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.new
|
246
|
+
#
|
247
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
248
|
+
# request = Google::Cloud::GkeRecommender::V1::FetchModelsRequest.new
|
249
|
+
#
|
250
|
+
# # Call the fetch_models method.
|
251
|
+
# result = client.fetch_models request
|
252
|
+
#
|
253
|
+
# # The returned object is of type Google::Cloud::GkeRecommender::V1::FetchModelsResponse.
|
254
|
+
# p result
|
255
|
+
#
|
256
|
+
def fetch_models request, options = nil
|
257
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
258
|
+
|
259
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeRecommender::V1::FetchModelsRequest
|
260
|
+
|
261
|
+
# Converts hash and nil to an options object
|
262
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
263
|
+
|
264
|
+
# Customize the options with defaults
|
265
|
+
metadata = @config.rpcs.fetch_models.metadata.to_h
|
266
|
+
|
267
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
268
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
269
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
270
|
+
gapic_version: ::Google::Cloud::GkeRecommender::V1::VERSION
|
271
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
272
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
273
|
+
|
274
|
+
options.apply_defaults timeout: @config.rpcs.fetch_models.timeout,
|
275
|
+
metadata: metadata,
|
276
|
+
retry_policy: @config.rpcs.fetch_models.retry_policy
|
277
|
+
|
278
|
+
options.apply_defaults timeout: @config.timeout,
|
279
|
+
metadata: @config.metadata,
|
280
|
+
retry_policy: @config.retry_policy
|
281
|
+
|
282
|
+
@gke_inference_quickstart_stub.call_rpc :fetch_models, request, options: options do |response, operation|
|
283
|
+
yield response, operation if block_given?
|
284
|
+
end
|
285
|
+
rescue ::GRPC::BadStatus => e
|
286
|
+
raise ::Google::Cloud::Error.from_error(e)
|
287
|
+
end
|
288
|
+
|
289
|
+
##
|
290
|
+
# Fetches available model servers. Open-source model servers use simplified,
|
291
|
+
# lowercase names (e.g., `vllm`).
|
292
|
+
#
|
293
|
+
# @overload fetch_model_servers(request, options = nil)
|
294
|
+
# Pass arguments to `fetch_model_servers` via a request object, either of type
|
295
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchModelServersRequest} or an equivalent Hash.
|
296
|
+
#
|
297
|
+
# @param request [::Google::Cloud::GkeRecommender::V1::FetchModelServersRequest, ::Hash]
|
298
|
+
# A request object representing the call parameters. Required. To specify no
|
299
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
300
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
301
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
302
|
+
#
|
303
|
+
# @overload fetch_model_servers(model: nil, page_size: nil, page_token: nil)
|
304
|
+
# Pass arguments to `fetch_model_servers` via keyword arguments. Note that at
|
305
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
306
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
307
|
+
#
|
308
|
+
# @param model [::String]
|
309
|
+
# Required. The model for which to list model servers. Open-source models
|
310
|
+
# follow the Huggingface Hub `owner/model_name` format. Use
|
311
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_models GkeInferenceQuickstart.FetchModels}
|
312
|
+
# to find available models.
|
313
|
+
# @param page_size [::Integer]
|
314
|
+
# Optional. The target number of results to return in a single response.
|
315
|
+
# If not specified, a default value will be chosen by the service.
|
316
|
+
# Note that the response may include a partial list and a caller should
|
317
|
+
# only rely on the response's
|
318
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchModelServersResponse#next_page_token next_page_token}
|
319
|
+
# to determine if there are more instances left to be queried.
|
320
|
+
# @param page_token [::String]
|
321
|
+
# Optional. The value of
|
322
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchModelServersResponse#next_page_token next_page_token}
|
323
|
+
# received from a previous `FetchModelServersRequest` call.
|
324
|
+
# Provide this to retrieve the subsequent page in a multi-page list of
|
325
|
+
# results. When paginating, all other parameters provided to
|
326
|
+
# `FetchModelServersRequest` must match the call that provided the page
|
327
|
+
# token.
|
328
|
+
#
|
329
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
330
|
+
# @yieldparam response [::Google::Cloud::GkeRecommender::V1::FetchModelServersResponse]
|
331
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
332
|
+
#
|
333
|
+
# @return [::Google::Cloud::GkeRecommender::V1::FetchModelServersResponse]
|
334
|
+
#
|
335
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
336
|
+
#
|
337
|
+
# @example Basic example
|
338
|
+
# require "google/cloud/gke_recommender/v1"
|
339
|
+
#
|
340
|
+
# # Create a client object. The client can be reused for multiple calls.
|
341
|
+
# client = Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.new
|
342
|
+
#
|
343
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
344
|
+
# request = Google::Cloud::GkeRecommender::V1::FetchModelServersRequest.new
|
345
|
+
#
|
346
|
+
# # Call the fetch_model_servers method.
|
347
|
+
# result = client.fetch_model_servers request
|
348
|
+
#
|
349
|
+
# # The returned object is of type Google::Cloud::GkeRecommender::V1::FetchModelServersResponse.
|
350
|
+
# p result
|
351
|
+
#
|
352
|
+
def fetch_model_servers request, options = nil
|
353
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
354
|
+
|
355
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeRecommender::V1::FetchModelServersRequest
|
356
|
+
|
357
|
+
# Converts hash and nil to an options object
|
358
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
359
|
+
|
360
|
+
# Customize the options with defaults
|
361
|
+
metadata = @config.rpcs.fetch_model_servers.metadata.to_h
|
362
|
+
|
363
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
364
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
365
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
366
|
+
gapic_version: ::Google::Cloud::GkeRecommender::V1::VERSION
|
367
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
368
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
369
|
+
|
370
|
+
options.apply_defaults timeout: @config.rpcs.fetch_model_servers.timeout,
|
371
|
+
metadata: metadata,
|
372
|
+
retry_policy: @config.rpcs.fetch_model_servers.retry_policy
|
373
|
+
|
374
|
+
options.apply_defaults timeout: @config.timeout,
|
375
|
+
metadata: @config.metadata,
|
376
|
+
retry_policy: @config.retry_policy
|
377
|
+
|
378
|
+
@gke_inference_quickstart_stub.call_rpc :fetch_model_servers, request, options: options do |response, operation|
|
379
|
+
yield response, operation if block_given?
|
380
|
+
end
|
381
|
+
rescue ::GRPC::BadStatus => e
|
382
|
+
raise ::Google::Cloud::Error.from_error(e)
|
383
|
+
end
|
384
|
+
|
385
|
+
##
|
386
|
+
# Fetches available model server versions. Open-source servers use their own
|
387
|
+
# versioning schemas (e.g., `vllm` uses semver like `v1.0.0`).
|
388
|
+
#
|
389
|
+
# Some model servers have different versioning schemas depending on the
|
390
|
+
# accelerator. For example, `vllm` uses semver on GPUs, but returns nightly
|
391
|
+
# build tags on TPUs. All available versions will be returned when different
|
392
|
+
# schemas are present.
|
393
|
+
#
|
394
|
+
# @overload fetch_model_server_versions(request, options = nil)
|
395
|
+
# Pass arguments to `fetch_model_server_versions` via a request object, either of type
|
396
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchModelServerVersionsRequest} or an equivalent Hash.
|
397
|
+
#
|
398
|
+
# @param request [::Google::Cloud::GkeRecommender::V1::FetchModelServerVersionsRequest, ::Hash]
|
399
|
+
# A request object representing the call parameters. Required. To specify no
|
400
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
401
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
402
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
403
|
+
#
|
404
|
+
# @overload fetch_model_server_versions(model: nil, model_server: nil, page_size: nil, page_token: nil)
|
405
|
+
# Pass arguments to `fetch_model_server_versions` via keyword arguments. Note that at
|
406
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
407
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
408
|
+
#
|
409
|
+
# @param model [::String]
|
410
|
+
# Required. The model for which to list model server versions. Open-source
|
411
|
+
# models follow the Huggingface Hub `owner/model_name` format. Use
|
412
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_models GkeInferenceQuickstart.FetchModels}
|
413
|
+
# to find available models.
|
414
|
+
# @param model_server [::String]
|
415
|
+
# Required. The model server for which to list versions. Open-source model
|
416
|
+
# servers use simplified, lowercase names (e.g., `vllm`). Use
|
417
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_model_servers GkeInferenceQuickstart.FetchModelServers}
|
418
|
+
# to find available model servers.
|
419
|
+
# @param page_size [::Integer]
|
420
|
+
# Optional. The target number of results to return in a single response.
|
421
|
+
# If not specified, a default value will be chosen by the service.
|
422
|
+
# Note that the response may include a partial list and a caller should
|
423
|
+
# only rely on the response's
|
424
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchModelServerVersionsResponse#next_page_token next_page_token}
|
425
|
+
# to determine if there are more instances left to be queried.
|
426
|
+
# @param page_token [::String]
|
427
|
+
# Optional. The value of
|
428
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchModelServerVersionsResponse#next_page_token next_page_token}
|
429
|
+
# received from a previous `FetchModelServerVersionsRequest` call.
|
430
|
+
# Provide this to retrieve the subsequent page in a multi-page list of
|
431
|
+
# results. When paginating, all other parameters provided to
|
432
|
+
# `FetchModelServerVersionsRequest` must match the call that provided the
|
433
|
+
# page token.
|
434
|
+
#
|
435
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
436
|
+
# @yieldparam response [::Google::Cloud::GkeRecommender::V1::FetchModelServerVersionsResponse]
|
437
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
438
|
+
#
|
439
|
+
# @return [::Google::Cloud::GkeRecommender::V1::FetchModelServerVersionsResponse]
|
440
|
+
#
|
441
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
442
|
+
#
|
443
|
+
# @example Basic example
|
444
|
+
# require "google/cloud/gke_recommender/v1"
|
445
|
+
#
|
446
|
+
# # Create a client object. The client can be reused for multiple calls.
|
447
|
+
# client = Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.new
|
448
|
+
#
|
449
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
450
|
+
# request = Google::Cloud::GkeRecommender::V1::FetchModelServerVersionsRequest.new
|
451
|
+
#
|
452
|
+
# # Call the fetch_model_server_versions method.
|
453
|
+
# result = client.fetch_model_server_versions request
|
454
|
+
#
|
455
|
+
# # The returned object is of type Google::Cloud::GkeRecommender::V1::FetchModelServerVersionsResponse.
|
456
|
+
# p result
|
457
|
+
#
|
458
|
+
def fetch_model_server_versions request, options = nil
|
459
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
460
|
+
|
461
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeRecommender::V1::FetchModelServerVersionsRequest
|
462
|
+
|
463
|
+
# Converts hash and nil to an options object
|
464
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
465
|
+
|
466
|
+
# Customize the options with defaults
|
467
|
+
metadata = @config.rpcs.fetch_model_server_versions.metadata.to_h
|
468
|
+
|
469
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
470
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
471
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
472
|
+
gapic_version: ::Google::Cloud::GkeRecommender::V1::VERSION
|
473
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
474
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
475
|
+
|
476
|
+
options.apply_defaults timeout: @config.rpcs.fetch_model_server_versions.timeout,
|
477
|
+
metadata: metadata,
|
478
|
+
retry_policy: @config.rpcs.fetch_model_server_versions.retry_policy
|
479
|
+
|
480
|
+
options.apply_defaults timeout: @config.timeout,
|
481
|
+
metadata: @config.metadata,
|
482
|
+
retry_policy: @config.retry_policy
|
483
|
+
|
484
|
+
@gke_inference_quickstart_stub.call_rpc :fetch_model_server_versions, request, options: options do |response, operation|
|
485
|
+
yield response, operation if block_given?
|
486
|
+
end
|
487
|
+
rescue ::GRPC::BadStatus => e
|
488
|
+
raise ::Google::Cloud::Error.from_error(e)
|
489
|
+
end
|
490
|
+
|
491
|
+
##
|
492
|
+
# Fetches available profiles. A profile contains performance metrics and
|
493
|
+
# cost information for a specific model server setup. Profiles can be
|
494
|
+
# filtered by parameters. If no filters are provided, all profiles are
|
495
|
+
# returned.
|
496
|
+
#
|
497
|
+
# Profiles display a single value per performance metric based on the
|
498
|
+
# provided performance requirements. If no requirements are given, the
|
499
|
+
# metrics represent the inflection point. See [Run best practice inference
|
500
|
+
# with GKE Inference Quickstart
|
501
|
+
# recipes](https://cloud.google.com/kubernetes-engine/docs/how-to/machine-learning/inference/inference-quickstart#how)
|
502
|
+
# for details.
|
503
|
+
#
|
504
|
+
# @overload fetch_profiles(request, options = nil)
|
505
|
+
# Pass arguments to `fetch_profiles` via a request object, either of type
|
506
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchProfilesRequest} or an equivalent Hash.
|
507
|
+
#
|
508
|
+
# @param request [::Google::Cloud::GkeRecommender::V1::FetchProfilesRequest, ::Hash]
|
509
|
+
# A request object representing the call parameters. Required. To specify no
|
510
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
511
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
512
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
513
|
+
#
|
514
|
+
# @overload fetch_profiles(model: nil, model_server: nil, model_server_version: nil, performance_requirements: nil, page_size: nil, page_token: nil)
|
515
|
+
# Pass arguments to `fetch_profiles` via keyword arguments. Note that at
|
516
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
517
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
518
|
+
#
|
519
|
+
# @param model [::String]
|
520
|
+
# Optional. The model to filter profiles by. Open-source models follow the
|
521
|
+
# Huggingface Hub `owner/model_name` format. If not provided, all models are
|
522
|
+
# returned. Use
|
523
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_models GkeInferenceQuickstart.FetchModels}
|
524
|
+
# to find available models.
|
525
|
+
# @param model_server [::String]
|
526
|
+
# Optional. The model server to filter profiles by. If not provided, all
|
527
|
+
# model servers are returned. Use
|
528
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_model_servers GkeInferenceQuickstart.FetchModelServers}
|
529
|
+
# to find available model servers for a given model.
|
530
|
+
# @param model_server_version [::String]
|
531
|
+
# Optional. The model server version to filter profiles by. If not provided,
|
532
|
+
# all model server versions are returned. Use
|
533
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_model_server_versions GkeInferenceQuickstart.FetchModelServerVersions}
|
534
|
+
# to find available versions for a given model and server.
|
535
|
+
# @param performance_requirements [::Google::Cloud::GkeRecommender::V1::PerformanceRequirements, ::Hash]
|
536
|
+
# Optional. The performance requirements to filter profiles. Profiles that do
|
537
|
+
# not meet these requirements are filtered out. If not provided, all profiles
|
538
|
+
# are returned.
|
539
|
+
# @param page_size [::Integer]
|
540
|
+
# Optional. The target number of results to return in a single response. If
|
541
|
+
# not specified, a default value will be chosen by the service. Note that the
|
542
|
+
# response may include a partial list and a caller should only rely on the
|
543
|
+
# response's
|
544
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchProfilesResponse#next_page_token next_page_token}
|
545
|
+
# to determine if there are more instances left to be queried.
|
546
|
+
# @param page_token [::String]
|
547
|
+
# Optional. The value of
|
548
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchProfilesResponse#next_page_token next_page_token}
|
549
|
+
# received from a previous `FetchProfilesRequest` call.
|
550
|
+
# Provide this to retrieve the subsequent page in a multi-page list of
|
551
|
+
# results. When paginating, all other parameters provided to
|
552
|
+
# `FetchProfilesRequest` must match the call that provided the page
|
553
|
+
# token.
|
554
|
+
#
|
555
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
556
|
+
# @yieldparam response [::Gapic::PagedEnumerable<::Google::Cloud::GkeRecommender::V1::Profile>]
|
557
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
558
|
+
#
|
559
|
+
# @return [::Gapic::PagedEnumerable<::Google::Cloud::GkeRecommender::V1::Profile>]
|
560
|
+
#
|
561
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
562
|
+
#
|
563
|
+
# @example Basic example
|
564
|
+
# require "google/cloud/gke_recommender/v1"
|
565
|
+
#
|
566
|
+
# # Create a client object. The client can be reused for multiple calls.
|
567
|
+
# client = Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.new
|
568
|
+
#
|
569
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
570
|
+
# request = Google::Cloud::GkeRecommender::V1::FetchProfilesRequest.new
|
571
|
+
#
|
572
|
+
# # Call the fetch_profiles method.
|
573
|
+
# result = client.fetch_profiles request
|
574
|
+
#
|
575
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
576
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
577
|
+
# result.each do |item|
|
578
|
+
# # Each element is of type ::Google::Cloud::GkeRecommender::V1::Profile.
|
579
|
+
# p item
|
580
|
+
# end
|
581
|
+
#
|
582
|
+
def fetch_profiles request, options = nil
|
583
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
584
|
+
|
585
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeRecommender::V1::FetchProfilesRequest
|
586
|
+
|
587
|
+
# Converts hash and nil to an options object
|
588
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
589
|
+
|
590
|
+
# Customize the options with defaults
|
591
|
+
metadata = @config.rpcs.fetch_profiles.metadata.to_h
|
592
|
+
|
593
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
594
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
595
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
596
|
+
gapic_version: ::Google::Cloud::GkeRecommender::V1::VERSION
|
597
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
598
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
599
|
+
|
600
|
+
options.apply_defaults timeout: @config.rpcs.fetch_profiles.timeout,
|
601
|
+
metadata: metadata,
|
602
|
+
retry_policy: @config.rpcs.fetch_profiles.retry_policy
|
603
|
+
|
604
|
+
options.apply_defaults timeout: @config.timeout,
|
605
|
+
metadata: @config.metadata,
|
606
|
+
retry_policy: @config.retry_policy
|
607
|
+
|
608
|
+
@gke_inference_quickstart_stub.call_rpc :fetch_profiles, request, options: options do |response, operation|
|
609
|
+
response = ::Gapic::PagedEnumerable.new @gke_inference_quickstart_stub, :fetch_profiles, request, response, operation, options
|
610
|
+
yield response, operation if block_given?
|
611
|
+
throw :response, response
|
612
|
+
end
|
613
|
+
rescue ::GRPC::BadStatus => e
|
614
|
+
raise ::Google::Cloud::Error.from_error(e)
|
615
|
+
end
|
616
|
+
|
617
|
+
##
|
618
|
+
# Generates an optimized deployment manifest for a given model and model
|
619
|
+
# server, based on the specified accelerator, performance targets, and
|
620
|
+
# configurations. See [Run best practice inference with GKE Inference
|
621
|
+
# Quickstart
|
622
|
+
# recipes](https://cloud.google.com/kubernetes-engine/docs/how-to/machine-learning/inference/inference-quickstart)
|
623
|
+
# for deployment details.
|
624
|
+
#
|
625
|
+
# @overload generate_optimized_manifest(request, options = nil)
|
626
|
+
# Pass arguments to `generate_optimized_manifest` via a request object, either of type
|
627
|
+
# {::Google::Cloud::GkeRecommender::V1::GenerateOptimizedManifestRequest} or an equivalent Hash.
|
628
|
+
#
|
629
|
+
# @param request [::Google::Cloud::GkeRecommender::V1::GenerateOptimizedManifestRequest, ::Hash]
|
630
|
+
# A request object representing the call parameters. Required. To specify no
|
631
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
632
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
633
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
634
|
+
#
|
635
|
+
# @overload generate_optimized_manifest(model_server_info: nil, accelerator_type: nil, kubernetes_namespace: nil, performance_requirements: nil, storage_config: nil)
|
636
|
+
# Pass arguments to `generate_optimized_manifest` via keyword arguments. Note that at
|
637
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
638
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
639
|
+
#
|
640
|
+
# @param model_server_info [::Google::Cloud::GkeRecommender::V1::ModelServerInfo, ::Hash]
|
641
|
+
# Required. The model server configuration to generate the manifest for. Use
|
642
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_profiles GkeInferenceQuickstart.FetchProfiles}
|
643
|
+
# to find valid configurations.
|
644
|
+
# @param accelerator_type [::String]
|
645
|
+
# Required. The accelerator type. Use
|
646
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_profiles GkeInferenceQuickstart.FetchProfiles}
|
647
|
+
# to find valid accelerators for a given `model_server_info`.
|
648
|
+
# @param kubernetes_namespace [::String]
|
649
|
+
# Optional. The kubernetes namespace to deploy the manifests in.
|
650
|
+
# @param performance_requirements [::Google::Cloud::GkeRecommender::V1::PerformanceRequirements, ::Hash]
|
651
|
+
# Optional. The performance requirements to use for generating Horizontal Pod
|
652
|
+
# Autoscaler (HPA) resources. If provided, the manifest includes HPA
|
653
|
+
# resources to adjust the model server replica count to maintain the
|
654
|
+
# specified targets (e.g., NTPOT, TTFT) at a P50 latency. Cost targets are
|
655
|
+
# not currently supported for HPA generation. If the specified targets are
|
656
|
+
# not achievable, the HPA manifest will not be generated.
|
657
|
+
# @param storage_config [::Google::Cloud::GkeRecommender::V1::StorageConfig, ::Hash]
|
658
|
+
# Optional. The storage configuration for the model. If not provided, the
|
659
|
+
# model is loaded from Huggingface.
|
660
|
+
#
|
661
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
662
|
+
# @yieldparam response [::Google::Cloud::GkeRecommender::V1::GenerateOptimizedManifestResponse]
|
663
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
664
|
+
#
|
665
|
+
# @return [::Google::Cloud::GkeRecommender::V1::GenerateOptimizedManifestResponse]
|
666
|
+
#
|
667
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
668
|
+
#
|
669
|
+
# @example Basic example
|
670
|
+
# require "google/cloud/gke_recommender/v1"
|
671
|
+
#
|
672
|
+
# # Create a client object. The client can be reused for multiple calls.
|
673
|
+
# client = Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.new
|
674
|
+
#
|
675
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
676
|
+
# request = Google::Cloud::GkeRecommender::V1::GenerateOptimizedManifestRequest.new
|
677
|
+
#
|
678
|
+
# # Call the generate_optimized_manifest method.
|
679
|
+
# result = client.generate_optimized_manifest request
|
680
|
+
#
|
681
|
+
# # The returned object is of type Google::Cloud::GkeRecommender::V1::GenerateOptimizedManifestResponse.
|
682
|
+
# p result
|
683
|
+
#
|
684
|
+
def generate_optimized_manifest request, options = nil
|
685
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
686
|
+
|
687
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeRecommender::V1::GenerateOptimizedManifestRequest
|
688
|
+
|
689
|
+
# Converts hash and nil to an options object
|
690
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
691
|
+
|
692
|
+
# Customize the options with defaults
|
693
|
+
metadata = @config.rpcs.generate_optimized_manifest.metadata.to_h
|
694
|
+
|
695
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
696
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
697
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
698
|
+
gapic_version: ::Google::Cloud::GkeRecommender::V1::VERSION
|
699
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
700
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
701
|
+
|
702
|
+
options.apply_defaults timeout: @config.rpcs.generate_optimized_manifest.timeout,
|
703
|
+
metadata: metadata,
|
704
|
+
retry_policy: @config.rpcs.generate_optimized_manifest.retry_policy
|
705
|
+
|
706
|
+
options.apply_defaults timeout: @config.timeout,
|
707
|
+
metadata: @config.metadata,
|
708
|
+
retry_policy: @config.retry_policy
|
709
|
+
|
710
|
+
@gke_inference_quickstart_stub.call_rpc :generate_optimized_manifest, request, options: options do |response, operation|
|
711
|
+
yield response, operation if block_given?
|
712
|
+
end
|
713
|
+
rescue ::GRPC::BadStatus => e
|
714
|
+
raise ::Google::Cloud::Error.from_error(e)
|
715
|
+
end
|
716
|
+
|
717
|
+
##
|
718
|
+
# Fetches all of the benchmarking data available for a profile. Benchmarking
|
719
|
+
# data returns all of the performance metrics available for a given model
|
720
|
+
# server setup on a given instance type.
|
721
|
+
#
|
722
|
+
# @overload fetch_benchmarking_data(request, options = nil)
|
723
|
+
# Pass arguments to `fetch_benchmarking_data` via a request object, either of type
|
724
|
+
# {::Google::Cloud::GkeRecommender::V1::FetchBenchmarkingDataRequest} or an equivalent Hash.
|
725
|
+
#
|
726
|
+
# @param request [::Google::Cloud::GkeRecommender::V1::FetchBenchmarkingDataRequest, ::Hash]
|
727
|
+
# A request object representing the call parameters. Required. To specify no
|
728
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
729
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
730
|
+
# Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
|
731
|
+
#
|
732
|
+
# @overload fetch_benchmarking_data(model_server_info: nil, instance_type: nil, pricing_model: nil)
|
733
|
+
# Pass arguments to `fetch_benchmarking_data` via keyword arguments. Note that at
|
734
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
735
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
736
|
+
#
|
737
|
+
# @param model_server_info [::Google::Cloud::GkeRecommender::V1::ModelServerInfo, ::Hash]
|
738
|
+
# Required. The model server configuration to get benchmarking data for. Use
|
739
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_profiles GkeInferenceQuickstart.FetchProfiles}
|
740
|
+
# to find valid configurations.
|
741
|
+
# @param instance_type [::String]
|
742
|
+
# Optional. The instance type to filter benchmarking data. Instance types are
|
743
|
+
# in the format `a2-highgpu-1g`. If not provided, all instance types for the
|
744
|
+
# given profile's `model_server_info` will be returned. Use
|
745
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client#fetch_profiles GkeInferenceQuickstart.FetchProfiles}
|
746
|
+
# to find available instance types.
|
747
|
+
# @param pricing_model [::String]
|
748
|
+
# Optional. The pricing model to use for the benchmarking data. Defaults to
|
749
|
+
# `spot`.
|
750
|
+
#
|
751
|
+
# @yield [response, operation] Access the result along with the RPC operation
|
752
|
+
# @yieldparam response [::Google::Cloud::GkeRecommender::V1::FetchBenchmarkingDataResponse]
|
753
|
+
# @yieldparam operation [::GRPC::ActiveCall::Operation]
|
754
|
+
#
|
755
|
+
# @return [::Google::Cloud::GkeRecommender::V1::FetchBenchmarkingDataResponse]
|
756
|
+
#
|
757
|
+
# @raise [::Google::Cloud::Error] if the RPC is aborted.
|
758
|
+
#
|
759
|
+
# @example Basic example
|
760
|
+
# require "google/cloud/gke_recommender/v1"
|
761
|
+
#
|
762
|
+
# # Create a client object. The client can be reused for multiple calls.
|
763
|
+
# client = Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.new
|
764
|
+
#
|
765
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
766
|
+
# request = Google::Cloud::GkeRecommender::V1::FetchBenchmarkingDataRequest.new
|
767
|
+
#
|
768
|
+
# # Call the fetch_benchmarking_data method.
|
769
|
+
# result = client.fetch_benchmarking_data request
|
770
|
+
#
|
771
|
+
# # The returned object is of type Google::Cloud::GkeRecommender::V1::FetchBenchmarkingDataResponse.
|
772
|
+
# p result
|
773
|
+
#
|
774
|
+
def fetch_benchmarking_data request, options = nil
|
775
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
776
|
+
|
777
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::GkeRecommender::V1::FetchBenchmarkingDataRequest
|
778
|
+
|
779
|
+
# Converts hash and nil to an options object
|
780
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
781
|
+
|
782
|
+
# Customize the options with defaults
|
783
|
+
metadata = @config.rpcs.fetch_benchmarking_data.metadata.to_h
|
784
|
+
|
785
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
786
|
+
metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
787
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
788
|
+
gapic_version: ::Google::Cloud::GkeRecommender::V1::VERSION
|
789
|
+
metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
790
|
+
metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
791
|
+
|
792
|
+
options.apply_defaults timeout: @config.rpcs.fetch_benchmarking_data.timeout,
|
793
|
+
metadata: metadata,
|
794
|
+
retry_policy: @config.rpcs.fetch_benchmarking_data.retry_policy
|
795
|
+
|
796
|
+
options.apply_defaults timeout: @config.timeout,
|
797
|
+
metadata: @config.metadata,
|
798
|
+
retry_policy: @config.retry_policy
|
799
|
+
|
800
|
+
@gke_inference_quickstart_stub.call_rpc :fetch_benchmarking_data, request, options: options do |response, operation|
|
801
|
+
yield response, operation if block_given?
|
802
|
+
end
|
803
|
+
rescue ::GRPC::BadStatus => e
|
804
|
+
raise ::Google::Cloud::Error.from_error(e)
|
805
|
+
end
|
806
|
+
|
807
|
+
##
|
808
|
+
# Configuration class for the GkeInferenceQuickstart API.
|
809
|
+
#
|
810
|
+
# This class represents the configuration for GkeInferenceQuickstart,
|
811
|
+
# providing control over timeouts, retry behavior, logging, transport
|
812
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
813
|
+
# applied individually to specific RPCs. See
|
814
|
+
# {::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client::Configuration::Rpcs}
|
815
|
+
# for a list of RPCs that can be configured independently.
|
816
|
+
#
|
817
|
+
# Configuration can be applied globally to all clients, or to a single client
|
818
|
+
# on construction.
|
819
|
+
#
|
820
|
+
# @example
|
821
|
+
#
|
822
|
+
# # Modify the global config, setting the timeout for
|
823
|
+
# # fetch_models to 20 seconds,
|
824
|
+
# # and all remaining timeouts to 10 seconds.
|
825
|
+
# ::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.configure do |config|
|
826
|
+
# config.timeout = 10.0
|
827
|
+
# config.rpcs.fetch_models.timeout = 20.0
|
828
|
+
# end
|
829
|
+
#
|
830
|
+
# # Apply the above configuration only to a new client.
|
831
|
+
# client = ::Google::Cloud::GkeRecommender::V1::GkeInferenceQuickstart::Client.new do |config|
|
832
|
+
# config.timeout = 10.0
|
833
|
+
# config.rpcs.fetch_models.timeout = 20.0
|
834
|
+
# end
|
835
|
+
#
|
836
|
+
# @!attribute [rw] endpoint
|
837
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
838
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
839
|
+
# @return [::String,nil]
|
840
|
+
# @!attribute [rw] credentials
|
841
|
+
# Credentials to send with calls. You may provide any of the following types:
|
842
|
+
# * (`String`) The path to a service account key file in JSON format
|
843
|
+
# * (`Hash`) A service account key as a Hash
|
844
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
845
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
846
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
847
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
848
|
+
# * (`GRPC::Core::Channel`) a gRPC channel with included credentials
|
849
|
+
# * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
|
850
|
+
# * (`nil`) indicating no credentials
|
851
|
+
#
|
852
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
853
|
+
# external source for authentication to Google Cloud, you must validate it before
|
854
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
855
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
856
|
+
# For more information, refer to [Validate credential configurations from external
|
857
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
858
|
+
# @return [::Object]
|
859
|
+
# @!attribute [rw] scope
|
860
|
+
# The OAuth scopes
|
861
|
+
# @return [::Array<::String>]
|
862
|
+
# @!attribute [rw] lib_name
|
863
|
+
# The library name as recorded in instrumentation and logging
|
864
|
+
# @return [::String]
|
865
|
+
# @!attribute [rw] lib_version
|
866
|
+
# The library version as recorded in instrumentation and logging
|
867
|
+
# @return [::String]
|
868
|
+
# @!attribute [rw] channel_args
|
869
|
+
# Extra parameters passed to the gRPC channel. Note: this is ignored if a
|
870
|
+
# `GRPC::Core::Channel` object is provided as the credential.
|
871
|
+
# @return [::Hash]
|
872
|
+
# @!attribute [rw] interceptors
|
873
|
+
# An array of interceptors that are run before calls are executed.
|
874
|
+
# @return [::Array<::GRPC::ClientInterceptor>]
|
875
|
+
# @!attribute [rw] timeout
|
876
|
+
# The call timeout in seconds.
|
877
|
+
# @return [::Numeric]
|
878
|
+
# @!attribute [rw] metadata
|
879
|
+
# Additional gRPC headers to be sent with the call.
|
880
|
+
# @return [::Hash{::Symbol=>::String}]
|
881
|
+
# @!attribute [rw] retry_policy
|
882
|
+
# The retry policy. The value is a hash with the following keys:
|
883
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
884
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
885
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
886
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
887
|
+
# trigger a retry.
|
888
|
+
# @return [::Hash]
|
889
|
+
# @!attribute [rw] quota_project
|
890
|
+
# A separate project against which to charge quota.
|
891
|
+
# @return [::String]
|
892
|
+
# @!attribute [rw] universe_domain
|
893
|
+
# The universe domain within which to make requests. This determines the
|
894
|
+
# default endpoint URL. The default value of nil uses the environment
|
895
|
+
# universe (usually the default "googleapis.com" universe).
|
896
|
+
# @return [::String,nil]
|
897
|
+
# @!attribute [rw] logger
|
898
|
+
# A custom logger to use for request/response debug logging, or the value
|
899
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
900
|
+
# explicitly disable logging.
|
901
|
+
# @return [::Logger,:default,nil]
|
902
|
+
#
|
903
|
+
class Configuration
|
904
|
+
extend ::Gapic::Config
|
905
|
+
|
906
|
+
# @private
|
907
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
908
|
+
DEFAULT_ENDPOINT = "gkerecommender.googleapis.com"
|
909
|
+
|
910
|
+
config_attr :endpoint, nil, ::String, nil
|
911
|
+
config_attr :credentials, nil do |value|
|
912
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
|
913
|
+
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC::Core::Channel
|
914
|
+
allowed.any? { |klass| klass === value }
|
915
|
+
end
|
916
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
917
|
+
config_attr :lib_name, nil, ::String, nil
|
918
|
+
config_attr :lib_version, nil, ::String, nil
|
919
|
+
config_attr(:channel_args, { "grpc.service_config_disable_resolution" => 1 }, ::Hash, nil)
|
920
|
+
config_attr :interceptors, nil, ::Array, nil
|
921
|
+
config_attr :timeout, nil, ::Numeric, nil
|
922
|
+
config_attr :metadata, nil, ::Hash, nil
|
923
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
924
|
+
config_attr :quota_project, nil, ::String, nil
|
925
|
+
config_attr :universe_domain, nil, ::String, nil
|
926
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
927
|
+
|
928
|
+
# @private
|
929
|
+
def initialize parent_config = nil
|
930
|
+
@parent_config = parent_config unless parent_config.nil?
|
931
|
+
|
932
|
+
yield self if block_given?
|
933
|
+
end
|
934
|
+
|
935
|
+
##
|
936
|
+
# Configurations for individual RPCs
|
937
|
+
# @return [Rpcs]
|
938
|
+
#
|
939
|
+
def rpcs
|
940
|
+
@rpcs ||= begin
|
941
|
+
parent_rpcs = nil
|
942
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
943
|
+
Rpcs.new parent_rpcs
|
944
|
+
end
|
945
|
+
end
|
946
|
+
|
947
|
+
##
|
948
|
+
# Configuration for the channel pool
|
949
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
950
|
+
#
|
951
|
+
def channel_pool
|
952
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
953
|
+
end
|
954
|
+
|
955
|
+
##
|
956
|
+
# Configuration RPC class for the GkeInferenceQuickstart API.
|
957
|
+
#
|
958
|
+
# Includes fields providing the configuration for each RPC in this service.
|
959
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
960
|
+
# the following configuration fields:
|
961
|
+
#
|
962
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
963
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional gRPC headers
|
964
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
965
|
+
# include the following keys:
|
966
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
967
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
968
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
969
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
970
|
+
# trigger a retry.
|
971
|
+
#
|
972
|
+
class Rpcs
|
973
|
+
##
|
974
|
+
# RPC-specific configuration for `fetch_models`
|
975
|
+
# @return [::Gapic::Config::Method]
|
976
|
+
#
|
977
|
+
attr_reader :fetch_models
|
978
|
+
##
|
979
|
+
# RPC-specific configuration for `fetch_model_servers`
|
980
|
+
# @return [::Gapic::Config::Method]
|
981
|
+
#
|
982
|
+
attr_reader :fetch_model_servers
|
983
|
+
##
|
984
|
+
# RPC-specific configuration for `fetch_model_server_versions`
|
985
|
+
# @return [::Gapic::Config::Method]
|
986
|
+
#
|
987
|
+
attr_reader :fetch_model_server_versions
|
988
|
+
##
|
989
|
+
# RPC-specific configuration for `fetch_profiles`
|
990
|
+
# @return [::Gapic::Config::Method]
|
991
|
+
#
|
992
|
+
attr_reader :fetch_profiles
|
993
|
+
##
|
994
|
+
# RPC-specific configuration for `generate_optimized_manifest`
|
995
|
+
# @return [::Gapic::Config::Method]
|
996
|
+
#
|
997
|
+
attr_reader :generate_optimized_manifest
|
998
|
+
##
|
999
|
+
# RPC-specific configuration for `fetch_benchmarking_data`
|
1000
|
+
# @return [::Gapic::Config::Method]
|
1001
|
+
#
|
1002
|
+
attr_reader :fetch_benchmarking_data
|
1003
|
+
|
1004
|
+
# @private
|
1005
|
+
def initialize parent_rpcs = nil
|
1006
|
+
fetch_models_config = parent_rpcs.fetch_models if parent_rpcs.respond_to? :fetch_models
|
1007
|
+
@fetch_models = ::Gapic::Config::Method.new fetch_models_config
|
1008
|
+
fetch_model_servers_config = parent_rpcs.fetch_model_servers if parent_rpcs.respond_to? :fetch_model_servers
|
1009
|
+
@fetch_model_servers = ::Gapic::Config::Method.new fetch_model_servers_config
|
1010
|
+
fetch_model_server_versions_config = parent_rpcs.fetch_model_server_versions if parent_rpcs.respond_to? :fetch_model_server_versions
|
1011
|
+
@fetch_model_server_versions = ::Gapic::Config::Method.new fetch_model_server_versions_config
|
1012
|
+
fetch_profiles_config = parent_rpcs.fetch_profiles if parent_rpcs.respond_to? :fetch_profiles
|
1013
|
+
@fetch_profiles = ::Gapic::Config::Method.new fetch_profiles_config
|
1014
|
+
generate_optimized_manifest_config = parent_rpcs.generate_optimized_manifest if parent_rpcs.respond_to? :generate_optimized_manifest
|
1015
|
+
@generate_optimized_manifest = ::Gapic::Config::Method.new generate_optimized_manifest_config
|
1016
|
+
fetch_benchmarking_data_config = parent_rpcs.fetch_benchmarking_data if parent_rpcs.respond_to? :fetch_benchmarking_data
|
1017
|
+
@fetch_benchmarking_data = ::Gapic::Config::Method.new fetch_benchmarking_data_config
|
1018
|
+
|
1019
|
+
yield self if block_given?
|
1020
|
+
end
|
1021
|
+
end
|
1022
|
+
end
|
1023
|
+
end
|
1024
|
+
end
|
1025
|
+
end
|
1026
|
+
end
|
1027
|
+
end
|
1028
|
+
end
|