use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class PartitionedProcessorTransform method addToDag.
@Override
public void addToDag(Planner p, Context context) {
determineLocalParallelism(processorSupplier.preferredLocalParallelism(), context, p.isPreserveOrder());
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), processorSupplier);
p.addEdges(this, pv.v, e -> e.partitioned(partitionKeyFn).distributed());
}
use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class ProcessorTransform method addToDag.
@Override
public void addToDag(Planner p, Context context) {
determineLocalParallelism(processorSupplier.preferredLocalParallelism(), context, p.isPreserveOrder());
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), processorSupplier);
if (p.isPreserveOrder()) {
p.addEdges(this, pv.v, Edge::isolated);
} else {
p.addEdges(this, pv.v);
}
}
use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class SortTransform method addToDag.
@Override
public void addToDag(Planner p, Context context) {
String vertexName = name();
determineLocalParallelism(LOCAL_PARALLELISM_USE_DEFAULT, context, p.isPreserveOrder());
Vertex v1 = p.dag.newVertex(vertexName, sortP(comparator)).localParallelism(determinedLocalParallelism());
if (p.isPreserveOrder()) {
p.addEdges(this, v1, Edge::isolated);
} else {
p.addEdges(this, v1);
}
determinedLocalParallelism(1);
PlannerVertex pv2 = p.addVertex(this, vertexName + COLLECT_STAGE_SUFFIX, determinedLocalParallelism(), ProcessorMetaSupplier.forceTotalParallelismOne(ProcessorSupplier.of(mapP(identity())), vertexName));
p.dag.edge(between(v1, pv2.v).distributed().allToOne(vertexName).ordered(comparator));
}
use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class WindowAggregateTransform method addSlidingWindowTwoStage.
// WHEN PRESERVE ORDER IS NOT ACTIVE
// -------- ---------
// | source0 | ... | sourceN |
// -------- ---------
// | |
// local local
// unicast unicast
// v v
// --------------------
// | accumulateByFrameP | keyFn = constantKey()
// --------------------
// |
// distributed
// all-to-one
// v
// -------------------------
// | combineToSlidingWindowP | local parallelism = 1
// -------------------------
// WHEN PRESERVE ORDER IS ACTIVE
// -------- ---------
// | source0 | ... | sourceN |
// -------- ---------
// | |
// isolated isolated
// v v
// --------------------
// | accumulateByFrameP | keyFn = constantKey()
// --------------------
// |
// distributed
// all-to-one
// v
// -------------------------
// | combineToSlidingWindowP | local parallelism = 1
// -------------------------
private void addSlidingWindowTwoStage(Planner p, SlidingWindowDefinition wDef, Context context) {
determineLocalParallelism(LOCAL_PARALLELISM_USE_DEFAULT, context, p.isPreserveOrder());
SlidingWindowPolicy winPolicy = slidingWinPolicy(wDef.windowSize(), wDef.slideBy());
Vertex v1 = p.dag.newVertex(name() + FIRST_STAGE_VERTEX_NAME_SUFFIX, accumulateByFrameP(nCopies(aggrOp.arity(), new ConstantFunctionEx<>(name().hashCode())), nCopies(aggrOp.arity(), (ToLongFunctionEx<JetEvent<?>>) JetEvent::timestamp), TimestampKind.EVENT, winPolicy, aggrOp));
v1.localParallelism(determinedLocalParallelism());
if (p.isPreserveOrder()) {
p.addEdges(this, v1, Edge::isolated);
} else {
// when preserveOrder is false, we use requested parallelism
// for 1st stage: edge to it is local-unicast, each processor
// can process part of the input which will be combined into
// one result in 2nd stage.
p.addEdges(this, v1);
}
determinedLocalParallelism(1);
PlannerVertex pv2 = p.addVertex(this, name(), determinedLocalParallelism(), combineToSlidingWindowP(winPolicy, aggrOp, jetEventOfWindowResultFn()));
p.dag.edge(between(v1, pv2.v).distributed().allToOne(name().hashCode()));
}
use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class FlatMapStatefulTransform method addToDag.
@Override
public void addToDag(Planner p, Context context) {
determineLocalParallelism(LOCAL_PARALLELISM_USE_DEFAULT, context, false);
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), flatMapStatefulP(ttl, keyFn, timestampFn, createFn, statefulFlatMapFn, onEvictFn));
p.addEdges(this, pv.v, edge -> edge.partitioned(keyFn).distributed());
}
Aggregations