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));
}
Aggregations