Skip to content

Commit 8ab5fcc

Browse files
feat: [google-cloud-bigquery-reservation] Add Reservation.max_slots field to Reservation proto, indicating the total max number of slots this reservation can use up to (#14243)
BEGIN_COMMIT_OVERRIDE feat: Add Reservation.max_slots field to Reservation proto, indicating the total max number of slots this reservation can use up to feat: Add Reservation.scaling_mode field and its corresponding enum message ScalingMode. This field should be used together with Reservation.max_slots END_COMMIT_OVERRIDE - [ ] Regenerate this pull request now. feat: Add Reservation.scaling_mode field and its corresponding enum message ScalingMode. This field should be used together with Reservation.max_slots PiperOrigin-RevId: 795606766 Source-Link: googleapis/googleapis@6388d14 Source-Link: googleapis/googleapis-gen@9fc20ac Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWJpZ3F1ZXJ5LXJlc2VydmF0aW9uLy5Pd2xCb3QueWFtbCIsImgiOiI5ZmMyMGFjMDdkZDFkNGUxYzMxYzViNTZiYzEwYzlmZDMzYzU1ZjkwIn0= --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: ohmayr <[email protected]>
1 parent 420f939 commit 8ab5fcc

File tree

5 files changed

+209
-3
lines changed

5 files changed

+209
-3
lines changed

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.17.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "1.17.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-bigquery-reservation/google/cloud/bigquery_reservation_v1/types/reservation.py

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ class Reservation(proto.Message):
9090
r"""A reservation is a mechanism used to guarantee slots to
9191
users.
9292
93+
94+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
95+
9396
Attributes:
9497
name (str):
9598
The resource name of the reservation, e.g.,
@@ -177,6 +180,60 @@ class Reservation(proto.Message):
177180
only during the failover reservation's creation.
178181
All billing charges for the failover reservation
179182
will be applied to this location.
183+
max_slots (int):
184+
Optional. The overall max slots for the reservation,
185+
covering slot_capacity (baseline), idle slots (if
186+
ignore_idle_slots is false) and scaled slots. If present,
187+
the reservation won't use more than the specified number of
188+
slots, even if there is demand and supply (from idle slots).
189+
NOTE: capping a reservation's idle slot usage is best effort
190+
and its usage may exceed the max_slots value. However, in
191+
terms of autoscale.current_slots (which accounts for the
192+
additional added slots), it will never exceed the max_slots
193+
- baseline.
194+
195+
This field must be set together with the scaling_mode enum
196+
value.
197+
198+
If the max_slots and scaling_mode are set, the autoscale or
199+
autoscale.max_slots field must be unset. However, the
200+
autoscale field may still be in the output. The
201+
autopscale.max_slots will always show as 0 and the
202+
autoscaler.current_slots will represent the current slots
203+
from autoscaler excluding idle slots. For example, if the
204+
max_slots is 1000 and scaling_mode is AUTOSCALE_ONLY, then
205+
in the output, the autoscaler.max_slots will be 0 and the
206+
autoscaler.current_slots may be any value between 0 and
207+
1000.
208+
209+
If the max_slots is 1000, scaling_mode is ALL_SLOTS, the
210+
baseline is 100 and idle slots usage is 200, then in the
211+
output, the autoscaler.max_slots will be 0 and the
212+
autoscaler.current_slots will not be higher than 700.
213+
214+
If the max_slots is 1000, scaling_mode is IDLE_SLOTS_ONLY,
215+
then in the output, the autoscaler field will be null.
216+
217+
If the max_slots and scaling_mode are set, then the
218+
ignore_idle_slots field must be aligned with the
219+
scaling_mode enum value.(See details in ScalingMode
220+
comments).
221+
222+
Please note, the max_slots is for user to manage the part of
223+
slots greater than the baseline. Therefore, we don't allow
224+
users to set max_slots smaller or equal to the baseline as
225+
it will not be meaningful. If the field is present and
226+
slot_capacity>=max_slots.
227+
228+
Please note that if max_slots is set to 0, we will treat it
229+
as unset. Customers can set max_slots to 0 and set
230+
scaling_mode to SCALING_MODE_UNSPECIFIED to disable the
231+
max_slots feature.
232+
233+
This field is a member of `oneof`_ ``_max_slots``.
234+
scaling_mode (google.cloud.bigquery_reservation_v1.types.Reservation.ScalingMode):
235+
Optional. The scaling mode for the reservation. If the field
236+
is present but max_slots is not present.
180237
replication_status (google.cloud.bigquery_reservation_v1.types.Reservation.ReplicationStatus):
181238
Output only. The Disaster Recovery(DR)
182239
replication status of the reservation. This is
@@ -192,6 +249,73 @@ class Reservation(proto.Message):
192249
reservation have succeeded.
193250
"""
194251

252+
class ScalingMode(proto.Enum):
253+
r"""The scaling mode for the reservation. This enum determines
254+
how the reservation scales up and down.
255+
256+
Values:
257+
SCALING_MODE_UNSPECIFIED (0):
258+
Default value of ScalingMode.
259+
AUTOSCALE_ONLY (1):
260+
The reservation will scale up only using slots from
261+
autoscaling. It will not use any idle slots even if there
262+
may be some available. The upper limit that autoscaling can
263+
scale up to will be max_slots - baseline. For example, if
264+
max_slots is 1000, baseline is 200 and customer sets
265+
ScalingMode to AUTOSCALE_ONLY, then autoscalerg will scale
266+
up to 800 slots and no idle slots will be used.
267+
268+
Please note, in this mode, the ignore_idle_slots field must
269+
be set to true.
270+
IDLE_SLOTS_ONLY (2):
271+
The reservation will scale up using only idle slots
272+
contributed by other reservations or from unassigned
273+
commitments. If no idle slots are available it will not
274+
scale up further. If the idle slots which it is using are
275+
reclaimed by the contributing reservation(s) it may be
276+
forced to scale down. The max idle slots the reservation can
277+
be max_slots - baseline capacity. For example, if max_slots
278+
is 1000, baseline is 200 and customer sets ScalingMode to
279+
IDLE_SLOTS_ONLY,
280+
281+
1. if there are 1000 idle slots available in other
282+
reservations, the reservation will scale up to 1000 slots
283+
with 200 baseline and 800 idle slots.
284+
2. if there are 500 idle slots available in other
285+
reservations, the reservation will scale up to 700 slots
286+
with 200 baseline and 300 idle slots. Please note, in
287+
this mode, the reservation might not be able to scale up
288+
to max_slots.
289+
290+
Please note, in this mode, the ignore_idle_slots field must
291+
be set to false.
292+
ALL_SLOTS (3):
293+
The reservation will scale up using all slots available to
294+
it. It will use idle slots contributed by other reservations
295+
or from unassigned commitments first. If no idle slots are
296+
available it will scale up using autoscaling. For example,
297+
if max_slots is 1000, baseline is 200 and customer sets
298+
ScalingMode to ALL_SLOTS,
299+
300+
1. if there are 800 idle slots available in other
301+
reservations, the reservation will scale up to 1000 slots
302+
with 200 baseline and 800 idle slots.
303+
2. if there are 500 idle slots available in other
304+
reservations, the reservation will scale up to 1000 slots
305+
with 200 baseline, 500 idle slots and 300 autoscaling
306+
slots.
307+
3. if there are no idle slots available in other
308+
reservations, it will scale up to 1000 slots with 200
309+
baseline and 800 autoscaling slots.
310+
311+
Please note, in this mode, the ignore_idle_slots field must
312+
be set to false.
313+
"""
314+
SCALING_MODE_UNSPECIFIED = 0
315+
AUTOSCALE_ONLY = 1
316+
IDLE_SLOTS_ONLY = 2
317+
ALL_SLOTS = 3
318+
195319
class Autoscale(proto.Message):
196320
r"""Auto scaling settings.
197321
@@ -305,6 +429,16 @@ class ReplicationStatus(proto.Message):
305429
proto.STRING,
306430
number=20,
307431
)
432+
max_slots: int = proto.Field(
433+
proto.INT64,
434+
number=21,
435+
optional=True,
436+
)
437+
scaling_mode: ScalingMode = proto.Field(
438+
proto.ENUM,
439+
number=22,
440+
enum=ScalingMode,
441+
)
308442
replication_status: ReplicationStatus = proto.Field(
309443
proto.MESSAGE,
310444
number=24,

packages/google-cloud-bigquery-reservation/samples/generated_samples/snippet_metadata_google.cloud.bigquery.reservation.v1.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
],
99
"language": "PYTHON",
1010
"name": "google-cloud-bigquery-reservation",
11-
"version": "1.17.2"
11+
"version": "0.1.0"
1212
},
1313
"snippets": [
1414
{

0 commit comments

Comments
 (0)