Skip to content

Commit

Permalink
Move oldisim install to linux_pacakges.oldisim_dependences
Browse files Browse the repository at this point in the history
  • Loading branch information
peterfeiner committed Oct 15, 2016
1 parent e3b9737 commit 6b1c9e5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
17 changes: 5 additions & 12 deletions perfkitbenchmarker/linux_benchmarks/oldisim_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"""

import logging
import posixpath
import re
import time

Expand All @@ -47,6 +46,7 @@
from perfkitbenchmarker import sample
from perfkitbenchmarker import vm_util

from perfkitbenchmarker.linux_packages import oldisim_dependencies

FLAGS = flags.FLAGS

Expand All @@ -61,12 +61,8 @@
'Allowable metrics for end-to-end latency')
flags.DEFINE_float('oldisim_latency_target', '30', 'latency target in ms')

OLDISIM_GIT = 'https://github.com/GoogleCloudPlatform/oldisim.git'
NUM_DRIVERS = 1
NUM_ROOTS = 1
OLDISIM_DIR = 'oldisim'
OLDISIM_VERSION = 'v0.1'
BINARY_BASE = 'release/workloads/search'
BENCHMARK_NAME = 'oldisim'
BENCHMARK_CONFIG = """
oldisim:
Expand Down Expand Up @@ -95,9 +91,6 @@ def InstallAndBuild(vm):
"""
logging.info('prepare oldisim on %s', vm)
vm.Install('oldisim_dependencies')
vm.RemoteCommand('git clone --recursive %s' % OLDISIM_GIT)
vm.RemoteCommand('cd %s && git checkout %s && scons' %
(OLDISIM_DIR, OLDISIM_VERSION))


def Prepare(benchmark_spec):
Expand All @@ -116,7 +109,7 @@ def Prepare(benchmark_spec):
vm_util.RunThreaded(InstallAndBuild, vms)

# Launch job on the leaf nodes.
leaf_server_bin = posixpath.join(OLDISIM_DIR, BINARY_BASE, 'LeafNode')
leaf_server_bin = oldisim_dependencies.BinaryPath('LeafNode')
for vm in leaf_vms:
leaf_cmd = '%s --threads=%s' % (leaf_server_bin, vm.num_cpus)
vm.RemoteCommand('%s &> /dev/null &' % leaf_cmd)
Expand All @@ -131,7 +124,7 @@ def SetupRoot(root_vm, leaf_vms):
"""
fanout_args = ' '.join(['--leaf=%s' % i.internal_ip
for i in leaf_vms])
root_server_bin = posixpath.join(OLDISIM_DIR, BINARY_BASE, 'ParentNode')
root_server_bin = oldisim_dependencies.BinaryPath('ParentNode')
root_cmd = '%s --threads=%s %s' % (root_server_bin, root_vm.num_cpus,
fanout_args)
logging.info('Root cmdline: %s', root_cmd)
Expand Down Expand Up @@ -201,8 +194,8 @@ def RunLoadTest(benchmark_spec, fanout):
SetupRoot(root_vm, leaf_vms)

driver_vm = driver_vms[0]
driver_binary = posixpath.join(OLDISIM_DIR, BINARY_BASE, 'DriverNode')
launch_script = posixpath.join(OLDISIM_DIR, 'workloads/search/search_qps.sh')
driver_binary = oldisim_dependencies.BinaryPath('DriverNode')
launch_script = oldisim_dependencies.Path('workloads/search/search_qps.sh')
driver_args = ' '.join(['--server=%s' % i.internal_ip
for i in root_vms])
# Make sure server is up.
Expand Down
31 changes: 27 additions & 4 deletions perfkitbenchmarker/linux_packages/oldisim_dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,43 @@

"""Module containing oldisim dependencies installation functions."""

import os

YUM_PACKAGES = ('bc gengetopt libevent-devel '
'google-perftools-devel scons')
APT_PACKAGES = ('bc gengetopt libevent-dev '
'libgoogle-perftools-dev scons')

OLDISIM_GIT = 'https://github.com/GoogleCloudPlatform/oldisim.git'
OLDISIM_DIR = 'oldisim'
OLDISIM_VERSION = 'v0.1'
BINARY_BASE = 'release/workloads/search'


def _Install(vm, packages):
vm.Install('build_tools')
vm.InstallPackages(packages)
vm.RemoteCommand('git clone --recursive %s' % OLDISIM_GIT)
vm.RemoteCommand('cd %s && git checkout %s && scons' %
(OLDISIM_DIR, OLDISIM_VERSION))


def YumInstall(vm):
"""Installs oldisim dependencies on the VM."""
vm.Install('build_tools')
vm.InstallEpelRepo()
vm.InstallPackages(YUM_PACKAGES)
_Install(vm, YUM_PACKAGES)


def AptInstall(vm):
"""Installs oldisim dependencies on the VM."""
vm.Install('build_tools')
vm.InstallPackages(APT_PACKAGES)
_Install(vm, APT_PACKAGES)


def Path(name):
"""Returns the path of a file within the package."""
return os.path.join(OLDISIM_DIR, name)


def BinaryPath(name):
"""Returns the path of a binary within the package."""
return os.path.join(OLDISIM_DIR, BINARY_BASE, name)

0 comments on commit 6b1c9e5

Please sign in to comment.