use of org.apache.asterix.experiment.client.OrchestratorServer in project asterixdb by apache.
the class AbstractExperiment8Builder method doBuildDataGen.
@Override
protected void doBuildDataGen(SequentialActionList seq, Map<String, List<String>> dgenPairs) throws Exception {
//start datagen
SequentialActionList[] protocolActions = new SequentialActionList[nIntervals];
for (int i = 0; i < nIntervals; i++) {
protocolActions[i] = new SequentialActionList();
protocolActions[i].add(new SleepAction(10000));
protocolActions[i].add(new RunRESTIOWaitAction(httpClient, restHost, restPort));
protocolActions[i].add(new SleepAction(10000));
doBuildProtocolAction(protocolActions[i], i);
}
int nDgens = 0;
for (List<String> v : dgenPairs.values()) {
nDgens += v.size();
}
final OrchestratorServer oServer = new OrchestratorServer(orchPort, nDgens, nIntervals, protocolActions);
seq.add(new AbstractAction() {
@Override
protected void doPerform() throws Exception {
oServer.start();
}
});
ParallelActionSet dgenActions = new ParallelActionSet();
int partition = 0;
// run dgen
for (String dgenHost : dgenPairs.keySet()) {
final List<String> rcvrs = dgenPairs.get(dgenHost);
final int p = partition;
dgenActions.add(new AbstractRemoteExecutableAction(dgenHost, username, sshKeyLocation) {
@Override
protected String getCommand() {
String ipPortPairs = StringUtils.join(rcvrs.iterator(), " ");
String binary = "JAVA_HOME=" + javaHomePath + " " + localExperimentRoot.resolve("bin").resolve("datagenrunner").toString();
return StringUtils.join(new String[] { binary, "-si", "" + locationSampleInterval, "-of", openStreetMapFilePath, "-p", "" + p, "-di", "" + dataInterval, "-ni", "" + nIntervals, "-oh", orchHost, "-op", "" + orchPort, ipPortPairs }, " ");
}
});
partition += rcvrs.size();
}
seq.add(dgenActions);
// wait until all dgen / queries are done
seq.add(new AbstractAction() {
@Override
protected void doPerform() throws Exception {
oServer.awaitFinished();
}
});
}
Aggregations