def Prepare(benchmark_spec): """Prepare the cloud redis instance to YCSB tasks. Args: benchmark_spec: The benchmark specification. Contains all data that is required to run the benchmark. """ benchmark_spec.always_call_cleanup = True ycsb_vms = benchmark_spec.vm_groups['clients'] vm_util.RunThreaded(_Install, ycsb_vms) cloud_redis_class = (managed_memory_store.GetManagedMemoryStoreClass( FLAGS.cloud, managed_memory_store.REDIS)) benchmark_spec.cloud_redis_instance = (cloud_redis_class(benchmark_spec)) benchmark_spec.cloud_redis_instance.Create() instance_details = benchmark_spec.cloud_redis_instance.GetInstanceDetails() redis_args = { 'shardkeyspace': True, 'redis.host': instance_details['host'], 'redis.port': instance_details['port'] } if 'password' in instance_details: redis_args['redis.password'] = instance_details['password'] benchmark_spec.executor = ycsb.YCSBExecutor('redis', **redis_args)
def CheckPrerequisites(benchmark_config): """Verifies that the required resources are present. Args: benchmark_config: benchmark_config Raises: perfkitbenchmarker.data.ResourceNotFound: On missing resource. """ # TODO(ruwa): This CheckPrerequisites call checks the prerequisites # on the resource. Ideally, the benchmark is not responsible for this task. # Instead, BaseResource should check prerequisites as part of creation and # child resources can override CheckPrerequisites and benefit from it. cloud_redis_class = (managed_memory_store.GetManagedMemoryStoreClass( FLAGS.cloud, managed_memory_store.REDIS)) cloud_redis_class.CheckPrerequisites(benchmark_config)
def _GetManagedMemoryStoreClass(): """Gets the cloud-specific redis memory store class.""" return (managed_memory_store.GetManagedMemoryStoreClass( FLAGS.cloud, managed_memory_store.REDIS))