Search in sources :

Example 26 with ExecutionState

use of org.apache.flink.runtime.execution.ExecutionState in project flink by apache.

the class WebMonitorUtils method createDetailsForJob.

public static JobDetails createDetailsForJob(AccessExecutionGraph job) {
    JobStatus status = job.getState();
    long started = job.getStatusTimestamp(JobStatus.CREATED);
    long finished = status.isGloballyTerminalState() ? job.getStatusTimestamp(status) : -1L;
    int[] countsPerStatus = new int[ExecutionState.values().length];
    long lastChanged = 0;
    int numTotalTasks = 0;
    for (AccessExecutionJobVertex ejv : job.getVerticesTopologically()) {
        AccessExecutionVertex[] vertices = ejv.getTaskVertices();
        numTotalTasks += vertices.length;
        for (AccessExecutionVertex vertex : vertices) {
            ExecutionState state = vertex.getExecutionState();
            countsPerStatus[state.ordinal()]++;
            lastChanged = Math.max(lastChanged, vertex.getStateTimestamp(state));
        }
    }
    lastChanged = Math.max(lastChanged, finished);
    return new JobDetails(job.getJobID(), job.getJobName(), started, finished, status, lastChanged, countsPerStatus, numTotalTasks);
}
Also used : JobStatus(org.apache.flink.runtime.jobgraph.JobStatus) AccessExecutionJobVertex(org.apache.flink.runtime.executiongraph.AccessExecutionJobVertex) ExecutionState(org.apache.flink.runtime.execution.ExecutionState) AccessExecutionVertex(org.apache.flink.runtime.executiongraph.AccessExecutionVertex) JobDetails(org.apache.flink.runtime.messages.webmonitor.JobDetails)

Aggregations

ExecutionState (org.apache.flink.runtime.execution.ExecutionState)26 Test (org.junit.Test)11 ResultPartitionID (org.apache.flink.runtime.io.network.partition.ResultPartitionID)6 TaskManagerLocation (org.apache.flink.runtime.taskmanager.TaskManagerLocation)6 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)5 IOException (java.io.IOException)5 StringWriter (java.io.StringWriter)5 TimeoutException (java.util.concurrent.TimeoutException)5 JobID (org.apache.flink.api.common.JobID)5 AccessExecutionVertex (org.apache.flink.runtime.executiongraph.AccessExecutionVertex)5 ExecutionAttemptID (org.apache.flink.runtime.executiongraph.ExecutionAttemptID)4 HashMap (java.util.HashMap)3 JobException (org.apache.flink.runtime.JobException)3 ResourceID (org.apache.flink.runtime.clusterframework.types.ResourceID)3 ExecutionVertex (org.apache.flink.runtime.executiongraph.ExecutionVertex)3 IntermediateResultPartition (org.apache.flink.runtime.executiongraph.IntermediateResultPartition)3 SimpleSlot (org.apache.flink.runtime.instance.SimpleSlot)3 ConnectionID (org.apache.flink.runtime.io.network.ConnectionID)3 IntermediateDataSetID (org.apache.flink.runtime.jobgraph.IntermediateDataSetID)3 MutableIOMetrics (org.apache.flink.runtime.webmonitor.utils.MutableIOMetrics)3