public class JobGraph extends Object implements Serializable
The JobGraph is a graph of vertices and intermediate results that are connected together to form a DAG. Note that iterations (feedback edges) are currently not encoded inside the JobGraph but inside certain special vertices that establish the feedback channel amongst themselves.
The JobGraph defines the job-wide configuration settings, while each vertex and intermediate result define the characteristics of the concrete operation and intermediate data.
| Constructor and Description |
|---|
JobGraph()
Constructs a new job graph with no name and a random job ID.
|
JobGraph(org.apache.flink.api.common.JobID jobId,
String jobName)
Constructs a new job graph with the given name and a random job ID.
|
JobGraph(org.apache.flink.api.common.JobID jobId,
String jobName,
JobVertex... vertices)
Constructs a new job graph with the given name and a random job ID.
|
JobGraph(JobVertex... vertices)
Constructs a new job graph with no name and a random job ID.
|
JobGraph(String jobName)
Constructs a new job graph with the given name and a random job ID.
|
JobGraph(String jobName,
JobVertex... vertices)
Constructs a new job graph with the given name and a random job ID.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addBlob(BlobKey key)
Adds the BLOB referenced by the key to the JobGraph's dependencies.
|
void |
addJar(org.apache.flink.core.fs.Path jar)
Adds the path of a JAR file required to run the job on a task manager.
|
void |
addVertex(JobVertex vertex)
Adds a new task vertex to the job graph if it is not already included.
|
JobVertex |
findVertexByID(JobVertexID id)
Searches for a vertex with a matching ID and returns it.
|
boolean |
getAllowQueuedScheduling() |
org.apache.flink.configuration.Configuration |
getJobConfiguration()
Returns the configuration object for this job if it is set.
|
org.apache.flink.api.common.JobID |
getJobID()
Returns the ID of the job.
|
String |
getName()
Returns the name assigned to the job graph.
|
int |
getNumberOfExecutionRetries()
Gets the number of times the system will try to re-execute failed tasks.
|
int |
getNumberOfVertices()
Returns the number of all vertices.
|
ScheduleMode |
getScheduleMode() |
JobSnapshottingSettings |
getSnapshotSettings()
Gets the settings for asynchronous snapshots.
|
List<BlobKey> |
getUserJarBlobKeys()
Returns a set of BLOB keys referring to the JAR files required to run this job.
|
Iterable<JobVertex> |
getVertices()
Returns an Iterable to iterate all vertices registered with the job graph.
|
JobVertex[] |
getVerticesAsArray()
Returns an array of all job vertices that are registered with the job graph.
|
List<JobVertex> |
getVerticesSortedTopologicallyFromSources() |
boolean |
hasUsercodeJarFiles()
Checks whether the JobGraph has user code JAR files attached.
|
void |
setAllowQueuedScheduling(boolean allowQueuedScheduling) |
void |
setNumberOfExecutionRetries(int numberOfExecutionRetries)
Sets the number of times that failed tasks are re-executed.
|
void |
setScheduleMode(ScheduleMode scheduleMode) |
void |
setSnapshotSettings(JobSnapshottingSettings settings)
Sets the settings for asynchronous snapshots.
|
void |
uploadRequiredJarFiles(InetSocketAddress serverAddress)
Uploads the previously added user jar file to the job manager through the job manager's BLOB server.
|
public JobGraph()
public JobGraph(String jobName)
jobName - The name of the jobpublic JobGraph(org.apache.flink.api.common.JobID jobId,
String jobName)
jobId - The id of the jobjobName - The name of the jobpublic JobGraph(JobVertex... vertices)
vertices - The vertices to add to the graph.public JobGraph(String jobName, JobVertex... vertices)
jobName - The name of the job.vertices - The vertices to add to the graph.public org.apache.flink.api.common.JobID getJobID()
public String getName()
public org.apache.flink.configuration.Configuration getJobConfiguration()
null if it is not setpublic void setNumberOfExecutionRetries(int numberOfExecutionRetries)
-1 indicates that the system
default value (as defined in the configuration) should be used.numberOfExecutionRetries - The number of times the system will try to re-execute failed tasks.public int getNumberOfExecutionRetries()
-1 indicates that the system default value (as defined in the configuration)
should be used.public void setAllowQueuedScheduling(boolean allowQueuedScheduling)
public boolean getAllowQueuedScheduling()
public void setScheduleMode(ScheduleMode scheduleMode)
public ScheduleMode getScheduleMode()
public void addVertex(JobVertex vertex)
vertex - the new task vertex to be addedpublic Iterable<JobVertex> getVertices()
public JobVertex[] getVerticesAsArray()
public int getNumberOfVertices()
public void setSnapshotSettings(JobSnapshottingSettings settings)
null means that
snapshotting is not enabled.settings - The snapshot settings, or null, to disable snapshotting.public JobSnapshottingSettings getSnapshotSettings()
public JobVertex findVertexByID(JobVertexID id)
id - the ID of the vertex to search fornull if no vertex with such ID could be foundpublic List<JobVertex> getVerticesSortedTopologicallyFromSources() throws org.apache.flink.api.common.InvalidProgramException
org.apache.flink.api.common.InvalidProgramExceptionpublic void addJar(org.apache.flink.core.fs.Path jar)
jar - path of the JAR file required to run the job on a task managerpublic void addBlob(BlobKey key)
key - path of the JAR file required to run the job on a task managerpublic boolean hasUsercodeJarFiles()
public List<BlobKey> getUserJarBlobKeys()
public void uploadRequiredJarFiles(InetSocketAddress serverAddress) throws IOException
serverAddress - the network address of the BLOB serverIOException - thrown if an I/O error occurs during the uploadCopyright © 2014–2015 The Apache Software Foundation. All rights reserved.