Class Vertex
- All Implemented Interfaces:
DataSerializable,IdentifiedDataSerializable
edges and pushes
data items to its outbound edges. Practically, a single vertex is represented
by a set of instances of Processor. The localParallelism property
determines the number of processor instances running on each cluster member.
Each processor is assigned a set of partition IDs it is responsible for. When an inbound edge is partitioned, the processor will receive only those data items whose partition ID it is responsible for. For data traveling over a partitioned edge which is also distributed, the whole cluster contains a single unique processor instance responsible for any given partition ID. For non-distributed edges, the processor is unique only within a member and each member has its own processor for any given partition ID. Finally, there is a guarantee of collation across all the partitioned edges impinging on a vertex: within each member, all the data with a given partition ID is received by the same processor.
A vertex is uniquely identified in a DAG by its name.
- Since:
- Jet 3.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe value oflocalParallelism(int)with the meaning "use the default local parallelism". -
Constructor Summary
ConstructorsConstructorDescriptionVertex(String name, SupplierEx<? extends Processor> processorSupplier) Creates a vertex from aSupplier<Processor>.Vertex(String name, ProcessorMetaSupplier metaSupplier) Creates a vertex from aProcessorMetaSupplier.Vertex(String name, ProcessorSupplier processorSupplier) Creates a vertex from aProcessorSupplier. -
Method Summary
Modifier and TypeMethodDescriptionstatic intcheckLocalParallelism(int parallelism) Says whether the given integer is valid as the value oflocalParallelism.intdetermineLocalParallelism(int defaultParallelism) Determines the local parallelism value for the vertex by looking at its local parallelism and meta supplier's preferred local parallelism.intReturns type identifier for this class.intReturns DataSerializableFactory factory ID for this class.intReturns the number of processors corresponding to this vertex that will be created on each member.Returns this vertex's meta-supplier of processors.getName()Returns the name of this vertex.localParallelism(int localParallelism) Sets the number of processors corresponding to this vertex that will be created on each member.voidReads fields from the input streamtoString()voidupdateMetaSupplier(UnaryOperator<ProcessorMetaSupplier> updateFn) Applies the provided operator function to the current processor meta-supplier and replaces it with the one it returns.voidWrites object fields to output stream
-
Field Details
-
LOCAL_PARALLELISM_USE_DEFAULT
public static final int LOCAL_PARALLELISM_USE_DEFAULTThe value oflocalParallelism(int)with the meaning "use the default local parallelism".- See Also:
-
-
Constructor Details
-
Vertex
Creates a vertex from aSupplier<Processor>.This is useful for vertices where all the
Processorinstances will be instantiated the same way.NOTE: this constructor should not be abused with a stateful implementation which produces a different processor each time. In such a case the full
ProcessorSuppliertype should be implemented.- Parameters:
name- the unique name of the vertex. This name identifies the vertex in the snapshotprocessorSupplier- the simple, parameterless supplier ofProcessorinstances
-
Vertex
Creates a vertex from aProcessorSupplier.- Parameters:
name- the unique name of the vertex. This name identifies the vertex in the snapshotprocessorSupplier- the supplier ofProcessorinstances which will be used on all members
-
Vertex
Creates a vertex from aProcessorMetaSupplier.- Parameters:
name- the unique name of the vertex. This name identifies the vertex in the snapshotmetaSupplier- the meta-supplier ofProcessorSuppliers for each member
-
-
Method Details
-
checkLocalParallelism
public static int checkLocalParallelism(int parallelism) Says whether the given integer is valid as the value oflocalParallelism. -
determineLocalParallelism
public int determineLocalParallelism(int defaultParallelism) Determines the local parallelism value for the vertex by looking at its local parallelism and meta supplier's preferred local parallelism.If none of them is set, returns the provided default parallelism
-
localParallelism
Sets the number of processors corresponding to this vertex that will be created on each member.If the value is -1, Jet will determine the vertex's local parallelism during job initialization from the global default and processor meta-supplier's preferred value.
-
getLocalParallelism
public int getLocalParallelism()Returns the number of processors corresponding to this vertex that will be created on each member. A value of-1means that this property is not set; in that case the default configured on the Jet instance will be used. -
getName
Returns the name of this vertex. -
getMetaSupplier
Returns this vertex's meta-supplier of processors. -
updateMetaSupplier
Applies the provided operator function to the current processor meta-supplier and replaces it with the one it returns. Typically used to decorate the existing meta-supplier. -
toString
-
writeData
Description copied from interface:DataSerializableWrites object fields to output stream- Specified by:
writeDatain interfaceDataSerializable- Parameters:
out- output- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the output stream has been closed.
-
readData
Description copied from interface:DataSerializableReads fields from the input stream- Specified by:
readDatain interfaceDataSerializable- Parameters:
in- input- Throws:
IOException- if an I/O error occurs. In particular, anIOExceptionmay be thrown if the input stream has been closed.
-
getFactoryId
public int getFactoryId()Description copied from interface:IdentifiedDataSerializableReturns DataSerializableFactory factory ID for this class.- Specified by:
getFactoryIdin interfaceIdentifiedDataSerializable- Returns:
- factory ID
-
getClassId
public int getClassId()Description copied from interface:IdentifiedDataSerializableReturns type identifier for this class. It should be unique per DataSerializableFactory.- Specified by:
getClassIdin interfaceIdentifiedDataSerializable- Returns:
- type ID
-