in perfkitbenchmarker/linux_benchmarks/large_scale_boot_benchmark.py [0:0]
def _ParseResult(launcher_vms):
"""Parse the results on the launcher VMs and send it back.
Boot time is the boot duration of the slowest machine.
Args:
launcher_vms: Launcher server VMs.
Returns:
A list of benchmark samples.
"""
vm_count = 0
slowest_time = -1
get_starttime_cmd = 'cat {startime}'.format(startime=_START_TIME_FILE_PATH)
get_results_cmd = 'cat {results}'.format(results=_RESULTS_FILE_PATH)
samples = []
common_metadata = {
'cloud': FLAGS.cloud,
'num_launchers': FLAGS.num_vms,
'expected_boots_per_launcher': FLAGS.boots_per_launcher,
'boot_os_type': FLAGS.boot_os_type,
'boot_machine_type': FLAGS.boot_machine_type,
'launcher_machine_type': FLAGS.launcher_machine_type,
'vms_contact_launcher': FLAGS.vms_contact_launcher,
'use_public_ip': FLAGS.use_public_ip,
}
for vm in launcher_vms:
start_time_str, _ = vm.RemoteCommand(get_starttime_cmd)
start_time = int(start_time_str)
results, _ = vm.RemoteCommand(get_results_cmd)
cur_launcher_success = 0
cur_launcher_closed_incoming = 0
durations = []
time_to_running = -1
for line in results.splitlines():
state, _, duration = line.split(':')
end_time = int(duration)
if state == STATUS_PASSING:
duration_in_ns = end_time - start_time
durations.append(duration_in_ns)
slowest_time = max(slowest_time, duration_in_ns)
cur_launcher_success += 1
elif state == STATUS_RUNNING:
t = end_time - start_time
time_to_running = max(time_to_running, t)
elif state == 'Fail':
# outgoing port was open but incoming port was closed.
cur_launcher_closed_incoming += 1
vm_count += cur_launcher_success
current_metadata = {
'zone': vm.zone,
'launcher_successes': cur_launcher_success,
'launcher_boot_durations_ns': durations,
'launcher_closed_incoming': cur_launcher_closed_incoming,
}
current_metadata.update(common_metadata)
samples.append(
sample.Sample('Launcher Boot Details', -1, '', current_metadata)
)
mean_time = statistics.mean(durations)
median_time = statistics.median(durations)
samples.append(
sample.Sample(
'Cluster Max Boot Time', slowest_time, 'nanoseconds', common_metadata
)
)
samples.append(
sample.Sample(
'Cluster Max Boot Sec',
slowest_time / _NANO,
'seconds',
common_metadata,
)
)
samples.append(
sample.Sample(
'Cluster Mean Boot Sec', mean_time / _NANO, 'seconds', common_metadata
)
)
samples.append(
sample.Sample(
'Cluster Median Boot Sec',
median_time / _NANO,
'seconds',
common_metadata,
)
)
samples.append(
sample.Sample(
'Cluster Expected Boots', _GetExpectedBoots(), '', common_metadata
)
)
samples.append(
sample.Sample('Cluster Success Boots', vm_count, '', common_metadata)
)
samples.append(
sample.Sample(
'Cluster Max Time to Running',
time_to_running,
'nanoseconds',
common_metadata,
)
)
return samples