Java Code Examples for org.apache.flink.runtime.executiongraph.AccessExecutionGraph#isStoppable()

The following examples show how to use org.apache.flink.runtime.executiongraph.AccessExecutionGraph#isStoppable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobDetailsHandler.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private static JobDetailsInfo createJobDetailsInfo(AccessExecutionGraph executionGraph, @Nullable MetricFetcher metricFetcher) {
	final long now = System.currentTimeMillis();
	final long startTime = executionGraph.getStatusTimestamp(JobStatus.CREATED);
	final long endTime = executionGraph.getState().isGloballyTerminalState() ?
		executionGraph.getStatusTimestamp(executionGraph.getState()) : -1L;
	final long duration = (endTime > 0L ? endTime : now) - startTime;

	final Map<JobStatus, Long> timestamps = new HashMap<>(JobStatus.values().length);

	for (JobStatus jobStatus : JobStatus.values()) {
		timestamps.put(jobStatus, executionGraph.getStatusTimestamp(jobStatus));
	}

	Collection<JobDetailsInfo.JobVertexDetailsInfo> jobVertexInfos = new ArrayList<>(executionGraph.getAllVertices().size());
	int[] jobVerticesPerState = new int[ExecutionState.values().length];

	for (AccessExecutionJobVertex accessExecutionJobVertex : executionGraph.getVerticesTopologically()) {
		final JobDetailsInfo.JobVertexDetailsInfo vertexDetailsInfo = createJobVertexDetailsInfo(
			accessExecutionJobVertex,
			now,
			executionGraph.getJobID(),
			metricFetcher);

		jobVertexInfos.add(vertexDetailsInfo);
		jobVerticesPerState[vertexDetailsInfo.getExecutionState().ordinal()]++;
	}

	Map<ExecutionState, Integer> jobVerticesPerStateMap = new HashMap<>(ExecutionState.values().length);

	for (ExecutionState executionState : ExecutionState.values()) {
		jobVerticesPerStateMap.put(executionState, jobVerticesPerState[executionState.ordinal()]);
	}

	return new JobDetailsInfo(
		executionGraph.getJobID(),
		executionGraph.getJobName(),
		executionGraph.isStoppable(),
		executionGraph.getState(),
		startTime,
		endTime,
		duration,
		now,
		timestamps,
		jobVertexInfos,
		jobVerticesPerStateMap,
		executionGraph.getJsonPlan());
}
 
Example 2
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
private static JobDetailsInfo createJobDetailsInfo(AccessExecutionGraph executionGraph, @Nullable MetricFetcher metricFetcher) {
	final long now = System.currentTimeMillis();
	final long startTime = executionGraph.getStatusTimestamp(JobStatus.CREATED);
	final long endTime = executionGraph.getState().isGloballyTerminalState() ?
		executionGraph.getStatusTimestamp(executionGraph.getState()) : -1L;
	final long duration = (endTime > 0L ? endTime : now) - startTime;

	final Map<JobStatus, Long> timestamps = new HashMap<>(JobStatus.values().length);

	for (JobStatus jobStatus : JobStatus.values()) {
		timestamps.put(jobStatus, executionGraph.getStatusTimestamp(jobStatus));
	}

	Collection<JobDetailsInfo.JobVertexDetailsInfo> jobVertexInfos = new ArrayList<>(executionGraph.getAllVertices().size());
	int[] jobVerticesPerState = new int[ExecutionState.values().length];

	for (AccessExecutionJobVertex accessExecutionJobVertex : executionGraph.getVerticesTopologically()) {
		final JobDetailsInfo.JobVertexDetailsInfo vertexDetailsInfo = createJobVertexDetailsInfo(
			accessExecutionJobVertex,
			now,
			executionGraph.getJobID(),
			metricFetcher);

		jobVertexInfos.add(vertexDetailsInfo);
		jobVerticesPerState[vertexDetailsInfo.getExecutionState().ordinal()]++;
	}

	Map<ExecutionState, Integer> jobVerticesPerStateMap = new HashMap<>(ExecutionState.values().length);

	for (ExecutionState executionState : ExecutionState.values()) {
		jobVerticesPerStateMap.put(executionState, jobVerticesPerState[executionState.ordinal()]);
	}

	return new JobDetailsInfo(
		executionGraph.getJobID(),
		executionGraph.getJobName(),
		executionGraph.isStoppable(),
		executionGraph.getState(),
		startTime,
		endTime,
		duration,
		now,
		timestamps,
		jobVertexInfos,
		jobVerticesPerStateMap,
		executionGraph.getJsonPlan());
}
 
Example 3
Source File: JobDetailsHandler.java    From flink with Apache License 2.0 4 votes vote down vote up
private static JobDetailsInfo createJobDetailsInfo(AccessExecutionGraph executionGraph, @Nullable MetricFetcher metricFetcher) {
	final long now = System.currentTimeMillis();
	final long startTime = executionGraph.getStatusTimestamp(JobStatus.CREATED);
	final long endTime = executionGraph.getState().isGloballyTerminalState() ?
		executionGraph.getStatusTimestamp(executionGraph.getState()) : -1L;
	final long duration = (endTime > 0L ? endTime : now) - startTime;

	final Map<JobStatus, Long> timestamps = new HashMap<>(JobStatus.values().length);

	for (JobStatus jobStatus : JobStatus.values()) {
		timestamps.put(jobStatus, executionGraph.getStatusTimestamp(jobStatus));
	}

	Collection<JobDetailsInfo.JobVertexDetailsInfo> jobVertexInfos = new ArrayList<>(executionGraph.getAllVertices().size());
	int[] jobVerticesPerState = new int[ExecutionState.values().length];

	for (AccessExecutionJobVertex accessExecutionJobVertex : executionGraph.getVerticesTopologically()) {
		final JobDetailsInfo.JobVertexDetailsInfo vertexDetailsInfo = createJobVertexDetailsInfo(
			accessExecutionJobVertex,
			now,
			executionGraph.getJobID(),
			metricFetcher);

		jobVertexInfos.add(vertexDetailsInfo);
		jobVerticesPerState[vertexDetailsInfo.getExecutionState().ordinal()]++;
	}

	Map<ExecutionState, Integer> jobVerticesPerStateMap = new HashMap<>(ExecutionState.values().length);

	for (ExecutionState executionState : ExecutionState.values()) {
		jobVerticesPerStateMap.put(executionState, jobVerticesPerState[executionState.ordinal()]);
	}

	return new JobDetailsInfo(
		executionGraph.getJobID(),
		executionGraph.getJobName(),
		executionGraph.isStoppable(),
		executionGraph.getState(),
		startTime,
		endTime,
		duration,
		now,
		timestamps,
		jobVertexInfos,
		jobVerticesPerStateMap,
		executionGraph.getJsonPlan());
}