

def PreloadCassandraServer(benchmark_spec, metadata):
    'Preload cassandra cluster if necessary.\n\n  Args:\n    benchmark_spec: The benchmark specification. Contains all data that is\n        required to run the benchmark.\n    metadata: dict. Contains metadata for this benchmark.\n  '
    if ((FLAGS.cassandra_stress_command == 'read') or (FLAGS.cassandra_stress_command == 'mixed')):
        cassandra_stress_command = 'write'
    elif (FLAGS.cassandra_stress_command == 'counter_read'):
        cassandra_stress_command = 'counter_write'
    else:
        cassandra_stress_command = FLAGS.cassandra_stress_command
    logging.info('Preloading cassandra database with %s %s operations.', metadata['num_preload_keys'], cassandra_stress_command)
    RunCassandraStressTest(benchmark_spec.vm_groups[CASSANDRA_GROUP], benchmark_spec.vm_groups[CLIENT_GROUP], metadata['num_preload_keys'], cassandra_stress_command)
    logging.info('Waiting %s for keyspace to propagate.', PROPAGATION_WAIT_TIME)
    time.sleep(PROPAGATION_WAIT_TIME)

dataset/ETHPy150Open GoogleCloudPlatform/PerfKitBenchmarker/perfkitbenchmarker/linux_benchmarks/cassandra_stress_benchmark.py PreloadCassandraServer/original