public class DAG extends Object implements IdentifiedDataSerializable, Iterable<Vertex>
vertex
represents a unit of data processing and an
edge
represents the path along which the data travels to
the next vertex.
The work of a single vertex is parallelized and distributed, so that there are
several instances of the Processor
type on each member
corresponding to it. Whenever possible, each instance should be
tasked with only a slice of the total data and a partitioning strategy
can be employed to ensure that the data sent to each vertex is collated
by a partitioning key.
There are three basic kinds of vertices:
Constructor and Description |
---|
DAG() |
Modifier and Type | Method and Description |
---|---|
DAG |
edge(Edge edge)
Adds an edge to this DAG.
|
int |
getClassId()
Returns type identifier for this class.
|
int |
getFactoryId()
Returns DataSerializableFactory factory ID for this class.
|
List<Edge> |
getInboundEdges(String vertexName)
Returns the inbound edges connected to the vertex with the given name.
|
List<Edge> |
getOutboundEdges(String vertexName)
Returns the outbound edges connected to the vertex with the given name.
|
Vertex |
getVertex(String vertexName)
Returns the vertex with the given name, or
null if there is no
vertex with that name. |
Iterator<Vertex> |
iterator()
Returns an iterator over the DAG's vertices in topological order.
|
void |
lock()
Used to prevent further mutations to the DAG after submitting it for execution.
|
Vertex |
newUniqueVertex(String namePrefix,
ProcessorMetaSupplier metaSupplier)
Creates a vertex from a
ProcessorMetaSupplier and adds it to
this DAG. |
Vertex |
newUniqueVertex(String namePrefix,
ProcessorSupplier processorSupplier)
Creates a vertex from a
ProcessorSupplier and adds it to this
DAG. |
Vertex |
newUniqueVertex(String namePrefix,
SupplierEx<? extends Processor> simpleSupplier)
Creates a vertex from a
Supplier<Processor> and adds it to this
DAG. |
Vertex |
newVertex(String name,
ProcessorMetaSupplier metaSupplier)
Creates a vertex from a
ProcessorMetaSupplier and adds it to this DAG. |
Vertex |
newVertex(String name,
ProcessorSupplier processorSupplier)
Creates a vertex from a
ProcessorSupplier and adds it to this DAG. |
Vertex |
newVertex(String name,
SupplierEx<? extends Processor> simpleSupplier)
Creates a vertex from a
Supplier<Processor> and adds it to this DAG. |
void |
readData(ObjectDataInput in)
Reads fields from the input stream
|
String |
toDotString()
Returns a DOT format (graphviz) representation of the DAG.
|
String |
toDotString(int defaultLocalParallelism,
int defaultQueueSize)
Returns a DOT format (graphviz) representation of the DAG, annotates
the vertices using supplied default parallelism value, and the edges
using supplied default queue size value.
|
com.hazelcast.internal.json.JsonObject |
toJson(int defaultLocalParallelism)
Returns a JSON representation of the DAG.
|
String |
toString() |
String |
toString(int defaultLocalParallelism)
Returns a string representation of the DAG.
|
DAG |
vertex(Vertex vertex)
Adds a vertex to this DAG.
|
void |
writeData(ObjectDataOutput out)
Writes object fields to output stream
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
@Nonnull public Vertex newVertex(@Nonnull String name, @Nonnull SupplierEx<? extends Processor> simpleSupplier)
Supplier<Processor>
and adds it to this DAG.name
- the unique name of the vertexsimpleSupplier
- the simple, parameterless supplier of Processor
instancesVertex(String, SupplierEx)
@Nonnull public Vertex newUniqueVertex(@Nonnull String namePrefix, @Nonnull SupplierEx<? extends Processor> simpleSupplier)
Supplier<Processor>
and adds it to this
DAG. The vertex will be given a unique name created from the namePrefix
.namePrefix
- the prefix for unique name of the vertexsimpleSupplier
- the simple, parameterless supplier of Processor
instancesVertex(String, SupplierEx)
@Nonnull public Vertex newVertex(@Nonnull String name, @Nonnull ProcessorSupplier processorSupplier)
ProcessorSupplier
and adds it to this DAG.name
- the unique name of the vertexprocessorSupplier
- the supplier of Processor
instances which will be used on all membersVertex(String, ProcessorSupplier)
@Nonnull public Vertex newUniqueVertex(@Nonnull String namePrefix, @Nonnull ProcessorSupplier processorSupplier)
ProcessorSupplier
and adds it to this
DAG. The vertex will be given a unique name created from the namePrefix
.namePrefix
- the prefix for unique name of the vertexprocessorSupplier
- the supplier of Processor
instances which will be used on all membersVertex(String, ProcessorSupplier)
@Nonnull public Vertex newVertex(@Nonnull String name, @Nonnull ProcessorMetaSupplier metaSupplier)
ProcessorMetaSupplier
and adds it to this DAG.name
- the unique name of the vertexmetaSupplier
- the meta-supplier of ProcessorSupplier
s for each memberVertex(String, ProcessorMetaSupplier)
@Nonnull public Vertex newUniqueVertex(@Nonnull String namePrefix, @Nonnull ProcessorMetaSupplier metaSupplier)
ProcessorMetaSupplier
and adds it to
this DAG. The vertex will be given a unique name created from the namePrefix
.namePrefix
- the prefix for unique name of the vertexmetaSupplier
- the meta-supplier of ProcessorSupplier
s for each memberVertex(String, ProcessorMetaSupplier)
@Nonnull public DAG vertex(@Nonnull Vertex vertex)
@Nonnull public DAG edge(@Nonnull Edge edge)
Jet supports multigraphs, that is you can add two edges between the same two vertices. However, they have to have different ordinals.
@Nonnull public List<Edge> getInboundEdges(@Nonnull String vertexName)
@Nonnull public List<Edge> getOutboundEdges(@Nonnull String vertexName)
@Nullable public Vertex getVertex(@Nonnull String vertexName)
null
if there is no
vertex with that name.@Nonnull public Iterator<Vertex> iterator()
@Nonnull public String toString(int defaultLocalParallelism)
defaultLocalParallelism
- the local parallelism that will be shown if
neither overridden on the vertex nor the
preferred parallelism is defined by
meta-supplier@Nonnull public com.hazelcast.internal.json.JsonObject toJson(int defaultLocalParallelism)
Note: the exact structure of the JSON is unspecified.
defaultLocalParallelism
- the local parallelism that will be shown if neither overridden on the
vertex nor the preferred parallelism is defined by meta-supplier@Nonnull public String toDotString()
@Nonnull public String toDotString(int defaultLocalParallelism, int defaultQueueSize)
defaultLocalParallelism
- the local parallelism that will be shown if
neither overridden on the vertex nor the
preferred parallelism is defined by
meta-supplierdefaultQueueSize
- the queue size that will be shown if not overridden
on the edgepublic void writeData(ObjectDataOutput out) throws IOException
DataSerializable
writeData
in interface DataSerializable
out
- outputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
output stream has been closed.public void readData(ObjectDataInput in) throws IOException
DataSerializable
readData
in interface DataSerializable
in
- inputIOException
- if an I/O error occurs. In particular,
an IOException
may be thrown if the
input stream has been closed.public int getFactoryId()
IdentifiedDataSerializable
getFactoryId
in interface IdentifiedDataSerializable
public int getClassId()
IdentifiedDataSerializable
getClassId
in interface IdentifiedDataSerializable
@PrivateApi public void lock()
It's not a public API, can be removed in the future.
Copyright © 2022 Hazelcast, Inc.. All rights reserved.