Search in sources :

Example 1 with AbstractAction

use of org.apache.asterix.experiment.action.base.AbstractAction in project asterixdb by apache.

the class AbstractSpatialIndexExperiment2Builder method doBuildDataGen.

@Override
protected void doBuildDataGen(SequentialActionList seq, Map<String, List<String>> dgenPairs) throws Exception {
    int nDgens = 0;
    for (List<String> v : dgenPairs.values()) {
        nDgens += v.size();
    }
    final SpatialIndexExperiment2OrchestratorServer oServer = new SpatialIndexExperiment2OrchestratorServer(dataGenOrchPort, nDgens, nIntervals, queryGenOrchPort, nDgens);
    seq.add(new AbstractAction() {

        @Override
        protected void doPerform() throws Exception {
            oServer.start();
        }
    });
    //prepare data gen runner and query gen runner
    //note that dgenPairs.keySet() are used as query gen runners' ip address.
    ParallelActionSet dataAndQueryGenActions = new ParallelActionSet();
    int partition = 0;
    for (String dgenHost : dgenPairs.keySet()) {
        final List<String> rcvrs = dgenPairs.get(dgenHost);
        final int p = partition;
        //prepare data gen
        dataAndQueryGenActions.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();
                if (openStreetMapFilePath == null) {
                    return StringUtils.join(new String[] { binary, "-rcbi", "" + recordCountPerBatchDuringIngestionOnly, "-rcbq", "" + recordCountPerBatchDuringQuery, "-dsti", "" + dataGenSleepTimeDuringIngestionOnly, "-dstq", "" + dataGenSleepTimeDuringQuery, "-si", "" + locationSampleInterval, "-p", "" + p, "-di", "" + dataInterval, "-ni", "" + nIntervals, "-qd", "" + queryGenDuration, "-oh", dataGenOrchHost, "-op", "" + dataGenOrchPort, ipPortPairs }, " ");
                } else {
                    return StringUtils.join(new String[] { binary, "-rcbi", "" + recordCountPerBatchDuringIngestionOnly, "-rcbq", "" + recordCountPerBatchDuringQuery, "-dsti", "" + dataGenSleepTimeDuringIngestionOnly, "-dstq", "" + dataGenSleepTimeDuringQuery, "-si", "" + locationSampleInterval, "-of", openStreetMapFilePath, "-p", "" + p, "-di", "" + dataInterval, "-ni", "" + nIntervals, "-qd", "" + queryGenDuration, "-oh", dataGenOrchHost, "-op", "" + dataGenOrchPort, ipPortPairs }, " ");
                }
            }
        });
        //prepare query gen
        dataAndQueryGenActions.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("querygenrunner").toString();
                if (openStreetMapFilePath == null) {
                    if (isIndexOnlyPlan) {
                        return StringUtils.join(new String[] { binary, "-iop", "-p", "" + p, "-qd", "" + queryGenDuration, "-qoh", "" + queryGenOrchHost, "-qop", "" + queryGenOrchPort, "-rh", restHost, "-rp", "" + restPort }, " ");
                    } else {
                        return StringUtils.join(new String[] { binary, "-p", "" + p, "-qd", "" + queryGenDuration, "-qoh", "" + queryGenOrchHost, "-qop", "" + queryGenOrchPort, "-rh", restHost, "-rp", "" + restPort }, " ");
                    }
                } else {
                    if (isIndexOnlyPlan) {
                        return StringUtils.join(new String[] { binary, "-iop", "-of", openStreetMapFilePath, "-p", "" + p, "-qd", "" + queryGenDuration, "-qoh", "" + queryGenOrchHost, "-qop", "" + queryGenOrchPort, "-rh", restHost, "-rp", "" + restPort }, " ");
                    } else {
                        return StringUtils.join(new String[] { binary, "-of", openStreetMapFilePath, "-p", "" + p, "-qd", "" + queryGenDuration, "-qoh", "" + queryGenOrchHost, "-qop", "" + queryGenOrchPort, "-rh", restHost, "-rp", "" + restPort }, " ");
                    }
                }
            }
        });
        partition += rcvrs.size();
    }
    seq.add(dataAndQueryGenActions);
    // wait until all dgen / queries are done
    seq.add(new AbstractAction() {

        @Override
        protected void doPerform() throws Exception {
            oServer.awaitFinished();
        }
    });
}
Also used : SpatialIndexExperiment2OrchestratorServer(org.apache.asterix.experiment.client.SpatialIndexExperiment2OrchestratorServer) AbstractRemoteExecutableAction(org.apache.asterix.experiment.action.derived.AbstractRemoteExecutableAction) AbstractAction(org.apache.asterix.experiment.action.base.AbstractAction) ParallelActionSet(org.apache.asterix.experiment.action.base.ParallelActionSet)

