Package org.apache.nemo.common.ir.vertex
Class LoopVertex
- java.lang.Object
-
- org.apache.nemo.common.dag.Vertex
-
- org.apache.nemo.common.ir.vertex.IRVertex
-
- org.apache.nemo.common.ir.vertex.LoopVertex
-
- Direct Known Subclasses:
TaskSizeSplitterVertex
public class LoopVertex extends IRVertex
IRVertex that contains a partial DAG that is iterative.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description LoopVertex(java.lang.String compositeTransformFullName)
The LoopVertex constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDagIncomingEdge(IREdge edge)
Adds the incoming edge of the contained DAG.void
addDagOutgoingEdge(IREdge edge)
Adds and outgoing edge of the contained DAG.void
addIterativeIncomingEdge(IREdge edge)
Adds an iterative incoming edge, from the previous iteration, but connection internally.void
addNonIterativeIncomingEdge(IREdge edge)
Adds a non-iterative incoming edge, from outside the previous iteration.protected void
decreaseMaxNumberOfIterations()
decrease the value of maximum number of iterations by 1.DAGBuilder<IRVertex,IREdge>
getBuilder()
LoopVertex
getClone()
Creates and returns a copy of this object.DAG<IRVertex,IREdge>
getDAG()
java.util.Map<IRVertex,java.util.Set<IREdge>>
getDagIncomingEdges()
java.util.Map<IRVertex,java.util.Set<IREdge>>
getDagOutgoingEdges()
IREdge
getEdgeWithInternalVertex(IREdge edgeWithLoop)
java.util.Map<IREdge,IREdge>
getEdgeWithInternalVertexToEdgeWithLoop()
Getter method for edgeWithInternalVertexToEdgeWithLoop.IREdge
getEdgeWithLoop(IREdge edgeWithInternalVertex)
java.util.Map<IREdge,IREdge>
getEdgeWithLoopToEdgeWithInternalVertex()
Getter method for edgeWithLoopToEdgeWithInternalVertex.java.util.Map<IRVertex,java.util.Set<IREdge>>
getIterativeIncomingEdges()
java.lang.Integer
getMaxNumberOfIterations()
java.lang.String
getName()
java.util.Map<IRVertex,java.util.Set<IREdge>>
getNonIterativeIncomingEdges()
com.fasterxml.jackson.databind.node.ObjectNode
getPropertiesAsJsonNode()
Parse Properties to JsonNode.java.util.function.IntPredicate
getTerminationCondition()
void
increaseMaxNumberOfIterations()
increase the value of maximum number of iterations by 1.java.lang.Boolean
loopTerminationConditionMet()
java.lang.Boolean
loopTerminationConditionMet(java.lang.Integer intPredicateInput)
void
mapEdgeWithLoop(IREdge edgeWithLoop, IREdge edgeWithInternalVertex)
Maps an edge from/to loop with the corresponding edge from/to internal vertex.void
markDuplicateEdges()
Marks duplicate edges with DuplicateEdgeGroupProperty.void
removeDagIncomingEdge(IREdge edge)
Removes the incoming edge of the contained DAG.void
removeDagOutgoingEdge(IREdge edge)
Removes a dag outgoing edge.void
removeIterativeIncomingEdge(IREdge edge)
Remove an iterative incoming edge.void
removeNonIterativeIncomingEdge(IREdge edge)
Removes non iterative incoming edge.void
setMaxNumberOfIterations(java.lang.Integer maxNum)
Set the maximum number of iterations.void
setTerminationCondition(java.util.function.IntPredicate terminationCondition)
Set the intPredicate termination condition for the LoopVertex.boolean
terminationConditionEquals(LoopVertex that)
Check termination condition.LoopVertex
unRollIteration(DAGBuilder<IRVertex,IREdge> dagBuilder)
Method for unrolling an iteration of the LoopVertex.-
Methods inherited from class org.apache.nemo.common.ir.vertex.IRVertex
copyExecutionPropertiesTo, getExecutionProperties, getIRVertexPropertiesAsJsonNode, getPropertyValue, isUtilityVertex, setProperty, setPropertyPermanently
-
Methods inherited from class org.apache.nemo.common.dag.Vertex
getId, getNumericId
-
-
-
-
Method Detail
-
getClone
public final LoopVertex getClone()
Description copied from interface:Cloneable
Creates and returns a copy of this object.The precise meaning of "copy" may depend on the class of the object. The general intent is that, all fields of the object are copied.
- Returns:
- a clone of this object.
-
getBuilder
public DAGBuilder<IRVertex,IREdge> getBuilder()
- Returns:
- DAGBuilder of the LoopVertex.
-
getName
public java.lang.String getName()
- Returns:
- the full name of the composite transform.
-
mapEdgeWithLoop
public void mapEdgeWithLoop(IREdge edgeWithLoop, IREdge edgeWithInternalVertex)
Maps an edge from/to loop with the corresponding edge from/to internal vertex.- Parameters:
edgeWithLoop
- an edge from/to loopedgeWithInternalVertex
- the corresponding edge from/to internal vertex
-
getEdgeWithLoop
public IREdge getEdgeWithLoop(IREdge edgeWithInternalVertex)
- Parameters:
edgeWithInternalVertex
- an edge with internal vertex- Returns:
- the corresponding edge with loop for the specified edge with internal vertex
-
getEdgeWithInternalVertex
public IREdge getEdgeWithInternalVertex(IREdge edgeWithLoop)
- Parameters:
edgeWithLoop
- an edge with loop- Returns:
- the corresponding edge with internal vertex for the specified edge with loop
-
getEdgeWithLoopToEdgeWithInternalVertex
public java.util.Map<IREdge,IREdge> getEdgeWithLoopToEdgeWithInternalVertex()
Getter method for edgeWithLoopToEdgeWithInternalVertex.- Returns:
- the map of edge with loop to the edge with the internal vertex.
-
getEdgeWithInternalVertexToEdgeWithLoop
public java.util.Map<IREdge,IREdge> getEdgeWithInternalVertexToEdgeWithLoop()
Getter method for edgeWithInternalVertexToEdgeWithLoop.- Returns:
- the map of edge with internal vertex to the edge with the loop.
-
addDagIncomingEdge
public void addDagIncomingEdge(IREdge edge)
Adds the incoming edge of the contained DAG.- Parameters:
edge
- edge to add.
-
getDagIncomingEdges
public java.util.Map<IRVertex,java.util.Set<IREdge>> getDagIncomingEdges()
- Returns:
- incoming edges of the contained DAG.
-
removeDagIncomingEdge
public void removeDagIncomingEdge(IREdge edge)
Removes the incoming edge of the contained DAG.- Parameters:
edge
- edge to remove
-
addIterativeIncomingEdge
public void addIterativeIncomingEdge(IREdge edge)
Adds an iterative incoming edge, from the previous iteration, but connection internally.- Parameters:
edge
- edge to add.
-
getIterativeIncomingEdges
public java.util.Map<IRVertex,java.util.Set<IREdge>> getIterativeIncomingEdges()
- Returns:
- the iterative incoming edges inside the DAG.
-
removeIterativeIncomingEdge
public void removeIterativeIncomingEdge(IREdge edge)
Remove an iterative incoming edge.- Parameters:
edge
- edge to remove
-
addNonIterativeIncomingEdge
public void addNonIterativeIncomingEdge(IREdge edge)
Adds a non-iterative incoming edge, from outside the previous iteration.- Parameters:
edge
- edge to add.
-
getNonIterativeIncomingEdges
public java.util.Map<IRVertex,java.util.Set<IREdge>> getNonIterativeIncomingEdges()
- Returns:
- the non-iterative incoming edges of the LoopVertex.
-
removeNonIterativeIncomingEdge
public void removeNonIterativeIncomingEdge(IREdge edge)
Removes non iterative incoming edge.- Parameters:
edge
- edge to remove.
-
addDagOutgoingEdge
public void addDagOutgoingEdge(IREdge edge)
Adds and outgoing edge of the contained DAG.- Parameters:
edge
- edge to add.
-
getDagOutgoingEdges
public java.util.Map<IRVertex,java.util.Set<IREdge>> getDagOutgoingEdges()
- Returns:
- outgoing edges of the contained DAG.
-
removeDagOutgoingEdge
public void removeDagOutgoingEdge(IREdge edge)
Removes a dag outgoing edge.- Parameters:
edge
- edge to remove.
-
markDuplicateEdges
public void markDuplicateEdges()
Marks duplicate edges with DuplicateEdgeGroupProperty.
-
unRollIteration
public LoopVertex unRollIteration(DAGBuilder<IRVertex,IREdge> dagBuilder)
Method for unrolling an iteration of the LoopVertex. So basically, in the original place of a LoopVertex, it puts a clone of the sub-DAG that iterates, and appends the LoopVertex after that, until the termination condition has been met.- Parameters:
dagBuilder
- DAGBuilder to add the unrolled iteration to.- Returns:
- a LoopVertex with one less maximum iteration.
-
loopTerminationConditionMet
public java.lang.Boolean loopTerminationConditionMet()
- Returns:
- whether or not the loop termination condition has been met.
-
loopTerminationConditionMet
public java.lang.Boolean loopTerminationConditionMet(java.lang.Integer intPredicateInput)
- Parameters:
intPredicateInput
- input for the intPredicate of the loop termination condition.- Returns:
- whether or not the loop termination condition has been met.
-
setMaxNumberOfIterations
public void setMaxNumberOfIterations(java.lang.Integer maxNum)
Set the maximum number of iterations.- Parameters:
maxNum
- maximum number of iterations.
-
getTerminationCondition
public java.util.function.IntPredicate getTerminationCondition()
- Returns:
- termination condition int predicate.
-
getMaxNumberOfIterations
public java.lang.Integer getMaxNumberOfIterations()
- Returns:
- maximum number of iterations.
-
increaseMaxNumberOfIterations
public void increaseMaxNumberOfIterations()
increase the value of maximum number of iterations by 1.
-
decreaseMaxNumberOfIterations
protected void decreaseMaxNumberOfIterations()
decrease the value of maximum number of iterations by 1.
-
terminationConditionEquals
public boolean terminationConditionEquals(LoopVertex that)
Check termination condition.- Parameters:
that
- another vertex.- Returns:
- true if equals.
-
setTerminationCondition
public void setTerminationCondition(java.util.function.IntPredicate terminationCondition)
Set the intPredicate termination condition for the LoopVertex.- Parameters:
terminationCondition
- the termination condition to set.
-
getPropertiesAsJsonNode
public final com.fasterxml.jackson.databind.node.ObjectNode getPropertiesAsJsonNode()
Parse Properties to JsonNode.- Overrides:
getPropertiesAsJsonNode
in classVertex
- Returns:
- JSON representation of additional properties
-
-