Search in sources :

Example 26 with LogicalPlanBuilder

use of edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder in project twister2 by DSC-SPIDAL.

the class SortJob method execute.

@Override
public void execute(Config cfg, JobAPI.Job job, IWorkerController workerController, IPersistentVolume persistentVolume, IVolatileVolume volatileVolume) {
    int workerID = workerController.getWorkerInfo().getWorkerID();
    // create a worker environment & setup the network
    WorkerEnvironment workerEnv = WorkerEnvironment.init(cfg, job, workerController, persistentVolume, volatileVolume);
    int noOfSources = cfg.getIntegerValue(ARG_TASKS_SOURCES, 4);
    int noOfTargets = cfg.getIntegerValue(ARG_TASKS_SINKS, 4);
    taskStages.add(noOfSources);
    taskStages.add(noOfTargets);
    // lets create the task plan
    LogicalPlanBuilder logicalPlanBuilder = LogicalPlanBuilder.plan(taskStages.get(0), taskStages.get(1), workerEnv).withFairDistribution();
    int valueSize = cfg.getIntegerValue(SortJob.ARG_VALUE_SIZE, 90);
    int keySize = cfg.getIntegerValue(SortJob.ARG_KEY_SIZE, 10);
    MessageSchema schema = MessageSchema.noSchema();
    if (cfg.getBooleanValue(ARG_FIXED_SCHEMA, false)) {
        LOG.info("Using fixed schema feature with message size : " + (keySize + valueSize) + " and key size : " + keySize);
        schema = MessageSchema.ofSize(keySize + valueSize, keySize);
    }
    gather = new BKeyedGather(workerEnv.getCommunicator(), logicalPlanBuilder, MessageTypes.BYTE_ARRAY, MessageTypes.BYTE_ARRAY, new RecordSave(), new ByteSelector(), true, new IntegerComparator(), true, schema);
    int thisSource = logicalPlanBuilder.getSourcesOnThisWorker().iterator().next();
    RecordSource source = new RecordSource(cfg, workerID, gather, thisSource);
    long start = System.currentTimeMillis();
    // run until we send
    source.run();
    // wait until we receive
    progress();
    LOG.info("Time: " + (System.currentTimeMillis() - start));
}
Also used : MessageSchema(edu.iu.dsc.tws.api.comms.packing.MessageSchema) LogicalPlanBuilder(edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder) BKeyedGather(edu.iu.dsc.tws.comms.batch.BKeyedGather) WorkerEnvironment(edu.iu.dsc.tws.api.resource.WorkerEnvironment)

Aggregations

LogicalPlanBuilder (edu.iu.dsc.tws.comms.utils.LogicalPlanBuilder)26 WorkerEnvironment (edu.iu.dsc.tws.api.resource.WorkerEnvironment)21 MessageTypes (edu.iu.dsc.tws.api.comms.messaging.types.MessageTypes)20 Config (edu.iu.dsc.tws.api.config.Config)20 Set (java.util.Set)20 Logger (java.util.logging.Logger)20 ResultsVerifier (edu.iu.dsc.tws.examples.verification.ResultsVerifier)19 IntArrayComparator (edu.iu.dsc.tws.examples.verification.comparators.IntArrayComparator)19 BenchmarkUtils (edu.iu.dsc.tws.examples.utils.bench.BenchmarkUtils)18 Timing (edu.iu.dsc.tws.examples.utils.bench.Timing)18 BenchWorker (edu.iu.dsc.tws.examples.comms.BenchWorker)14 BenchmarkConstants (edu.iu.dsc.tws.examples.utils.bench.BenchmarkConstants)13 BulkReceiver (edu.iu.dsc.tws.api.comms.BulkReceiver)12 Iterator (java.util.Iterator)12 IteratorComparator (edu.iu.dsc.tws.examples.verification.comparators.IteratorComparator)11 ArrayList (java.util.ArrayList)11 Comparator (java.util.Comparator)11 List (java.util.List)11 Level (java.util.logging.Level)10 Tuple (edu.iu.dsc.tws.api.comms.structs.Tuple)9