Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .librarian/generator-input/librarian.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,4 +250,4 @@

# Use a python runtime which is available in the owlbot post processor here
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
s.shell.run(["nox", "-s", "blacken-3.14"], hide_output=False)
s.shell.run(["nox", "-s", "format-3.14"], hide_output=False)
83 changes: 73 additions & 10 deletions .librarian/generator-input/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.


# Generated by synthtool. DO NOT EDIT!

from __future__ import absolute_import
Expand Down Expand Up @@ -64,6 +65,7 @@
SYSTEM_TEST_STANDARD_DEPENDENCIES: List[str] = [
"mock",
"pytest",
"pytest-asyncio",
"google-cloud-testutils",
]
SYSTEM_TEST_EXTERNAL_DEPENDENCIES: List[str] = []
Expand Down Expand Up @@ -217,9 +219,8 @@ def unit(session, protobuf_implementation):
session.install("protobuf<4")

# Run py.test against the unit tests.
session.run(
args = [
"py.test",
"--quiet",
"-s",
f"--junitxml=unit_{session.python}_sponge_log.xml",
"--cov=google",
Expand All @@ -228,8 +229,13 @@ def unit(session, protobuf_implementation):
"--cov-config=.coveragerc",
"--cov-report=",
"--cov-fail-under=0",
os.path.join("tests", "unit"),
*session.posargs,
]
if not session.posargs:
args.append(os.path.join("tests", "unit"))
args.extend(session.posargs)

session.run(
*args,
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
},
Expand Down Expand Up @@ -362,25 +368,67 @@ def system(session, protobuf_implementation, database_dialect):

# Run py.test against the system tests.
if system_test_exists:
session.run(
args = [
"py.test",
"--quiet",
"-o",
"asyncio_mode=auto",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_path,
*session.posargs,
]
if not session.posargs:
args.append(system_test_path)
args.extend(session.posargs)

session.run(
*args,
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
"SPANNER_DATABASE_DIALECT": database_dialect,
"SKIP_BACKUP_TESTS": "true",
},
)
elif system_test_folder_exists:
# Run sync tests
sync_args = [
"py.test",
"--quiet",
"-o",
"asyncio_mode=auto",
f"--junitxml=system_{session.python}_sync_sponge_log.xml",
]
if not session.posargs:
sync_args.append(os.path.join("tests", "system"))
sync_args.append("--ignore=tests/system/_async")
else:
sync_args.extend(session.posargs)

session.run(
*sync_args,
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
"SPANNER_DATABASE_DIALECT": database_dialect,
"SKIP_BACKUP_TESTS": "true",
},
)

# Run async tests
async_args = [
"py.test",
"--quiet",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_folder_path,
*session.posargs,
"-o",
"asyncio_mode=auto",
f"--junitxml=system_{session.python}_async_sponge_log.xml",
]
if not session.posargs:
async_args.append(os.path.join("tests", "system", "_async"))
else:
# If posargs are provided, only run if they match async tests
# or just skip if they were already run in sync.
# For simplicity, we only run async folder if no posargs.
return

