support monitor
This commit is contained in:
@@ -56,6 +56,7 @@ public class Main {
|
||||
private static boolean keepRunning = true;
|
||||
private static boolean firstCollecting = false;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public static void main(String[] args) {
|
||||
|
||||
// Initialize log4j
|
||||
@@ -137,13 +138,13 @@ public class Main {
|
||||
}
|
||||
|
||||
DBCollector collector = getCollector(config);
|
||||
File f = new File("pid.txt");
|
||||
try {
|
||||
// add a signal handler
|
||||
Signal.handle(new Signal("INT"), signal -> firstCollecting = true);
|
||||
File f = new File("pid.txt");
|
||||
|
||||
// get pid of this process and write the pid to a file before recording the start time
|
||||
if (time < 0) {
|
||||
// add a signal handler
|
||||
Signal.handle(new Signal("INT"), signal -> firstCollecting = true);
|
||||
|
||||
String vmName = ManagementFactory.getRuntimeMXBean().getName();
|
||||
int p = vmName.indexOf("@");
|
||||
int pid = Integer.valueOf(vmName.substring(0, p));
|
||||
@@ -157,6 +158,9 @@ public class Main {
|
||||
ioe.printStackTrace();
|
||||
}
|
||||
}
|
||||
else {
|
||||
firstCollecting = true;
|
||||
}
|
||||
LOG.info("Output the process pid to pid.txt");
|
||||
|
||||
while (!firstCollecting) {
|
||||
@@ -185,9 +189,6 @@ public class Main {
|
||||
knobsWriter.println(knobs);
|
||||
knobsWriter.close();
|
||||
|
||||
// add a signal handler
|
||||
Signal.handle(new Signal("INT"), signal -> keepRunning = false);
|
||||
|
||||
// record start time
|
||||
long startTime = System.currentTimeMillis();
|
||||
LOG.info("Starting the experiment ...");
|
||||
@@ -196,6 +197,8 @@ public class Main {
|
||||
if (time >= 0) {
|
||||
Thread.sleep(time * TO_MILLISECONDS);
|
||||
} else {
|
||||
// add a signal handler
|
||||
Signal.handle(new Signal("INT"), signal -> keepRunning = false);
|
||||
while (keepRunning) {
|
||||
Thread.sleep(1);
|
||||
}
|
||||
|
||||
@@ -153,6 +153,10 @@ OLTPBENCH_BENCH = 'tpcc'
|
||||
# CONTROLLER OPTIONS
|
||||
#==========================================================
|
||||
|
||||
# Controller observation time, OLTPBench will be disabled for
|
||||
# monitoring if the time is specified
|
||||
CONTROLLER_OBSERVE_SEC = 100
|
||||
|
||||
# Path to the controller directory
|
||||
CONTROLLER_HOME = DRIVER_HOME + '/../controller'
|
||||
|
||||
|
||||
24
client/driver/fabfile.py
vendored
24
client/driver/fabfile.py
vendored
@@ -308,11 +308,11 @@ def run_oltpbench_bg():
|
||||
|
||||
|
||||
@task
|
||||
def run_controller():
|
||||
def run_controller(interval_sec=-1):
|
||||
LOG.info('Controller config path: %s', dconf.CONTROLLER_CONFIG)
|
||||
create_controller_config()
|
||||
cmd = 'gradle run -PappArgs="-c {} -d output/" --no-daemon > {}'.\
|
||||
format(dconf.CONTROLLER_CONFIG, dconf.CONTROLLER_LOG)
|
||||
cmd = 'gradle run -PappArgs="-c {} -t {} -d output/" --no-daemon > {}'.\
|
||||
format(dconf.CONTROLLER_CONFIG, interval_sec, dconf.CONTROLLER_LOG)
|
||||
with lcd(dconf.CONTROLLER_HOME): # pylint: disable=not-context-manager
|
||||
local(cmd)
|
||||
|
||||
@@ -642,7 +642,13 @@ def clean_logs():
|
||||
@task
|
||||
def clean_oltpbench_results():
|
||||
# remove oltpbench result files
|
||||
local('rm -f {}/results/*'.format(dconf.OLTPBENCH_HOME))
|
||||
local('rm -f {}/results/outputfile*'.format(dconf.OLTPBENCH_HOME))
|
||||
|
||||
|
||||
@task
|
||||
def clean_controller_results():
|
||||
# remove oltpbench result files
|
||||
local('rm -f {}/output/*.json'.format(dconf.CONTROLLER_HOME))
|
||||
|
||||
|
||||
def _set_oltpbench_property(name, line):
|
||||
@@ -820,6 +826,16 @@ def run_loops(max_iter=10):
|
||||
LOG.info('The %s-th Loop Ends / Total Loops %s', i + 1, max_iter)
|
||||
|
||||
|
||||
@task
|
||||
def monitor(max_iter=1):
|
||||
for i in range(int(max_iter)):
|
||||
LOG.info('The %s-th Monitor Loop Starts / Total Loops %s', i + 1, max_iter)
|
||||
clean_controller_results()
|
||||
run_controller(interval_sec=dconf.CONTROLLER_OBSERVE_SEC)
|
||||
upload_result()
|
||||
LOG.info('The %s-th Monitor Loop Ends / Total Loops %s', i + 1, max_iter)
|
||||
|
||||
|
||||
@task
|
||||
def rename_batch(result_dir=None):
|
||||
result_dir = result_dir or dconf.RESULT_DIR
|
||||
|
||||
Reference in New Issue
Block a user