code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def _GetVariables(vm, use_source_vars: bool = False) -> Dict[str, List[str]]: """Returns all the environment variables on the VM.""" text, _ = vm.RemoteCommand( f'{SOURCE_VARS_COMMAND} >/dev/null; env' if use_source_vars else 'env' ) ret: Dict[str, List[str]] = {} for line in text.splitlines(): vari...
Returns all the environment variables on the VM.
_GetVariables
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/intel_oneapi_basekit.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/intel_oneapi_basekit.py
Apache-2.0
def _LogEnvDifferences( pre_variables: Dict[str, List[str]], post_variables: Dict[str, List[str]] ): """Logs the differences between the two sets of environment variables.""" differences = [] for variable in sorted(set(list(pre_variables) + list(post_variables))): pre_value = pre_variables.get(variable, [...
Logs the differences between the two sets of environment variables.
_LogEnvDifferences
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/intel_oneapi_basekit.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/intel_oneapi_basekit.py
Apache-2.0
def _VerifyInstall(vm): """Logs changes to environment variables and checks I_MPI_ROOT set.""" pre_variables = _GetVariables(vm) post_variables = _GetVariables(vm, True) _LogEnvDifferences(pre_variables, post_variables) expected_mpi_root = f'/opt/intel/oneapi/mpi/{_HPC_VERSION.value}' mpi_root = post_variab...
Logs changes to environment variables and checks I_MPI_ROOT set.
_VerifyInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/intel_oneapi_basekit.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/intel_oneapi_basekit.py
Apache-2.0
def CopyIntelFiles(source_vm, target_vm) -> None: """Copies the /opt/intel files from the source_vm to the target_vm. Instead of installing the Intel packages on all the VMs install it on one and scp the files. This can also be done via an NFS mount. Args: source_vm: The virtual machine that has the /opt...
Copies the /opt/intel files from the source_vm to the target_vm. Instead of installing the Intel packages on all the VMs install it on one and scp the files. This can also be done via an NFS mount. Args: source_vm: The virtual machine that has the /opt/intel files. target_vm: Destination VM for the /op...
CopyIntelFiles
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/intel_repo.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/intel_repo.py
Apache-2.0
def RunIOR(master_vm, num_tasks, script_path): """Runs IOR against the master VM.""" directory = master_vm.scratch_disks[0].mount_point ior_cmd = ( 'cd {directory} && ' 'mpiexec -oversubscribe -machinefile ~/MACHINEFILE -n {num_tasks} ' 'ior -f {script_path}' ).format(directory=directory, num_...
Runs IOR against the master VM.
RunIOR
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/ior.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/ior.py
Apache-2.0
def ParseIORResults(test_output): """ "Parses the test output and returns samples.""" random_offsets = ( ordering == 'random offsets' for ordering in re.findall('ordering in a file = (.*)', test_output) ) match = re.search( 'Summary of all tests:\n(.*?)Finished', test_output, re.DOTALL ) i...
"Parses the test output and returns samples.
ParseIORResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/ior.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/ior.py
Apache-2.0
def RunMdtest(master_vm, num_tasks, mdtest_args): """Run mdtest against the master vm.""" directory = posixpath.join(master_vm.scratch_disks[0].mount_point, 'mdtest') mdtest_cmd = ( 'mpiexec -oversubscribe -machinefile MACHINEFILE -n {num_tasks} ' 'mdtest -d {directory} {additional_args}' ).format( ...
Run mdtest against the master vm.
RunMdtest
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/ior.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/ior.py
Apache-2.0
def ParseMdtestResults(test_output): """Parses the test output and returns samples.""" results = [] match = re.search('Command line used: (.*)', test_output) if not match: raise errors.Benchmarks.RunError(f'Error parsing "{test_output}"') command_line = match.group(1).strip() dir_per_task = '-u' in comm...
Parses the test output and returns samples.
ParseMdtestResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/ior.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/ior.py
Apache-2.0
def _Install(vm): """Installs the iperf package on the VM.""" vm.Install('build_tools') vm.Install('wget') vm.RemoteCommand( 'wget -O %s/%s %s' % (linux_packages.INSTALL_DIR, IPERF_TAR, IPERF_URL) ) vm.RemoteCommand( 'cd %s; tar xvf %s; cd %s; ./configure; make; sudo make install' % (lin...
Installs the iperf package on the VM.
_Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/iperf.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/iperf.py
Apache-2.0
def _Install(vm): """Install Cloud Harmory iperf benchmark on VM.""" # Follows instructions from https://software.es.net/iperf/obtaining.html. vm.Install('wget') vm.Install('build_tools') vm.InstallPackages('lib32z1') vm.RemoteCommand( 'wget https://downloads.es.net/pub/iperf/iperf-3.9.tar.gz' '...
Install Cloud Harmory iperf benchmark on VM.
_Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/iperf3.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/iperf3.py
Apache-2.0
def _Install(vm) -> None: """Installs the keydb package on the VM.""" vm.Install('build_tools') vm.Install('wget') vm.RemoteCommand(f'cd {linux_packages.INSTALL_DIR}; git clone {KEYDB_GIT}') vm.RemoteCommand( f'cd {GetKeydbDir()} && ' 'git fetch --all && ' f'git checkout {_KEYDB_RELEASE.valu...
Installs the keydb package on the VM.
_Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/keydb_server.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/keydb_server.py
Apache-2.0
def _BuildStartCommand(vm) -> str: """Returns the run command used to start KeyDB. See https://docs.keydb.dev/blog/2020/04/15/blog-post/#keydb and https://github.com/Snapchat/KeyDB/blob/main/keydb.conf Args: vm: The KeyDB server VM. Returns: A command that can be used to start KeyDB in the backgrou...
Returns the run command used to start KeyDB. See https://docs.keydb.dev/blog/2020/04/15/blog-post/#keydb and https://github.com/Snapchat/KeyDB/blob/main/keydb.conf Args: vm: The KeyDB server VM. Returns: A command that can be used to start KeyDB in the background.
_BuildStartCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/keydb_server.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/keydb_server.py
Apache-2.0
def _Install(vm): """Installs the libmysqlclient package on the VM.""" # Install mysql client vm.InstallPackages('software-properties-common') vm.RemoteCommand('sudo apt-get update') vm.RemoteCommand( 'sudo DEBIAN_FRONTEND=noninteractive apt-get -y install libmysqlclient21' )
Installs the libmysqlclient package on the VM.
_Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/libmysqlclient21.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/libmysqlclient21.py
Apache-2.0
def DatetimeToUTCSeconds(date: datetime.datetime) -> float: """Converts a datetime object to seconds since the epoch in UTC. Args: date: A datetime to convert. Returns: The number of seconds since the epoch, in UTC, represented by the input datetime. """ if date.tzinfo is None: seconds = cal...
Converts a datetime object to seconds since the epoch in UTC. Args: date: A datetime to convert. Returns: The number of seconds since the epoch, in UTC, represented by the input datetime.
DatetimeToUTCSeconds
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def CollectBootSamples( vm: virtual_machine.VirtualMachine, boot_time_sec: float, runner_ip: Tuple[str, str], create_time: datetime.datetime, include_networking_samples: bool = False, ) -> List[sample.Sample]: """Collect boot samples. Args: vm: The boot vm. boot_time_sec: The time it to...
Collect boot samples. Args: vm: The boot vm. boot_time_sec: The time it took between VM creation and SSH. runner_ip: Runner ip addresses to collect VM-to-VM metrics. create_time: VM creation time. include_networking_samples: Boolean, whether to include samples such as time to first egress/i...
CollectBootSamples
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def ParseDMesgOutput(dmesg_output: str, suffix: str) -> float | None: """Takes a string from dmesg formatted output, searches for the suffix. Returns the timestamp from square brackets associated with it. Example: [ 0.016311] SRAT: PXM 0 -> APIC 0x00 -> Node 0 and 'SRAT' should return 0.016311. ...
Takes a string from dmesg formatted output, searches for the suffix. Returns the timestamp from square brackets associated with it. Example: [ 0.016311] SRAT: PXM 0 -> APIC 0x00 -> Node 0 and 'SRAT' should return 0.016311. Args: dmesg_output: the full set of dmesg output. suffix: the rege...
ParseDMesgOutput
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def ScrapeConsoleLogLines( log_lines: List[str], start_time: datetime.datetime, matchers: List[RegexMatcher], ) -> List[sample.Sample]: """Extract timings from the guest console log lines. Args: log_lines: an iterable containing the log lines start_time: the datetime_tz to measure relative to ...
Extract timings from the guest console log lines. Args: log_lines: an iterable containing the log lines start_time: the datetime_tz to measure relative to matchers: A list of RegexMatcher for scraping output Returns: List of sample.Sample objects, containing various boot metrics parsed from gu...
ScrapeConsoleLogLines
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def CollectGuestSamples( vm: virtual_machine.VirtualMachine, metric_start_time: float, boot_time_sec: float, ) -> List[sample.Sample]: """Collect guest metrics. All metrics published are normalized against VM creation timestamp, including: - kernel_start: Time guest kernel starts since vm create. -...
Collect guest metrics. All metrics published are normalized against VM creation timestamp, including: - kernel_start: Time guest kernel starts since vm create. - user_start: Time userspace starts since vm create. - guest_boot_complete: Time systemd-analyze finishes since vm create. - Various boot services re...
CollectGuestSamples
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def CollectKernelSamples( vm: virtual_machine.VirtualMachine, offset: float ) -> List[sample.Sample]: """Collect kernel metrics. Args: vm: the VM to extract the metrics from. offset: any clock offset to add. Returns: A list of sample.Sample objects. """ dmesg = vm.RemoteCommand('sudo dmesg')...
Collect kernel metrics. Args: vm: the VM to extract the metrics from. offset: any clock offset to add. Returns: A list of sample.Sample objects.
CollectKernelSamples
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def _ParseSeconds(formatted_time: str) -> float: """Returns the number of seconds, given a formatted time string. Expects a string similar to the following formats: 1min 3.02s 203ms Args: formatted_time: time formatted string. See format example above. Raises: RuntimeError: For unrecognized ...
Returns the number of seconds, given a formatted time string. Expects a string similar to the following formats: 1min 3.02s 203ms Args: formatted_time: time formatted string. See format example above. Raises: RuntimeError: For unrecognized date format. Returns: Floating point number of ...
_ParseSeconds
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def ParseUserTotalTimes(system_d_string: str) -> Tuple[float, float]: """Takes a string from systemd-analyze command and parses it. Args: system_d_string: the string output from systemd-analyze string output. i.e. "Startup finished in 2.2s (kernel) + 1min 12.5s (userspace) = 1min 14.774s" "Startup ...
Takes a string from systemd-analyze command and parses it. Args: system_d_string: the string output from systemd-analyze string output. i.e. "Startup finished in 2.2s (kernel) + 1min 12.5s (userspace) = 1min 14.774s" "Startup finished in 448ms (firmware) + 1.913s (loader) + 1.182s (kernel) + 52...
ParseUserTotalTimes
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def ParseSystemDCriticalChainOutput(systemd_output: str) -> float | None: """Returns critical chain output seconds. Given the output from systemd-analyze critical-chain <target> will return the number if seconds it took for that service to launch relative to boot time. Sample 1 (first line with @): graph...
Returns critical chain output seconds. Given the output from systemd-analyze critical-chain <target> will return the number if seconds it took for that service to launch relative to boot time. Sample 1 (first line with @): graphical.target @2.741s multi-user.target @2.739s cron.service @2.666...
ParseSystemDCriticalChainOutput
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def ParseSystemDCriticalChainServiceTime(systemd_out: str) -> float | None: """Returns critical chain total service time. Given the output from systemd-analyze critical-chain <target> will return the number if seconds it took for that service to launch just itself. Sample: systemd-sysctl.service +103ms ...
Returns critical chain total service time. Given the output from systemd-analyze critical-chain <target> will return the number if seconds it took for that service to launch just itself. Sample: systemd-sysctl.service +103ms systemd-modules-load.service @671ms +150ms systemd-journald.socket @530ms ...
ParseSystemDCriticalChainServiceTime
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def WaitForReady( vm: virtual_machine.VirtualMachine, timeout: int ) -> Tuple[float, float]: """Ensure the system is ready for boot metrics inspection. Args: vm: The vm to wait for. timeout: The max additional amount of time to block for after boot. Returns: The amount of (user_start, total) tim...
Ensure the system is ready for boot metrics inspection. Args: vm: The vm to wait for. timeout: The max additional amount of time to block for after boot. Returns: The amount of (user_start, total) time it took for waiting for boot metrics ready. Raises: RuntimeError: if system is not ready ...
WaitForReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def GetSshServiceReady(vm: virtual_machine.VirtualMachine) -> float | None: """Get ssh service ready time (the service name is OS dependent).""" return GetSystemDCriticalChainMetric( vm, 'ssh.service' ) or GetSystemDCriticalChainMetric(vm, 'sshd.service')
Get ssh service ready time (the service name is OS dependent).
GetSshServiceReady
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def CollectVmToVmSamples( vm: virtual_machine.VirtualMachine, runner_ip: Tuple[str, str], create_time: datetime.datetime, ) -> List[sample.Sample]: """Collect samples related to vm-to-vm networking.""" samples = [] vm_output = GetStartupScriptOutput(vm, BOOT_SCRIPT_OUTPUT) vm_internal_ip = vm.intern...
Collect samples related to vm-to-vm networking.
CollectVmToVmSamples
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/linux_boot.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/linux_boot.py
Apache-2.0
def _Install(vm): """Installs the Lmbench package on the VM.""" vm.Install('build_tools') vm.RemoteCommand( 'cd %s && git clone %s && cd %s && git checkout %s' % (linux_packages.INSTALL_DIR, GIT, 'lmbench', COMMIT) )
Installs the Lmbench package on the VM.
_Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/lmbench.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/lmbench.py
Apache-2.0
def _FixLuaInstall(vm) -> None: """Fixes Lua 5.2 install if required. https://bugs.launchpad.net/ubuntu/+source/lua-posix/+bug/1752082 lua-posix package broken in version that comes with Ubuntu1804. Symlinks lua's posix_c.so to posix.so. Args: vm: the remote VM to fix lua install. Raises: Inval...
Fixes Lua 5.2 install if required. https://bugs.launchpad.net/ubuntu/+source/lua-posix/+bug/1752082 lua-posix package broken in version that comes with Ubuntu1804. Symlinks lua's posix_c.so to posix.so. Args: vm: the remote VM to fix lua install. Raises: InvalidSetupError: If lua could not be set...
_FixLuaInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/lmod.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/lmod.py
Apache-2.0
def Install(vm: 'linux_virtual_machine.BaseLinuxVirtualMachine') -> None: """Installs locust on the given VM. Installs locust on the indicated VM. Does not start locust. Running this a second time will idempotently install locust, but will have no other effect. (If locust is already running at the time, it wi...
Installs locust on the given VM. Installs locust on the indicated VM. Does not start locust. Running this a second time will idempotently install locust, but will have no other effect. (If locust is already running at the time, it will not interrupt it.) Args: vm: Already running VM where locust should...
Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/locust.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/locust.py
Apache-2.0
def Prep( vm: 'linux_virtual_machine.BaseLinuxVirtualMachine', ) -> None: """Prepares a locustfile to run on the given VM. Prepares the locustfile, but does not start (or install) locust. Running this a second time will idempotently replace the locustfile, but will have no other effect. (If locust is alre...
Prepares a locustfile to run on the given VM. Prepares the locustfile, but does not start (or install) locust. Running this a second time will idempotently replace the locustfile, but will have no other effect. (If locust is already running at the time, it will not interrupt it.) Args: vm: Already runn...
Prep
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/locust.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/locust.py
Apache-2.0
def Run( vm: 'linux_virtual_machine.BaseLinuxVirtualMachine', target_host: str ) -> Iterable[sample.Sample]: """Runs locust. This won't return until the test is complete. (Test length is defined by the locustfile.) This can be called repeatedly, in which case, the test will run again. This should not be ca...
Runs locust. This won't return until the test is complete. (Test length is defined by the locustfile.) This can be called repeatedly, in which case, the test will run again. This should not be called repeatedly *in parallel*. Args: vm: Already running VM where locust/locustfile has already been installed....
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/locust.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/locust.py
Apache-2.0
def _ConvertLocustResultsToSamples( locust_results: str, metric_namespace: str = 'locust', ) -> Iterable[sample.Sample]: """Converts each csv row from locust to a PKB sample.""" lines = locust_results.splitlines() reader = csv.DictReader(lines) for row in reader: for field in reader.fieldnames: ...
Converts each csv row from locust to a PKB sample.
_ConvertLocustResultsToSamples
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/locust.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/locust.py
Apache-2.0
def AptInstall(vm): """Installs the mysql package on the VM.""" vm.InstallPackages('mariadb-server') vm.RemoteCommand(f"""sudo mysql_secure_installation <<EOF # Set root password (modify as needed) y {MYSQL_PSWD} {MYSQL_PSWD} n y y y EOF """)
Installs the mysql package on the VM.
AptInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mariadb.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mariadb.py
Apache-2.0
def _MavenVersionParts(): """Return (major, minor, patch) versions of the --maven_version flag.""" maven_major_ver, maven_minor_ver, maven_patch_ver = map( int, FLAGS.maven_version.split('.') ) return maven_major_ver, maven_minor_ver, maven_patch_ver
Return (major, minor, patch) versions of the --maven_version flag.
_MavenVersionParts
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/maven.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/maven.py
Apache-2.0
def GetRunCommand(arguments): """Return Maven run command including proxy settings.""" command = 'source {} && mvn {}'.format(MVN_ENV_PATH, arguments) if FLAGS['http_proxy'].present: parsed_url = parse.urlparse(FLAGS.http_proxy) http_proxy_params = ' -Dhttp.proxyHost={host} -Dhttp.proxyPort={port}' c...
Return Maven run command including proxy settings.
GetRunCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/maven.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/maven.py
Apache-2.0
def CheckPrerequisites(): """Verify flags are correctly specified. Raises: errors.Setup.InvalidFlagConfigurationError: On invalid flag configurations. """ agent_mode_flags = [ FLAGS['mcperf_measure_connections'].present, FLAGS['mcperf_measure_threads'].present, FLAGS['mcperf_measure_qps']...
Verify flags are correctly specified. Raises: errors.Setup.InvalidFlagConfigurationError: On invalid flag configurations.
CheckPrerequisites
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mcperf.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mcperf.py
Apache-2.0
def AptInstall(vm): """Installs the mcperf package on the VM.""" vm.Install('build_tools') vm.InstallPackages(APT_PACKAGES) vm.RemoteCommand('git clone {} {}'.format(GIT_REPO, MCPERF_DIR)) vm.RemoteCommand('cd {} && sudo scons'.format(MCPERF_DIR))
Installs the mcperf package on the VM.
AptInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mcperf.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mcperf.py
Apache-2.0
def BuildCmd(server_ip, server_port, num_instances, options): """Build base mcperf command in a list.""" server_ips = [] for idx in range(num_instances): server_ips.append(f'--server={server_ip}:{server_port + idx}') cmd = ( [ 'ulimit -n 32768; ', MCPERF_BIN, '--keysize=%...
Build base mcperf command in a list.
BuildCmd
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mcperf.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mcperf.py
Apache-2.0
def Run(vms, server_ip, server_port, num_instances): """Runs the mcperf benchmark on the vm.""" samples = [] master = vms[0] runtime_options = {} samples = [] measure_flags = [] additional_flags = ['--%s' % option for option in FLAGS.mcperf_options] if FLAGS.mcperf_measure_connections: runtime_opti...
Runs the mcperf benchmark on the vm.
Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mcperf.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mcperf.py
Apache-2.0
def ParseResults(result, metadata): """Parse mcperf result into samples. Sample Output: #type avg std min p5 p10 p50 p67 read 106.0 67.7 37.2 80.0 84.3 101.7 108.8 update 0.0 0.0 0.0 0.0 0.0 0.0 0.0 op_q 10.0 0.0 ...
Parse mcperf result into samples. Sample Output: #type avg std min p5 p10 p50 p67 read 106.0 67.7 37.2 80.0 84.3 101.7 108.8 update 0.0 0.0 0.0 0.0 0.0 0.0 0.0 op_q 10.0 0.0 1.0 9.4 9.4 9.7 9.8 T...
ParseResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mcperf.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mcperf.py
Apache-2.0
def _Install(vm): """Installs the memcached server on the VM.""" vm.InstallPackages('wget') vm.Install('build_tools') vm.Install('event') vm.RemoteCommand( f'cd {DIR}; ' 'wget https://www.memcached.org/files/' f'memcached-{FLAGS.memcached_version}.tar.gz --no-check-certificate; ' f'tar...
Installs the memcached server on the VM.
_Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memcached_server.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memcached_server.py
Apache-2.0
def _WaitForServerUp(vm, port=MEMCACHED_PORT): """Block until the memcached server is up and responsive. Will timeout after 5 minutes, and raise an exception. Before the timeout expires any exceptions are caught and the status check is retried. We check the status of the server by issuing a 'stats' command. T...
Block until the memcached server is up and responsive. Will timeout after 5 minutes, and raise an exception. Before the timeout expires any exceptions are caught and the status check is retried. We check the status of the server by issuing a 'stats' command. This should return many lines of form 'STAT <name> ...
_WaitForServerUp
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memcached_server.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memcached_server.py
Apache-2.0
def ConfigureAndStart(vm, port=MEMCACHED_PORT, smp_affinity=False): """Prepare the memcached server on a VM. Args: vm: VirtualMachine to install and start memcached on. port: int. Memcached port to use. smp_affinity: Boolean. Whether or not to set smp_affinity. """ vm.Install('memcached_server') ...
Prepare the memcached server on a VM. Args: vm: VirtualMachine to install and start memcached on. port: int. Memcached port to use. smp_affinity: Boolean. Whether or not to set smp_affinity.
ConfigureAndStart
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memcached_server.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memcached_server.py
Apache-2.0
def GetVersion(vm): """Returns the version of the memcached server installed.""" results, _ = vm.RemoteCommand( 'memcached -help |grep -m 1 "memcached"| tr -d "\n"' ) return results
Returns the version of the memcached server installed.
GetVersion
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memcached_server.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memcached_server.py
Apache-2.0
def _Install(vm): """Installs the memtier package on the VM.""" vm.RemoteCommand('git clone {} {}'.format(GIT_REPO, MEMTIER_DIR)) vm.RemoteCommand('cd {} && git checkout {}'.format(MEMTIER_DIR, GIT_TAG)) if MEMTIER_LARGE_CLUSTER.value: vm.RemoteCommand(f'rm -rf {MEMTIER_DIR}') vm.InstallPreprovisionedPa...
Installs the memtier package on the VM.
_Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def BuildMemtierCommand( server: str | None = None, port: int | None = None, protocol: str | None = None, clients: int | None = None, threads: int | None = None, ratio: str | None = None, data_size: int | None = None, data_size_list: str | None = None, pipeline: int | None = None, ...
Returns command arguments used to run memtier.
BuildMemtierCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _LoadSingleVM( load_vm: virtual_machine.VirtualMachine, request: LoadRequest ) -> None: """Loads the DB from a single VM.""" cmd = BuildMemtierCommand( server=request.server_ip, port=request.server_port, protocol=MEMTIER_PROTOCOL.value, clients=1, threads=1, ratio=_WRITE_...
Loads the DB from a single VM.
_LoadSingleVM
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def Load( vms: list[virtual_machine.VirtualMachine], server_ip: str, server_port: int, server_password: str | None = None, ) -> None: """Loads the database before performing tests.""" load_requests = [] load_key_maximum = ( MEMTIER_LOAD_KEY_MAXIMUM.value if MEMTIER_LOAD_KEY_MAXIMUM.val...
Loads the database before performing tests.
Load
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def RunOverAllClientVMs( client_vms, server_ip: str, ports: List[int], pipeline, threads, clients, password: str | None = None, ) -> 'List[MemtierResult]': """Run redis memtier on all client vms. Run redis memtier on all client vms based on given ports. Args: client_vms: A list o...
Run redis memtier on all client vms. Run redis memtier on all client vms based on given ports. Args: client_vms: A list of client vms. server_ip: Ip address of the server. ports: List of ports to run against the server. pipeline: Number of pipeline to use in memtier. threads: Number of threads...
RunOverAllClientVMs
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def RunOverAllThreadsPipelinesAndClients( client_vms, server_ip: str, server_ports: List[int], password: str | None = None, ) -> List[sample.Sample]: """Runs memtier over all pipeline and thread combinations.""" samples = [] for pipeline in FLAGS.memtier_pipeline: for threads in FLAGS.memtier_...
Runs memtier over all pipeline and thread combinations.
RunOverAllThreadsPipelinesAndClients
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _RunParallelConnections( connections: list[MemtierConnection], server_ip: str, server_port: int, threads: int, clients: int, pipelines: int, password: str | None = None, ) -> list['MemtierResult']: """Runs memtier in parallel with the given connections.""" run_args = [] base_args =...
Runs memtier in parallel with the given connections.
_RunParallelConnections
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _FindFactor(number: int, max_threads: int, max_clients: int) -> int: """Find a factor of the given number (or close to it if it's prime).""" for i in reversed(range(1, max_threads + 1)): if number % i == 0 and number // i <= max_clients: return i return _FindFactor(number - 1, max_threads, max_clien...
Find a factor of the given number (or close to it if it's prime).
_FindFactor
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _CombineResults(results: list['MemtierResult']) -> 'MemtierResult': """Combines multiple MemtierResults into a single aggregate.""" ops_per_sec = sum([result.ops_per_sec for result in results]) kb_per_sec = sum([result.kb_per_sec for result in results]) latency_ms = sum([result.latency_ms for result in resu...
Combines multiple MemtierResults into a single aggregate.
_CombineResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _BinarySearchForLatencyCappedThroughput( connections: list[MemtierConnection], load_modifiers: list[_LoadModifier], server_ip: str, server_port: int, password: str | None = None, ) -> list['MemtierResult']: """Runs memtier to find the maximum throughput under a latency cap.""" results = [] ...
Runs memtier to find the maximum throughput under a latency cap.
_BinarySearchForLatencyCappedThroughput
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _CalculateMode(values: list[float]) -> float: """Calculates the mode of a distribution using kernel density estimation.""" ax = sns.histplot(values, kde=True) kdeline = ax.lines[0] xs = kdeline.get_xdata() ys = kdeline.get_ydata() mode_idx = np.argmax(ys) mode = xs[mode_idx] return mode
Calculates the mode of a distribution using kernel density estimation.
_CalculateMode
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def MeasureLatencyCappedThroughputDistribution( connections: list[MemtierConnection], server_ip: str, server_port: int, client_vms: list[virtual_machine.VirtualMachine], server_shard_count: int, password: str | None = None, ) -> list[sample.Sample]: """Measures distribution of throughput acros...
Measures distribution of throughput across several iterations. In particular, this function will first find the optimal number of threads and clients per thread, and then run the test with those parameters for the specified number of iterations. The reported samples will include mean and stdev of QPS and laten...
MeasureLatencyCappedThroughputDistribution
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def RunGetLatencyAtCpu(cloud_instance, client_vms): """Run a modified binary search to find latency at a given CPU. Args: cloud_instance: A managed cloud instance. Only works on managed cloud instances but could extend to vms. client_vms: Need at least two client vms, one to hold the CPU utilization ...
Run a modified binary search to find latency at a given CPU. Args: cloud_instance: A managed cloud instance. Only works on managed cloud instances but could extend to vms. client_vms: Need at least two client vms, one to hold the CPU utilization load and the other to get the single threaded laten...
RunGetLatencyAtCpu
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _GetSingleThreadedLatency( client_vm, server_ip: str, server_port: int, password: str ) -> 'MemtierResult': """Wait for background run to stabilize then send single threaded request.""" time.sleep(300) return _Run( vm=client_vm, server_ip=server_ip, server_port=server_port, threads...
Wait for background run to stabilize then send single threaded request.
_GetSingleThreadedLatency
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _IssueRetryableCommand(vm, cmd: str) -> None: """Issue redis command, retry connection failure.""" _, stderr = vm.RobustRemoteCommand(cmd) if 'Connection error' in stderr: raise RetryableRunError('Redis client connection failed, retrying') if 'handle error response' in stderr: raise RunFailureError(...
Issue redis command, retry connection failure.
_IssueRetryableCommand
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _Run( vm, server_ip: str, server_port: int, threads: int, pipeline: int, clients: int, password: str | None = None, unique_id: str | None = None, shard_addresses: str | None = None, ) -> 'MemtierResult': """Runs the memtier benchmark on the vm.""" logging.info( ( ...
Runs the memtier benchmark on the vm.
_Run
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def Parse( cls, memtier_results: str, time_series_json: Dict[Any, Any] | None ) -> 'MemtierResult': """Parse memtier_benchmark result textfile and return results. Args: memtier_results: Text output of running Memtier benchmark. time_series_json: Time series data of the results in json forma...
Parse memtier_benchmark result textfile and return results. Args: memtier_results: Text output of running Memtier benchmark. time_series_json: Time series data of the results in json format. Returns: MemtierResult object. Example memtier_benchmark output. 4 Threads 50 ...
Parse
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def GetSamples( self, metadata: Dict[str, Any] | None = None ) -> List[sample.Sample]: """Return this result as a list of samples.""" if metadata: self.metadata.update(copy.deepcopy(metadata)) self.metadata['avg_latency'] = self.latency_ms for key, value in self.latency_dic.items(): ...
Return this result as a list of samples.
GetSamples
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def AlignTimeDiffMemtierResults( memtier_results: List[MemtierResult], ) -> None: """Realign the timestamps if time diff between clients are greater than 1s.""" start_times = [result.timestamps[0] for result in memtier_results] min_start_time = min(start_times) max_start_time = max(start_times) diff_time ...
Realign the timestamps if time diff between clients are greater than 1s.
AlignTimeDiffMemtierResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def AggregateMemtierResults( memtier_results: List[MemtierResult], metadata: Dict[str, Any] ) -> List[sample.Sample]: """Aggregate memtier time series from all clients. Aggregation assume followings: 1. All memtier clients runs with the same duration 2. All memtier clients starts at the same time To...
Aggregate memtier time series from all clients. Aggregation assume followings: 1. All memtier clients runs with the same duration 2. All memtier clients starts at the same time To aggregate the ops_series, sum all ops from each clients. To aggregate the max latency series, get the max latency from all...
AggregateMemtierResults
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _ParseHistogram( memtier_results: str, ) -> Tuple[MemtierHistogram, MemtierHistogram]: """Parses the 'Request Latency Distribution' section of memtier output.""" set_histogram = [] get_histogram = [] total_requests = MEMTIER_REQUESTS.value sets = int(MEMTIER_RATIO.value.split(':')[0]) gets = int(MEM...
Parses the 'Request Latency Distribution' section of memtier output.
_ParseHistogram
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _ParseTotalThroughputAndLatency( memtier_results: str, ) -> 'MemtierAggregateResult': """Parses the 'TOTALS' output line and return throughput and latency.""" columns = None for raw_line in memtier_results.splitlines(): line = raw_line.strip() if re.match(r'^Type', line): columns = re.split(...
Parses the 'TOTALS' output line and return throughput and latency.
_ParseTotalThroughputAndLatency
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _ParseLine( pattern: str, line: str, approx_total: int, last_total: int, histogram: MemtierHistogram, ) -> float: """Helper function to parse an output line.""" if not re.match(pattern, line): return last_total # Skip cases where we have an incomplete line (not enough values to unpack...
Helper function to parse an output line.
_ParseLine
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _ParseTimeSeries( time_series_json: Dict[Any, Any] | None, ) -> Tuple[List[int], List[int], Dict[str, List[int]]]: """Parse time series ops throughput from json output.""" timestamps = [] ops_series = [] latency_series = collections.defaultdict(list) if time_series_json: time_series = time_series_...
Parse time series ops throughput from json output.
_ParseTimeSeries
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def _GetRuntimeInfo(time_series_json: Dict[Any, Any] | None): """Fetch runtime info (i.e start, end times and duration) from json output.""" runtime_info = {} if time_series_json: runtime_info = time_series_json['ALL STATS']['Runtime'] runtime_info = { key.replace(' ', '_'): val for key, val in ru...
Fetch runtime info (i.e start, end times and duration) from json output.
_GetRuntimeInfo
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/memtier.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/memtier.py
Apache-2.0
def UseMklRepo(): """Returns whether to use the Intel MKL repo or preprovisioned data. Steps to determine if should use the Intel repos: 1. If the --mkl_install_from_repo is set then use that value 2. Use the Intel repo if the --mkl_version is set to a version other than the one in preprovisioned data. ...
Returns whether to use the Intel MKL repo or preprovisioned data. Steps to determine if should use the Intel repos: 1. If the --mkl_install_from_repo is set then use that value 2. Use the Intel repo if the --mkl_version is set to a version other than the one in preprovisioned data.
UseMklRepo
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mkl.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mkl.py
Apache-2.0
def Install(vm): """Installs the MKL package on the VM.""" vm.InstallPackages('cpio') if UseMklRepo(): vm.Install('intel_repo') if intel_repo.UseOneApi(): vm.InstallPackages(f'intel-oneapi-mkl-{MKL_VERSION.value}') # do not need to symlink the vars file return vm.InstallPackages(f'in...
Installs the MKL package on the VM.
Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mkl.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mkl.py
Apache-2.0
def _LogEnvVariables(vm): """Logs the MKL associated environment variables.""" env_vars = [] for env_var in ( 'CPATH', 'LD_LIBRARY_PATH', 'MKLROOT', 'NLSPATH', 'PKG_CONFIG_PATH', ): txt, _ = vm.RemoteCommand(f'{SourceVarsCommand()}; echo ${env_var}') env_vars.append(f'{env_...
Logs the MKL associated environment variables.
_LogEnvVariables
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mkl.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mkl.py
Apache-2.0
def _InstallFromPreprovisionedData(vm): """Installs the MKL package from preprovisioned data on the VM.""" vm.RemoteCommand('cd {} && mkdir MKL'.format(linux_packages.INSTALL_DIR)) vm.InstallPreprovisionedBenchmarkData(BENCHMARK_NAME, [MKL_TGZ], MKL_DIR) vm.RemoteCommand('cd {} && tar zxvf {}'.format(MKL_DIR, M...
Installs the MKL package from preprovisioned data on the VM.
_InstallFromPreprovisionedData
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mkl.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mkl.py
Apache-2.0
def _CompileInterfaces(vm): """Compiles the MKL FFT interfaces. Args: vm: Virtual Machine to compile on. """ vm.Install('build_tools') mpi_lib = 'openmpi' make_options = ( f'PRECISION=MKL_DOUBLE interface=ilp64 mpi={mpi_lib} compiler=gnu' ) for interface in ('fftw2xc', 'fftw2xf', 'fftw3xc', '...
Compiles the MKL FFT interfaces. Args: vm: Virtual Machine to compile on.
_CompileInterfaces
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mkl.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mkl.py
Apache-2.0
def _Install(vm): """Installs the Mellanox OpenFabrics driver on the VM.""" if vm.OS_TYPE not in MOFED_OS_MAPPING: raise ValueError( 'OS type {} not in {}'.format(vm.OS_TYPE, sorted(MOFED_OS_MAPPING)) ) driver = MLNX_OFED_DOWNLOAD_URL.format( version=FLAGS.mofed_version, os=MOFED_OS_MAPPING[...
Installs the Mellanox OpenFabrics driver on the VM.
_Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mofed.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mofed.py
Apache-2.0
def YumSetup(vm): """Performs common pre-install setup for mongodb .rpm packages.""" vm.RemoteCommand('sudo setenforce 0') releasever, _ = vm.RemoteCommand( "distro=$(sed -n 's/^distroverpkg=//p' /etc/yum.conf);" 'echo $(rpm -q --qf "%{version}" -f /etc/$distro)' ) mongodb_repo = ( f'[mongod...
Performs common pre-install setup for mongodb .rpm packages.
YumSetup
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mongodb_server.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mongodb_server.py
Apache-2.0
def AptSetup(vm): """Performs common pre-install setup for mongodb .deb packages.""" vm.InstallPackages('gnupg curl') vm.RemoteCommand( f'sudo rm -rf /usr/share/keyrings/mongodb-server-{VERSION.value}.gpg' ) vm.RemoteCommand( f'curl -fsSL https://pgp.mongodb.com/server-{VERSION.value}.asc | sudo' ...
Performs common pre-install setup for mongodb .deb packages.
AptSetup
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mongodb_server.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mongodb_server.py
Apache-2.0
def RunTwoCommands(vm, command1: str, command2: str) -> tuple[str, str]: """Runs a mongosh command on the VM.""" return vm.RemoteCommand( f'mongosh --eval "{command1}" --eval "{command2}"' )
Runs a mongosh command on the VM.
RunTwoCommands
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mongosh.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mongosh.py
Apache-2.0
def VerifyInstall(vms) -> None: """Runs a simple test to confirm MPI is installed correctly. Args: vms: List of virtual machines to include in the test. """ request = MpiRequest( vms=vms, total_processes=vms[0].NumCpusForBenchmark(), suite='IMB-MPI1', tests=['PingPong'], ppn=v...
Runs a simple test to confirm MPI is installed correctly. Args: vms: List of virtual machines to include in the test.
VerifyInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def GetMpiVersion(vm) -> str | None: """Returns the MPI version to use for the given OS type.""" if FLAGS.mpi_vendor == 'intel': return intelmpi.MPI_VERSION.value elif FLAGS.mpi_vendor == 'openmpi': return openmpi.GetMpiVersion(vm)
Returns the MPI version to use for the given OS type.
GetMpiVersion
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def RunMpiStats(vm, request: MpiRequest) -> MpiResponse: """Runs the MPI tests. The first return value is all the command line arguments used to run the text except for the names of the hosts. This is so that the results in the database can all have a common value to filter on. Args: vm: virtual machin...
Runs the MPI tests. The first return value is all the command line arguments used to run the text except for the names of the hosts. This is so that the results in the database can all have a common value to filter on. Args: vm: virtual machine to run on request: an MpiRequest that has the parameters...
RunMpiStats
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def __iter__(self) -> Iterator[MpiResult]: """Yields the next MpiResult from the input lines.""" while True: value = self._NextValue() if value: yield value else: break
Yields the next MpiResult from the input lines.
__iter__
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _NextValue(self) -> MpiResult | None: """Returns the next MpiResult or None if no more entries.""" name = self._BenchmarkName() if not name: return None logging.info('Parsing benchmark %s', name) groups, processes = self._NumberGroups() group_layout = self._GroupLayout() mode, head...
Returns the next MpiResult or None if no more entries.
_NextValue
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _NumberGroups(self) -> Tuple[int | None, int]: """Return a tuple of the number of MPI groups and processes for the test.""" for line in self._lines: m = self._GROUP1.match(line) if m: # this MPI test has both the "groups" and "processes" attributes return int(m.group('groups')), ...
Return a tuple of the number of MPI groups and processes for the test.
_NumberGroups
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _GroupLayout(self) -> Dict[int, List[int]] | None: """Returns the MPI group CPU layout. Parses this input: # Group 0: 0 1 # # Group 1: 2 3 # #--------------------------------------------------- Into {0: [0,1], 1: [2,3]} """ layout = {} last_group_number...
Returns the MPI group CPU layout. Parses this input: # Group 0: 0 1 # # Group 1: 2 3 # #--------------------------------------------------- Into {0: [0,1], 1: [2,3]}
_GroupLayout
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _Headers(self) -> Tuple[str | None, Sequence[str]]: """Returns a tuple of (benchmark mode, List of headers for data).""" mode = None for line in self._lines: m = self._MODE.match(line) if m: mode = m.group(1) continue m = self._HEADERS.match(line) if m: re...
Returns a tuple of (benchmark mode, List of headers for data).
_Headers
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _Data(self, headers: Sequence[str]) -> Iterator[MpiData]: """Yields MpiData for each row of a benchmark's results. Example input: 0 1000000 1.17 1.17 1.17 0.00 [ 0.83, 0.97, 0.98, 1.00, 1.02, 1.72, 1.75, 2.28, 3.12, 6.73, 65.19 ] 1024 10000...
Yields MpiData for each row of a benchmark's results. Example input: 0 1000000 1.17 1.17 1.17 0.00 [ 0.83, 0.97, 0.98, 1.00, 1.02, 1.72, 1.75, 2.28, 3.12, 6.73, 65.19 ] 1024 1000000 1.80 1.80 1.80 569.96 [ 1.16, 1....
_Data
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _DataIntoMap( self, headers: Sequence[str], data: Sequence[str] ) -> Dict[str, Union[int, float]]: """Converts the a row of data from the MPI results into a dict. Args: headers: The column headers. data: A row of data from the MPI output. Returns: Dict of the header name to ...
Converts the a row of data from the MPI results into a dict. Args: headers: The column headers. data: A row of data from the MPI output. Returns: Dict of the header name to the value.
_DataIntoMap
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def BuildMpiBenchmarkArgs( request: MpiRequest, latency_file: str | None, ppn_set: bool ) -> List[str]: """Creates the common arguments to pass to mpirun. See https://software.intel.com/en-us/imb-user-guide-command-line-control Args: request: An MpiRequest object for the run's configuration. latency...
Creates the common arguments to pass to mpirun. See https://software.intel.com/en-us/imb-user-guide-command-line-control Args: request: An MpiRequest object for the run's configuration. latency_file: If present the output file to record the individual packet latencies. ppn_set: Whether this benc...
BuildMpiBenchmarkArgs
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _CreateMpiDataForHistogram( grouped_lines: List[List[str]], results: List[MpiResult] ) -> None: """Adds histogram data from the histogram file to existing data. The MPI parsed results are passed in as some benchmarks runs can do many sub-runs of different MPI group values. This code pairs up those runs ...
Adds histogram data from the histogram file to existing data. The MPI parsed results are passed in as some benchmarks runs can do many sub-runs of different MPI group values. This code pairs up those runs done in order with the latency file that has all the runs concatenated together. Args: grouped_lines...
_CreateMpiDataForHistogram
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _MpiHistogramAcceptable( mpi_data: List[MpiData], histograms: List[MpiData] ) -> bool: """Returns whether the parsed MpiResults MpiData matches with the histograms. Criteria: Number of MpiResults.data[] entries are the same. The number of bytes for each MpiData matches. The number of repetition...
Returns whether the parsed MpiResults MpiData matches with the histograms. Criteria: Number of MpiResults.data[] entries are the same. The number of bytes for each MpiData matches. The number of repetitions for each MpiData matches. Args: mpi_data: List of MpiData parsed for this run. histogra...
_MpiHistogramAcceptable
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _CombineHistogramEntries(lines: Iterable[str]) -> Iterator[MpiData]: """Converts the -dumpfile latency file into MpiData. The latency file lines are in this form: integer_bytes latency_usec For example this is for a run with one latency value of 11.0usec for the bytes=1024 run and three values for byte...
Converts the -dumpfile latency file into MpiData. The latency file lines are in this form: integer_bytes latency_usec For example this is for a run with one latency value of 11.0usec for the bytes=1024 run and three values for bytes=2048 of 12.1,13.5, and 13.5 usec: 1024 11 2048 12.1 2048 13.5 ...
_CombineHistogramEntries
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def _GroupLatencyLines( vm, latency_file: str, packets_per_run: int ) -> List[List[str]]: r"""Parses the histogram latency file copied from the remote VM. The latency file contains multiple sub-runs concatenated together. Each of those runs is of length packets_per_run. The returned file is chunked into ...
Parses the histogram latency file copied from the remote VM. The latency file contains multiple sub-runs concatenated together. Each of those runs is of length packets_per_run. The returned file is chunked into groups of that size. Example: ("1\n2\n3\n4\n5\n6", 2) => [["1","2"],["3","4"],["5","6"]] Args:...
_GroupLatencyLines
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def ParseMpiEnv(lines: Sequence[str]) -> Dict[str, str]: """Reads the log file for environment parameters. Args: lines: Text lines from mpirun output. Returns: Dict of the MPI envirnoment variables """ mpi_env = {} for line in lines: row = _MPI_ENV_RE.search(line) if not row: continu...
Reads the log file for environment parameters. Args: lines: Text lines from mpirun output. Returns: Dict of the MPI envirnoment variables
ParseMpiEnv
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mpi.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mpi.py
Apache-2.0
def YumInstall(vm): """Installs the ms sql package on the RedHat VM.""" vm.RemoteCommand( 'sudo curl -o /etc/yum.repos.d/mssql-server.repo ' 'https://packages.microsoft.com/config/rhel/8/' 'mssql-server-2019.repo' ) vm.RemoteCommand( 'sudo curl -o /etc/yum.repos.d/msprod.repo ' 'ht...
Installs the ms sql package on the RedHat VM.
YumInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mssql2019.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mssql2019.py
Apache-2.0
def AptInstall(vm): """Installs the mssql-server package on the Debian VM.""" if vm.OS_TYPE != os_types.UBUNTU2004: raise NotImplementedError( 'Invalid OS version: {}. SQL Server 2019 only supports Ubuntu 18.04' ' and20.04'.format(vm.OS_TYPE) ) vm.RemoteCommand( 'wget -qO- https://p...
Installs the mssql-server package on the Debian VM.
AptInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mssql2019.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mssql2019.py
Apache-2.0
def ZypperInstall(vm): """Installs the ms sql package on the SLES VM.""" vm.RemoteCommand('sudo zypper install -y glibc') vm.RemoteCommand( 'sudo zypper addrepo -fc' ' https://packages.microsoft.com/config/sles/15/mssql-server-2019.repo' ) vm.RemoteCommand( 'sudo zypper ar' ' https://p...
Installs the ms sql package on the SLES VM.
ZypperInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mssql2019.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mssql2019.py
Apache-2.0
def AptInstall(vm): """Installs the mssql-tools package on the VM for Debian systems. Args: vm: Virtual Machine to install on. """ vm.RemoteCommand('curl {key} | sudo apt-key add -'.format(key=_DEB_REPO_KEY)) deb_repro_file = _DEB_REPO_FILE.format(os=OS_TYPE_MAPPING[vm.OS_TYPE]) vm.RemoteCommand( ...
Installs the mssql-tools package on the VM for Debian systems. Args: vm: Virtual Machine to install on.
AptInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mssql_tools.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mssql_tools.py
Apache-2.0
def _Install(vm): """Installs the multichase package on the VM.""" vm.Install('build_tools') vm.RemoteCommand('rm -rf {path} && mkdir -p {path}'.format(path=INSTALL_PATH)) vm.RemoteCommand( 'git clone --recursive {git_path} {dir}'.format( dir=INSTALL_PATH, git_path=GIT_PATH ) ) vm.Remo...
Installs the multichase package on the VM.
_Install
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/multichase.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/multichase.py
Apache-2.0
def AptInstall(vm): """Installs the mutilate package on the VM.""" vm.Install('build_tools') vm.InstallPackages(APT_PACKAGES) vm.RemoteCommand('git clone {} {}'.format(GIT_REPO, MUTILATE_DIR)) vm.RemoteCommand( f'sed -i "s|int total|long total|g" {MUTILATE_DIR}/mutilate.cc' ) vm.RemoteCommand('cd {}...
Installs the mutilate package on the VM.
AptInstall
python
GoogleCloudPlatform/PerfKitBenchmarker
perfkitbenchmarker/linux_packages/mutilate.py
https://github.com/GoogleCloudPlatform/PerfKitBenchmarker/blob/master/perfkitbenchmarker/linux_packages/mutilate.py
Apache-2.0