session.run(
*async_args,
env={
"PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION": protobuf_implementation,
"SPANNER_DATABASE_DIALECT": database_dialect,
Expand Down Expand Up @@ -551,6 +599,10 @@ def prerelease_deps(session, protobuf_implementation, database_dialect):
"google-cloud-testutils",
# dependencies of google-cloud-testutils"
"click",
# dependency of google-auth
"cffi",
"cryptography",
"cachetools",
]

for dep in prerel_deps:
Expand Down Expand Up @@ -589,6 +641,8 @@ def prerelease_deps(session, protobuf_implementation, database_dialect):
session.run(
"py.test",
"--verbose",
"-o",
"asyncio_mode=auto",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_path,
*session.posargs,
Expand All @@ -602,6 +656,8 @@ def prerelease_deps(session, protobuf_implementation, database_dialect):
session.run(
"py.test",
"--verbose",
"-o",
"asyncio_mode=auto",
f"--junitxml=system_{session.python}_sponge_log.xml",
system_test_folder_path,
*session.posargs,
Expand All @@ -611,3 +667,10 @@ def prerelease_deps(session, protobuf_implementation, database_dialect):
"SKIP_BACKUP_TESTS": "true",
},
)


@nox.session(python=DEFAULT_PYTHON_VERSION)
def generate(session):
"""Regenerate synchronous code from asynchronous code."""
session.install("black", "autoflake")
session.run("python", ".cross_sync/generate.py", "google/cloud/spanner_v1")
5 changes: 3 additions & 2 deletions .librarian/state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-li
libraries:
- id: google-cloud-spanner
version: 3.63.0
last_generated_commit: a17b84add8318f780fcc8a027815d5fee644b9f7
last_generated_commit: 94bc991b3f1df58bc841801631715894a7ac5e28
apis:
- path: google/spanner/admin/instance/v1
service_config: spanner.yaml
Expand All @@ -21,7 +21,8 @@ libraries:
- ^google/cloud/spanner_v1/types
- ^google/cloud/spanner_admin_database_v1
- ^google/cloud/spanner_admin_instance_v1
- ^tests/unit/gapic
- ^tests/unit/gapic/spanner
- ^tests/unit/gapic/__init__.py
- ^tests/__init__.py
- ^tests/unit/__init__.py
- ^.pre-commit-config.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,11 +542,24 @@ class AutoscalingTargets(proto.Message):

Attributes:
high_priority_cpu_utilization_percent (int):
Required. The target high priority cpu utilization
Optional. The target high priority cpu utilization
percentage that the autoscaler should be trying to achieve
for the instance. This number is on a scale from 0 (no
utilization) to 100 (full utilization). The valid range is
[10, 90] inclusive.
[10, 90] inclusive. If not specified or set to 0, the
autoscaler skips scaling based on high priority CPU
utilization.
total_cpu_utilization_percent (int):
Optional. The target total CPU utilization percentage that
the autoscaler should be trying to achieve for the instance.
This number is on a scale from 0 (no utilization) to 100
(full utilization). The valid range is [10, 90] inclusive.
If not specified or set to 0, the autoscaler skips scaling
based on total CPU utilization. If both
``high_priority_cpu_utilization_percent`` and
``total_cpu_utilization_percent`` are specified, the
autoscaler provisions the larger of the two required compute
capacities to satisfy both targets.
storage_utilization_percent (int):
Required. The target storage utilization percentage that the
autoscaler should be trying to achieve for the instance.
Expand All @@ -558,6 +571,10 @@ class AutoscalingTargets(proto.Message):
proto.INT32,
number=1,
)
total_cpu_utilization_percent: int = proto.Field(
proto.INT32,
number=4,
)
storage_utilization_percent: int = proto.Field(
proto.INT32,
number=2,
Expand Down Expand Up @@ -593,6 +610,58 @@ class AutoscalingConfigOverrides(proto.Message):
Optional. If specified, overrides the autoscaling target
high_priority_cpu_utilization_percent in the top-level
autoscaling configuration for the selected replicas.
autoscaling_target_total_cpu_utilization_percent (int):
Optional. If specified, overrides the autoscaling target
``total_cpu_utilization_percent`` in the top-level
autoscaling configuration for the selected replicas.
disable_high_priority_cpu_autoscaling (bool):
Optional. If true, disables high priority CPU autoscaling
for the selected replicas and ignores
[high_priority_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.high_priority_cpu_utilization_percent]
in the top-level autoscaling configuration.

When setting this field to true, setting
[autoscaling_target_high_priority_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_high_priority_cpu_utilization_percent]
field to a non-zero value for the same replica is not
supported.

If false, the
[autoscaling_target_high_priority_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_high_priority_cpu_utilization_percent]
field in the replica will be used if set to a non-zero
value. Otherwise, the
[high_priority_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.high_priority_cpu_utilization_percent]
field in the top-level autoscaling configuration will be
used.

Setting both
[disable_high_priority_cpu_autoscaling][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_high_priority_cpu_autoscaling]
and
[disable_total_cpu_autoscaling][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_total_cpu_autoscaling]
to true for the same replica is not supported.
disable_total_cpu_autoscaling (bool):
Optional. If true, disables total CPU autoscaling for the
selected replicas and ignores
[total_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.total_cpu_utilization_percent]
in the top-level autoscaling configuration.

When setting this field to true, setting
[autoscaling_target_total_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_total_cpu_utilization_percent]
field to a non-zero value for the same replica is not
supported.

If false, the
[autoscaling_target_total_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.autoscaling_target_total_cpu_utilization_percent]
field in the replica will be used if set to a non-zero
value. Otherwise, the
[total_cpu_utilization_percent][google.spanner.admin.instance.v1.AutoscalingConfig.AutoscalingTargets.total_cpu_utilization_percent]
field in the top-level autoscaling configuration will be
used.

Setting both
[disable_high_priority_cpu_autoscaling][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_high_priority_cpu_autoscaling]
and
[disable_total_cpu_autoscaling][google.spanner.admin.instance.v1.AutoscalingConfig.AsymmetricAutoscalingOption.AutoscalingConfigOverrides.disable_total_cpu_autoscaling]
to true for the same replica is not supported.
"""

autoscaling_limits: "AutoscalingConfig.AutoscalingLimits" = proto.Field(
Expand All @@ -604,6 +673,18 @@ class AutoscalingConfigOverrides(proto.Message):
proto.INT32,
number=2,
)
autoscaling_target_total_cpu_utilization_percent: int = proto.Field(
proto.INT32,
number=4,
)
disable_high_priority_cpu_autoscaling: bool = proto.Field(
proto.BOOL,
number=5,
)
disable_total_cpu_autoscaling: bool = proto.Field(
proto.BOOL,
number=6,
)

replica_selection: common.ReplicaSelection = proto.Field(
proto.MESSAGE,
Expand Down
2 changes: 0 additions & 2 deletions google/cloud/spanner_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
BatchWriteRequest,
BatchWriteResponse,
BeginTransactionRequest,
ClientContext,
CommitRequest,
CreateSessionRequest,
DeleteSessionRequest,
Expand Down Expand Up @@ -124,7 +123,6 @@
"BatchWriteRequest",
"BatchWriteResponse",
"BeginTransactionRequest",
"ClientContext",
"CommitRequest",
"CommitResponse",
"CreateSessionRequest",
Expand Down
Loading
Loading