Skip to content

child CL #5352

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
49 changes: 49 additions & 0 deletions perfkitbenchmarker/providers/aws/aws_elasticache_valkey.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Copyright 2024 PerfKitBenchmarker Authors. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Module containing class for AWS' Elasticache Valkey clusters."""
from absl import flags
from perfkitbenchmarker import errors
from perfkitbenchmarker import managed_memory_store
from perfkitbenchmarker.providers.aws import aws_elasticache_cluster

FLAGS = flags.FLAGS

_DEFAULT_VERSION = '7.2'
_VALKEY_VERSION_MAPPING = {
'VALKEY_7_2': '7.2',
}


class ElastiCacheValkey(aws_elasticache_cluster.ElastiCacheCluster):
"""Object representing a AWS Elasticache valkey instance."""

MEMORY_STORE = managed_memory_store.VALKEY

def __init__(self, spec):
super().__init__(spec)
self.version = _VALKEY_VERSION_MAPPING[spec.version] or _DEFAULT_VERSION

def CheckPrerequisites(self):
if (
managed_memory_store.FAILOVER_STYLE.value
!= managed_memory_store.Failover.FAILOVER_NONE
or self.failover_zone
):
raise errors.Config.InvalidValue(
'The Valkey implementation currently does not support failover.'
)

def _GetEngine(self) -> str:
"""Returns the engine name."""
return 'valkey'
3 changes: 2 additions & 1 deletion perfkitbenchmarker/providers/gcp/gcp_cloud_valkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

COMMAND_TIMEOUT = 3600

_DEFAULT_VERSION = 'VALKEY_7_2'
_DEFAULT_VERSION = 'VALKEY_8_0'
_DEFAULT_ZONE = 'us-central1-c'


Expand Down Expand Up @@ -72,6 +72,7 @@ def GetResourceMetadata(self) -> dict[str, Any]:
Returns:
dict mapping string property key to value.
"""
# Metadata uses redis terminology for backwards compatibility.
self.metadata.update({
'cloud_redis_region': self.location,
'cloud_redis_version': self.GetReadableVersion(),
Expand Down