Example 2 with AbstractAction

use of org.apache.asterix.experiment.action.base.AbstractAction 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)

Example 3 with AbstractAction

use of org.apache.asterix.experiment.action.base.AbstractAction in project asterixdb by apache.

the class AbstractExperiment7Builder method doBuildDataGen.

@Override
protected void doBuildDataGen(SequentialActionList seq, Map<String, List<String>> dgenPairs) throws Exception {
    int nDgens = 0;
    for (List<String> v : dgenPairs.values()) {
        nDgens += v.size();
    }
    final OrchestratorServer7 oServer = new OrchestratorServer7(orchPort, nDgens, nIntervals, new ProtocolActionBuilder(), this.lsAction);
    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 : OrchestratorServer7(org.apache.asterix.experiment.client.OrchestratorServer7) IProtocolActionBuilder(org.apache.asterix.experiment.client.OrchestratorServer7.IProtocolActionBuilder) 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)

Example 4 with AbstractAction

use of org.apache.asterix.experiment.action.base.AbstractAction 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();
        }
    });
}
Also used : OrchestratorServer(org.apache.asterix.experiment.client.OrchestratorServer) SleepAction(org.apache.asterix.experiment.action.derived.SleepAction) AbstractRemoteExecutableAction(org.apache.asterix.experiment.action.derived.AbstractRemoteExecutableAction) IOException(java.io.IOException) ParallelActionSet(org.apache.asterix.experiment.action.base.ParallelActionSet) RunRESTIOWaitAction(org.apache.asterix.experiment.action.derived.RunRESTIOWaitAction) SequentialActionList(org.apache.asterix.experiment.action.base.SequentialActionList) AbstractAction(org.apache.asterix.experiment.action.base.AbstractAction)

Aggregations

AbstractAction (org.apache.asterix.experiment.action.base.AbstractAction)4 ParallelActionSet (org.apache.asterix.experiment.action.base.ParallelActionSet)4 AbstractRemoteExecutableAction (org.apache.asterix.experiment.action.derived.AbstractRemoteExecutableAction)4 IOException (java.io.IOException)3 SequentialActionList (org.apache.asterix.experiment.action.base.SequentialActionList)1 RunRESTIOWaitAction (org.apache.asterix.experiment.action.derived.RunRESTIOWaitAction)1 SleepAction (org.apache.asterix.experiment.action.derived.SleepAction)1 OrchestratorServer (org.apache.asterix.experiment.client.OrchestratorServer)1 OrchestratorServer7 (org.apache.asterix.experiment.client.OrchestratorServer7)1 IProtocolActionBuilder (org.apache.asterix.experiment.client.OrchestratorServer7.IProtocolActionBuilder)1 OrchestratorServer9 (org.apache.asterix.experiment.client.OrchestratorServer9)1 IProtocolActionBuilder (org.apache.asterix.experiment.client.OrchestratorServer9.IProtocolActionBuilder)1 SpatialIndexExperiment2OrchestratorServer (org.apache.asterix.experiment.client.SpatialIndexExperiment2OrchestratorServer)1