Final changes to get remote working again
This commit is contained in:
Родитель
b537237c14
Коммит
e6f0bbdcac
|
@ -11,14 +11,11 @@ import StringIO
|
|||
import subprocess
|
||||
import signal
|
||||
import pickle
|
||||
import remote
|
||||
|
||||
import ConfigParser
|
||||
import submitter
|
||||
import utils
|
||||
|
||||
from collections import namedtuple
|
||||
Mode = namedtuple('Mode', ['shell', 'args', 'env', 'name', 'cset'])
|
||||
class Benchmark(object):
|
||||
def __init__(self, name, folder):
|
||||
self.name = name
|
||||
|
|
|
@ -112,8 +112,8 @@ class V8(Engine):
|
|||
super(V8, self).__init__()
|
||||
self.puller = 'svn'
|
||||
self.source = utils.config.get('v8', 'source')
|
||||
self.CXX = utils.config_get_default('v8', 'CXX')
|
||||
self.LINK = utils.config.get('v8', 'LINK')
|
||||
self.CXX = utils.config_get_default('v8', 'CXX', None)
|
||||
self.LINK = utils.config_get_default('v8', 'LINK', None)
|
||||
self.args = ['--expose-gc']
|
||||
self.important = True
|
||||
self.hardfp = (utils.config.has_option('main', 'flags')) and \
|
||||
|
|
|
@ -85,5 +85,5 @@ for slave in KnownSlaves:
|
|||
slave.benchmark(submit, native, modes)
|
||||
|
||||
# Wait for all of the slaves to finish running before exiting.
|
||||
for slave in remote.slaves:
|
||||
for slave in KnownSlaves:
|
||||
slave.synchronize()
|
||||
|
|
|
@ -5,26 +5,31 @@ import pickle
|
|||
import os
|
||||
import subprocess
|
||||
import __main__
|
||||
from collections import namedtuple
|
||||
|
||||
import benchmarks
|
||||
|
||||
class Slave:
|
||||
class Slave(object):
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
self.machine = utils.config.get(name,'machine')
|
||||
|
||||
def prepare(self):
|
||||
def prepare(self, engines):
|
||||
pass
|
||||
|
||||
def benchmark(submit, native, modes):
|
||||
def synchronize(self):
|
||||
pass
|
||||
|
||||
def benchmark(self, submit, native, modes):
|
||||
benchmarks.run(submit, native, modes)
|
||||
|
||||
class RemoteSlave(Slave):
|
||||
def __init__(self, name):
|
||||
super(RemoteSlave, self).__init__(name)
|
||||
self.HostName = utils.config_get_default(name, 'hostname', name)
|
||||
self.RepoPath = utils.config_get_default(name, 'repos', utils.RepoPath)
|
||||
self.BenchmarkPath = utils.config_get_default(name, 'benchmarks', utils.BenchmarkPath)
|
||||
self.DriverPath = utils.config_get_default(name, 'repos', utils.DriverPath)
|
||||
self.DriverPath = utils.config_get_default(name, 'driver', utils.DriverPath)
|
||||
self.Timeout = utils.config_get_default(name, 'timeout', str(utils.Timeout))
|
||||
# calculate timeoutmake multiplication work!
|
||||
self.Timeout = eval(self.Timeout, {}, {})
|
||||
|
@ -34,18 +39,16 @@ class RemoteSlave(Slave):
|
|||
self.delayedCommand = None
|
||||
|
||||
def prepare(self, engines):
|
||||
slave.pushRemote(utils.DriverPath + os.path.sep, slave.DriverPath)
|
||||
slave.pushRemote(utils.BenchmarkPath + os.path.sep, slave.BenchmarkPath)
|
||||
self.pushRemote(utils.DriverPath + os.path.sep, self.DriverPath)
|
||||
self.pushRemote(utils.BenchmarkPath + os.path.sep, self.BenchmarkPath)
|
||||
|
||||
shell = os.path.join(utils.RepoPath, engine.source, engine.shell())
|
||||
for engine in engines:
|
||||
rshell = os.path.join(slave.RepoPath, engine.source, engine.shell())
|
||||
slave.pushRemote(shell, rshell, follow=True)
|
||||
shell = os.path.join(utils.RepoPath, engine.source, engine.shell())
|
||||
rshell = os.path.join(self.RepoPath, engine.source, engine.shell())
|
||||
self.runRemote(["mkdir", "-p", os.path.dirname(rshell)])
|
||||
self.pushRemote(shell, rshell, follow=True)
|
||||
|
||||
def benchmark(submit, native, modes):
|
||||
async = False
|
||||
if 'async' in opt:
|
||||
async = opt['async']
|
||||
def benchmark(self, submit, native, modes):
|
||||
fd = open("state.p", "wb")
|
||||
# dump the global state gathered from the config file
|
||||
pickle.dump(utils.config, fd)
|
||||
|
@ -56,13 +59,15 @@ class RemoteSlave(Slave):
|
|||
pickle.dump(self.Timeout, fd)
|
||||
|
||||
# dump out all the arguments
|
||||
pickle.dump(args, fd)
|
||||
pickle.dump(submit, fd)
|
||||
pickle.dump(native, fd)
|
||||
pickle.dump(modes, fd)
|
||||
fd.close()
|
||||
|
||||
# send the pickled data over the wire so we can make a call
|
||||
self.pushRemote(os.path.join(utils.DriverPath, "state.p"), os.path.join(self.DriverPath, "state.p"))
|
||||
# cd into the driver's directory, then start running the module.
|
||||
self.runRemote(["cd", self.DriverPath, ";", self.PythonName, module.__name__ + '.py', os.path.join(self.DriverPath, "state.p")], async=async)
|
||||
self.runRemote(["cd", self.DriverPath, ";", self.PythonName, 'slaves.py', os.path.join(self.DriverPath, "state.p")], async=True)
|
||||
|
||||
def runRemote(self, cmds, async = False):
|
||||
# no matter what, we don't want to start running a new command until the old one is gone.
|
||||
|
@ -93,10 +98,25 @@ class RemoteSlave(Slave):
|
|||
self.delayed = None
|
||||
self.delayedCommand = None
|
||||
|
||||
def takerpc(func=None, name=sys.argv[1]):
|
||||
if not func:
|
||||
func = __main__.default_function
|
||||
fd = open("state.p", "rb")
|
||||
def init():
|
||||
slaves = []
|
||||
slaveNames = utils.config_get_default('main', 'slaves', []).split(",")
|
||||
for name in slaveNames:
|
||||
remote = utils.config_get_default(name, 'remote', 1)
|
||||
if remote == 1:
|
||||
slaves.append(RemoteSlave(name))
|
||||
else:
|
||||
slaves.append(Slave(name))
|
||||
|
||||
if not slaves:
|
||||
slaves = [Slave("main")]
|
||||
return slaves
|
||||
|
||||
if __name__ == "__main__":
|
||||
Mode = namedtuple('Mode', ['shell', 'args', 'env', 'name', 'cset'])
|
||||
state = sys.argv[1]
|
||||
|
||||
fd = open(state, "rb")
|
||||
# pull out the global configuration
|
||||
utils.config = pickle.load(fd)
|
||||
utils.RepoPath = pickle.load(fd)
|
||||
|
@ -105,22 +125,10 @@ def takerpc(func=None, name=sys.argv[1]):
|
|||
utils.Timeout = pickle.load(fd)
|
||||
|
||||
# pull out the pickled arguments
|
||||
args = pickle.load(fd)
|
||||
submit = pickle.load(fd)
|
||||
native = pickle.load(fd)
|
||||
modes = pickle.load(fd)
|
||||
fd.close()
|
||||
|
||||
# call the one true function
|
||||
func(*args)
|
||||
|
||||
def init():
|
||||
slaves = []
|
||||
slaveNames = utils.config.get('main', 'slaves')
|
||||
for name in slaveNames:
|
||||
remote = utils.config.get(slaveNames, 'remote', 1)
|
||||
if remote == 1:
|
||||
slaves.append(RemoteSlave(name))
|
||||
else
|
||||
slaves.append(Slave(name))
|
||||
|
||||
if not slaves:
|
||||
slaves = [Slave("main")]
|
||||
return slaves
|
||||
benchmarks.run(submit, native, modes)
|
||||
|
|
|
@ -15,6 +15,7 @@ RepoPath = None
|
|||
BenchmarkPath = None
|
||||
DriverPath = None
|
||||
Timeout = 15*60
|
||||
|
||||
def InitConfig(name):
|
||||
global config, RepoPath, BenchmarkPath, DriverPath, Timeout
|
||||
config = ConfigParser.RawConfigParser()
|
||||
|
@ -23,7 +24,6 @@ def InitConfig(name):
|
|||
config.read(name)
|
||||
RepoPath = config.get('main', 'repos')
|
||||
BenchmarkPath = config.get('main', 'benchmarks')
|
||||
# banal assumption that we are running this from the driver directory.
|
||||
DriverPath = config_get_default('main', 'driver', os.getcwd())
|
||||
Timeout = config_get_default('main', 'timeout', str(Timeout))
|
||||
# silly hack to allow 30*60 in the config file.
|
||||
|
@ -86,7 +86,7 @@ class Handler():
|
|||
def RunTimedCheckOutput(args, env = os.environ.copy(), timeout = None, **popenargs):
|
||||
if timeout is None:
|
||||
timeout = Timeout
|
||||
print('Running: "'+ '" "'.join(args) + '" with timeout: ' + str(timeout))
|
||||
print('Running: "'+ '" "'.join(args) + '" with timeout: ' + str(timeout)+'s')
|
||||
p = subprocess.Popen(args, env = env, stdout=subprocess.PIPE, **popenargs)
|
||||
with Handler(signal.SIGALRM, timeout_handler):
|
||||
try:
|
||||
|
|
Загрузка…
Ссылка в новой задаче