Search in sources :

Example 1 with OrchestratorServer9

use of org.apache.asterix.experiment.client.OrchestratorServer9 in project asterixdb by apache.

the class AbstractExperiment9Builder method doBuildDataGen.

@Override
protected void doBuildDataGen(SequentialActionList seq, Map<String, List<String>> dgenPairs) throws IOException {
    int nDgens = 0;
    for (List<String> v : dgenPairs.values()) {
        nDgens += v.size();
    }
    final OrchestratorServer9 oServer = new OrchestratorServer9(orchPort, nDgens, nIntervals, new ProtocolActionBuilder());
    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();
        }
    });
}
Also used : IProtocolActionBuilder(org.apache.asterix.experiment.client.OrchestratorServer9.IProtocolActionBuilder) OrchestratorServer9(org.apache.asterix.experiment.client.OrchestratorServer9) AbstractRemoteExecutableAction(org.apache.asterix.experiment.action.derived.AbstractRemoteExecutableAction) AbstractAction(org.apache.asterix.experiment.action.base.AbstractAction) IOException(java.io.IOException) ParallelActionSet(org.apache.asterix.experiment.action.base.ParallelActionSet)

Aggregations

IOException (java.io.IOException)1 AbstractAction (org.apache.asterix.experiment.action.base.AbstractAction)1 ParallelActionSet (org.apache.asterix.experiment.action.base.ParallelActionSet)1 AbstractRemoteExecutableAction (org.apache.asterix.experiment.action.derived.AbstractRemoteExecutableAction)1 OrchestratorServer9 (org.apache.asterix.experiment.client.OrchestratorServer9)1 IProtocolActionBuilder (org.apache.asterix.experiment.client.OrchestratorServer9.IProtocolActionBuilder)1