in perfkitbenchmarker/linux_packages/ycsb.py [0:0]
def CheckPrerequisites():
"""Verifies that the workload files are present and parameters are valid.
Raises:
IOError: On missing workload file.
errors.Config.InvalidValue on unsupported YCSB version or configs.
"""
for workload_file in GetWorkloadFileList():
if not os.path.exists(workload_file):
raise OSError('Missing workload file: {}'.format(workload_file))
if _YCSB_COMMIT.value and _YCSB_TAR_URL.value:
raise errors.Config.InvalidValue(
'Only one of --ycsb_commit or --ycsb_tar_url should be set.'
)
if _ycsb_tar_url:
ycsb_version = _GetVersionFromUrl(_ycsb_tar_url)
elif _YCSB_TAR_URL.value:
ycsb_version = _GetVersionFromUrl(_YCSB_TAR_URL.value)
else:
ycsb_version = _GetVersion(_YCSB_VERSION.value)
if ycsb_version < 17:
raise errors.Config.InvalidValue('must use YCSB version 0.17.0 or higher.')
run_params = _GetRunParameters()
# Following flags are mutully exclusive.
run_target = 'target' in run_params
per_thread_target = any(
[':' in thread_qps for thread_qps in FLAGS.ycsb_threads_per_client]
)
flag_target = _TARGET_QPS.value is not None
lowest_latency_target = _LOWEST_LATENCY_TARGET_QPS.value is not None
dynamic_load = FLAGS.ycsb_dynamic_load
if [
flag_target,
run_target,
per_thread_target,
dynamic_load,
lowest_latency_target,
].count(True) > 1:
raise errors.Config.InvalidValue(
'Setting YCSB target in ycsb_target_qps, ycsb_threads_per_client,'
' ycsb_lowest_latency_target_qps, ycsb_run_parameters or applying'
' ycsb_dynamic_load_* flags are mutally exclusive.'
)
if FLAGS.ycsb_dynamic_load_throughput_lower_bound and not dynamic_load:
raise errors.Config.InvalidValue(
'To apply dynamic load, set --ycsb_dynamic_load.'
)
if _BURST_LOAD_MULTIPLIER.value and not run_target:
raise errors.Config.InvalidValue(
'Running in burst mode requires setting a target QPS using '
'--ycsb_run_parameters=target=qps. Got None.'
)
if _INCREMENTAL_TARGET_QPS.value and run_target:
raise errors.Config.InvalidValue(
'Running in incremental mode requires setting a target QPS using '
'--ycsb_incremental_load=target and not --ycsb_run_parameters.'
)
# Both HISTOGRAM and TIMESERIES do not output latencies on a per-interval
# basis, so we use the more-detailed HDRHISTOGRAM.
if _STATUS.value and FLAGS.ycsb_measurement_type != ycsb_stats.HDRHISTOGRAM:
raise errors.Config.InvalidValue(
'Showing status during run requires running with '
'--ycsb_measurement_type=HDRHISTOGRAM. Other measurement types are '
'unsupported unless additional parsing is added.'
)
if [
dynamic_load,
_BURST_LOAD_MULTIPLIER.value is not None,
_INCREMENTAL_TARGET_QPS.value is not None,
CPU_OPTIMIZATION.value,
_LATENCY_THRESHOLD.value,
_LOWEST_LATENCY.value,
].count(True) > 1:
raise errors.Setup.InvalidFlagConfigurationError(
'--ycsb_dynamic_load, --ycsb_burst_load, --ycsb_incremental_load,'
' --ycsb_lowest_latency_load, --ycsb_latency_threshold, and'
' --ycsb_cpu_optimization are mutually exclusive.'
)