org.apache.flink.runtime.rest.messages.job.metrics.IOMetricsInfo Java Examples

The following examples show how to use org.apache.flink.runtime.rest.messages.job.metrics.IOMetricsInfo. 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 Project: Flink-CEPplus   Author: ljygz   File: JobVertexDetailsInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public VertexTaskDetail(
		@JsonProperty(FIELD_NAME_SUBTASK) int subtask,
		@JsonProperty(FIELD_NAME_STATUS) ExecutionState status,
		@JsonProperty(FIELD_NAME_ATTEMPT) int attempt,
		@JsonProperty(FIELD_NAME_HOST) String host,
		@JsonProperty(FIELD_NAME_START_TIME) long startTime,
		@JsonProperty(FIELD_NAME_END_TIME) long endTime,
		@JsonProperty(FIELD_NAME_DURATION) long duration,
		@JsonProperty(FIELD_NAME_METRICS) IOMetricsInfo metrics) {
	this.subtask = subtask;
	this.status = checkNotNull(status);
	this.attempt = attempt;
	this.host = checkNotNull(host);
	this.startTime = startTime;
	this.startTimeCompatible = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.metrics = checkNotNull(metrics);
}
 
Example #2
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskExecutionAttemptDetailsInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public SubtaskExecutionAttemptDetailsInfo(
		@JsonProperty(FIELD_NAME_SUBTASK_INDEX) int subtaskIndex,
		@JsonProperty(FIELD_NAME_STATUS) ExecutionState status,
		@JsonProperty(FIELD_NAME_ATTEMPT) int attempt,
		@JsonProperty(FIELD_NAME_HOST) String host,
		@JsonProperty(FIELD_NAME_START_TIME) long startTime,
		@JsonProperty(FIELD_NAME_END_TIME) long endTime,
		@JsonProperty(FIELD_NAME_DURATION) long duration,
		@JsonProperty(FIELD_NAME_METRICS) IOMetricsInfo ioMetricsInfo) {

	this.subtaskIndex = subtaskIndex;
	this.status = Preconditions.checkNotNull(status);
	this.attempt = attempt;
	this.host = Preconditions.checkNotNull(host);
	this.startTime = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.ioMetricsInfo = Preconditions.checkNotNull(ioMetricsInfo);
}
 
Example #3
Source Project: Flink-CEPplus   Author: ljygz   File: JobDetailsInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public JobVertexDetailsInfo(
		@JsonDeserialize(using = JobVertexIDDeserializer.class) @JsonProperty(FIELD_NAME_JOB_VERTEX_ID) JobVertexID jobVertexID,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_NAME) String name,
		@JsonProperty(FIELD_NAME_PARALLELISM) int parallelism,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_STATE) ExecutionState executionState,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_START_TIME) long startTime,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_END_TIME) long endTime,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_DURATION) long duration,
		@JsonProperty(FIELD_NAME_TASKS_PER_STATE) Map<ExecutionState, Integer> tasksPerState,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_METRICS) IOMetricsInfo jobVertexMetrics) {
	this.jobVertexID = Preconditions.checkNotNull(jobVertexID);
	this.name = Preconditions.checkNotNull(name);
	this.parallelism = parallelism;
	this.executionState = Preconditions.checkNotNull(executionState);
	this.startTime = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.tasksPerState = Preconditions.checkNotNull(tasksPerState);
	this.jobVertexMetrics = Preconditions.checkNotNull(jobVertexMetrics);
}
 
Example #4
Source Project: Flink-CEPplus   Author: ljygz   File: JobVertexTaskManagersInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public TaskManagersInfo(
		@JsonProperty(TASK_MANAGERS_FIELD_HOST) String host,
		@JsonProperty(TASK_MANAGERS_FIELD_STATUS) ExecutionState status,
		@JsonProperty(TASK_MANAGERS_FIELD_START_TIME) long startTime,
		@JsonProperty(TASK_MANAGERS_FIELD_END_TIME) long endTime,
		@JsonProperty(TASK_MANAGERS_FIELD_DURATION) long duration,
		@JsonProperty(TASK_MANAGERS_FIELD_METRICS) IOMetricsInfo metrics,
		@JsonProperty(TASK_MANAGERS_FIELD_STATUS_COUNTS) Map<ExecutionState, Integer> statusCounts) {
	this.host = checkNotNull(host);
	this.status = checkNotNull(status);
	this.startTime = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.metrics = checkNotNull(metrics);
	this.statusCounts = checkNotNull(statusCounts);
}
 
Example #5
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskExecutionAttemptDetailsInfoTest.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected SubtaskExecutionAttemptDetailsInfo getTestResponseInstance() throws Exception {
	final Random random = new Random();

	final IOMetricsInfo ioMetricsInfo = new IOMetricsInfo(
		Math.abs(random.nextLong()),
		random.nextBoolean(),
		Math.abs(random.nextLong()),
		random.nextBoolean(),
		Math.abs(random.nextLong()),
		random.nextBoolean(),
		Math.abs(random.nextLong()),
		random.nextBoolean()
	);

	return new SubtaskExecutionAttemptDetailsInfo(
		Math.abs(random.nextInt()),
		ExecutionState.values()[random.nextInt(ExecutionState.values().length)],
		Math.abs(random.nextInt()),
		"localhost:" + random.nextInt(65536),
		Math.abs(random.nextLong()),
		Math.abs(random.nextLong()),
		Math.abs(random.nextLong()),
		ioMetricsInfo
	);
}
 
Example #6
Source Project: Flink-CEPplus   Author: ljygz   File: JobVertexTaskManagersInfoTest.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected JobVertexTaskManagersInfo getTestResponseInstance() throws Exception {
	final Random random = new Random();
	List<TaskManagersInfo> taskManagersInfoList = new ArrayList<>();

	final Map<ExecutionState, Integer> statusCounts = new HashMap<>(ExecutionState.values().length);
	final IOMetricsInfo jobVertexMetrics = new IOMetricsInfo(
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean());
	int count = 100;
	for (ExecutionState executionState : ExecutionState.values()) {
		statusCounts.put(executionState, count++);
	}
	taskManagersInfoList.add(new TaskManagersInfo("host1", ExecutionState.CANCELING, 1L, 2L, 3L, jobVertexMetrics, statusCounts));

	return new JobVertexTaskManagersInfo(new JobVertexID(), "test", System.currentTimeMillis(), taskManagersInfoList);
}
 
Example #7
Source Project: flink   Author: flink-tpc-ds   File: JobVertexDetailsInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public VertexTaskDetail(
		@JsonProperty(FIELD_NAME_SUBTASK) int subtask,
		@JsonProperty(FIELD_NAME_STATUS) ExecutionState status,
		@JsonProperty(FIELD_NAME_ATTEMPT) int attempt,
		@JsonProperty(FIELD_NAME_HOST) String host,
		@JsonProperty(FIELD_NAME_START_TIME) long startTime,
		@JsonProperty(FIELD_NAME_END_TIME) long endTime,
		@JsonProperty(FIELD_NAME_DURATION) long duration,
		@JsonProperty(FIELD_NAME_METRICS) IOMetricsInfo metrics) {
	this.subtask = subtask;
	this.status = checkNotNull(status);
	this.attempt = attempt;
	this.host = checkNotNull(host);
	this.startTime = startTime;
	this.startTimeCompatible = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.metrics = checkNotNull(metrics);
}
 
Example #8
Source Project: flink   Author: flink-tpc-ds   File: SubtaskExecutionAttemptDetailsInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public SubtaskExecutionAttemptDetailsInfo(
		@JsonProperty(FIELD_NAME_SUBTASK_INDEX) int subtaskIndex,
		@JsonProperty(FIELD_NAME_STATUS) ExecutionState status,
		@JsonProperty(FIELD_NAME_ATTEMPT) int attempt,
		@JsonProperty(FIELD_NAME_HOST) String host,
		@JsonProperty(FIELD_NAME_START_TIME) long startTime,
		@JsonProperty(FIELD_NAME_END_TIME) long endTime,
		@JsonProperty(FIELD_NAME_DURATION) long duration,
		@JsonProperty(FIELD_NAME_METRICS) IOMetricsInfo ioMetricsInfo) {

	this.subtaskIndex = subtaskIndex;
	this.status = Preconditions.checkNotNull(status);
	this.attempt = attempt;
	this.host = Preconditions.checkNotNull(host);
	this.startTime = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.ioMetricsInfo = Preconditions.checkNotNull(ioMetricsInfo);
}
 
Example #9
Source Project: flink   Author: flink-tpc-ds   File: JobDetailsInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public JobVertexDetailsInfo(
		@JsonDeserialize(using = JobVertexIDDeserializer.class) @JsonProperty(FIELD_NAME_JOB_VERTEX_ID) JobVertexID jobVertexID,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_NAME) String name,
		@JsonProperty(FIELD_NAME_PARALLELISM) int parallelism,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_STATE) ExecutionState executionState,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_START_TIME) long startTime,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_END_TIME) long endTime,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_DURATION) long duration,
		@JsonProperty(FIELD_NAME_TASKS_PER_STATE) Map<ExecutionState, Integer> tasksPerState,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_METRICS) IOMetricsInfo jobVertexMetrics) {
	this.jobVertexID = Preconditions.checkNotNull(jobVertexID);
	this.name = Preconditions.checkNotNull(name);
	this.parallelism = parallelism;
	this.executionState = Preconditions.checkNotNull(executionState);
	this.startTime = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.tasksPerState = Preconditions.checkNotNull(tasksPerState);
	this.jobVertexMetrics = Preconditions.checkNotNull(jobVertexMetrics);
}
 
Example #10
Source Project: flink   Author: flink-tpc-ds   File: JobVertexTaskManagersInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public TaskManagersInfo(
		@JsonProperty(TASK_MANAGERS_FIELD_HOST) String host,
		@JsonProperty(TASK_MANAGERS_FIELD_STATUS) ExecutionState status,
		@JsonProperty(TASK_MANAGERS_FIELD_START_TIME) long startTime,
		@JsonProperty(TASK_MANAGERS_FIELD_END_TIME) long endTime,
		@JsonProperty(TASK_MANAGERS_FIELD_DURATION) long duration,
		@JsonProperty(TASK_MANAGERS_FIELD_METRICS) IOMetricsInfo metrics,
		@JsonProperty(TASK_MANAGERS_FIELD_STATUS_COUNTS) Map<ExecutionState, Integer> statusCounts) {
	this.host = checkNotNull(host);
	this.status = checkNotNull(status);
	this.startTime = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.metrics = checkNotNull(metrics);
	this.statusCounts = checkNotNull(statusCounts);
}
 
Example #11
Source Project: flink   Author: flink-tpc-ds   File: SubtaskExecutionAttemptDetailsInfoTest.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected SubtaskExecutionAttemptDetailsInfo getTestResponseInstance() throws Exception {
	final Random random = new Random();

	final IOMetricsInfo ioMetricsInfo = new IOMetricsInfo(
		Math.abs(random.nextLong()),
		random.nextBoolean(),
		Math.abs(random.nextLong()),
		random.nextBoolean(),
		Math.abs(random.nextLong()),
		random.nextBoolean(),
		Math.abs(random.nextLong()),
		random.nextBoolean()
	);

	return new SubtaskExecutionAttemptDetailsInfo(
		Math.abs(random.nextInt()),
		ExecutionState.values()[random.nextInt(ExecutionState.values().length)],
		Math.abs(random.nextInt()),
		"localhost:" + random.nextInt(65536),
		Math.abs(random.nextLong()),
		Math.abs(random.nextLong()),
		Math.abs(random.nextLong()),
		ioMetricsInfo
	);
}
 
Example #12
Source Project: flink   Author: flink-tpc-ds   File: JobVertexTaskManagersInfoTest.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected JobVertexTaskManagersInfo getTestResponseInstance() throws Exception {
	final Random random = new Random();
	List<TaskManagersInfo> taskManagersInfoList = new ArrayList<>();

	final Map<ExecutionState, Integer> statusCounts = new HashMap<>(ExecutionState.values().length);
	final IOMetricsInfo jobVertexMetrics = new IOMetricsInfo(
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean());
	int count = 100;
	for (ExecutionState executionState : ExecutionState.values()) {
		statusCounts.put(executionState, count++);
	}
	taskManagersInfoList.add(new TaskManagersInfo("host1", ExecutionState.CANCELING, 1L, 2L, 3L, jobVertexMetrics, statusCounts));

	return new JobVertexTaskManagersInfo(new JobVertexID(), "test", System.currentTimeMillis(), taskManagersInfoList);
}
 
Example #13
Source Project: flink   Author: apache   File: SubtaskExecutionAttemptDetailsInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public SubtaskExecutionAttemptDetailsInfo(
		@JsonProperty(FIELD_NAME_SUBTASK_INDEX) int subtaskIndex,
		@JsonProperty(FIELD_NAME_STATUS) ExecutionState status,
		@JsonProperty(FIELD_NAME_ATTEMPT) int attempt,
		@JsonProperty(FIELD_NAME_HOST) String host,
		@JsonProperty(FIELD_NAME_START_TIME) long startTime,
		@JsonProperty(FIELD_NAME_END_TIME) long endTime,
		@JsonProperty(FIELD_NAME_DURATION) long duration,
		@JsonProperty(FIELD_NAME_METRICS) IOMetricsInfo ioMetricsInfo,
		@JsonProperty(FIELD_NAME_TASKMANAGER_ID) String taskmanagerId) {

	this.subtaskIndex = subtaskIndex;
	this.status = Preconditions.checkNotNull(status);
	this.attempt = attempt;
	this.host = Preconditions.checkNotNull(host);
	this.startTime = startTime;
	this.startTimeCompatible = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.ioMetricsInfo = Preconditions.checkNotNull(ioMetricsInfo);
	this.taskmanagerId = Preconditions.checkNotNull(taskmanagerId);
}
 
Example #14
Source Project: flink   Author: apache   File: JobDetailsInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public JobVertexDetailsInfo(
		@JsonDeserialize(using = JobVertexIDDeserializer.class) @JsonProperty(FIELD_NAME_JOB_VERTEX_ID) JobVertexID jobVertexID,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_NAME) String name,
		@JsonProperty(FIELD_NAME_PARALLELISM) int parallelism,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_STATE) ExecutionState executionState,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_START_TIME) long startTime,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_END_TIME) long endTime,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_DURATION) long duration,
		@JsonProperty(FIELD_NAME_TASKS_PER_STATE) Map<ExecutionState, Integer> tasksPerState,
		@JsonProperty(FIELD_NAME_JOB_VERTEX_METRICS) IOMetricsInfo jobVertexMetrics) {
	this.jobVertexID = Preconditions.checkNotNull(jobVertexID);
	this.name = Preconditions.checkNotNull(name);
	this.parallelism = parallelism;
	this.executionState = Preconditions.checkNotNull(executionState);
	this.startTime = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.tasksPerState = Preconditions.checkNotNull(tasksPerState);
	this.jobVertexMetrics = Preconditions.checkNotNull(jobVertexMetrics);
}
 
Example #15
Source Project: flink   Author: apache   File: JobVertexTaskManagersInfo.java    License: Apache License 2.0 6 votes vote down vote up
@JsonCreator
public TaskManagersInfo(
		@JsonProperty(TASK_MANAGERS_FIELD_HOST) String host,
		@JsonProperty(TASK_MANAGERS_FIELD_STATUS) ExecutionState status,
		@JsonProperty(TASK_MANAGERS_FIELD_START_TIME) long startTime,
		@JsonProperty(TASK_MANAGERS_FIELD_END_TIME) long endTime,
		@JsonProperty(TASK_MANAGERS_FIELD_DURATION) long duration,
		@JsonProperty(TASK_MANAGERS_FIELD_METRICS) IOMetricsInfo metrics,
		@JsonProperty(TASK_MANAGERS_FIELD_STATUS_COUNTS) Map<ExecutionState, Integer> statusCounts,
		@JsonProperty(TASK_MANAGERS_FIELD_TASKMANAGER_ID) String taskmanagerId) {
	this.host = checkNotNull(host);
	this.status = checkNotNull(status);
	this.startTime = startTime;
	this.endTime = endTime;
	this.duration = duration;
	this.metrics = checkNotNull(metrics);
	this.statusCounts = checkNotNull(statusCounts);
	this.taskmanagerId = taskmanagerId;
}
 
Example #16
Source Project: flink   Author: apache   File: JobVertexTaskManagersInfoTest.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected JobVertexTaskManagersInfo getTestResponseInstance() throws Exception {
	final Random random = new Random();
	List<TaskManagersInfo> taskManagersInfoList = new ArrayList<>();

	final Map<ExecutionState, Integer> statusCounts = new HashMap<>(ExecutionState.values().length);
	final IOMetricsInfo jobVertexMetrics = new IOMetricsInfo(
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean());
	int count = 100;
	for (ExecutionState executionState : ExecutionState.values()) {
		statusCounts.put(executionState, count++);
	}
	taskManagersInfoList.add(new TaskManagersInfo("host1", ExecutionState.CANCELING, 1L, 2L, 3L, jobVertexMetrics, statusCounts, "taskmanagerId"));

	return new JobVertexTaskManagersInfo(new JobVertexID(), "test", System.currentTimeMillis(), taskManagersInfoList);
}
 
Example #17
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskExecutionAttemptDetailsInfo.java    License: Apache License 2.0 5 votes vote down vote up
public static SubtaskExecutionAttemptDetailsInfo create(AccessExecution execution, MutableIOMetrics ioMetrics) {
	final ExecutionState status = execution.getState();
	final long now = System.currentTimeMillis();

	final TaskManagerLocation location = execution.getAssignedResourceLocation();
	final String locationString = location == null ? "(unassigned)" : location.getHostname();

	long startTime = execution.getStateTimestamp(ExecutionState.DEPLOYING);
	if (startTime == 0) {
		startTime = -1;
	}
	final long endTime = status.isTerminal() ? execution.getStateTimestamp(status) : -1;
	final long duration = startTime > 0 ? ((endTime > 0 ? endTime : now) - startTime) : -1;

	final IOMetricsInfo ioMetricsInfo = new IOMetricsInfo(
		ioMetrics.getNumBytesInLocal() + ioMetrics.getNumBytesInRemote(),
		ioMetrics.isNumBytesInLocalComplete() && ioMetrics.isNumBytesInRemoteComplete(),
		ioMetrics.getNumBytesOut(),
		ioMetrics.isNumBytesOutComplete(),
		ioMetrics.getNumRecordsIn(),
		ioMetrics.isNumRecordsInComplete(),
		ioMetrics.getNumRecordsOut(),
		ioMetrics.isNumRecordsOutComplete());

	return new SubtaskExecutionAttemptDetailsInfo(
		execution.getParallelSubtaskIndex(),
		status,
		execution.getAttemptNumber(),
		locationString,
		startTime,
		endTime,
		duration,
		ioMetricsInfo
	);
}
 
Example #18
Source Project: Flink-CEPplus   Author: ljygz   File: JobDetailsInfoTest.java    License: Apache License 2.0 5 votes vote down vote up
private JobDetailsInfo.JobVertexDetailsInfo createJobVertexDetailsInfo(Random random) {
	final Map<ExecutionState, Integer> tasksPerState = new HashMap<>(ExecutionState.values().length);
	final IOMetricsInfo jobVertexMetrics = new IOMetricsInfo(
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean());

	for (ExecutionState executionState : ExecutionState.values()) {
		tasksPerState.put(executionState, random.nextInt());
	}

	return new JobDetailsInfo.JobVertexDetailsInfo(
		new JobVertexID(),
		"jobVertex" + random.nextLong(),
		random.nextInt(),
		ExecutionState.values()[random.nextInt(ExecutionState.values().length)],
		random.nextLong(),
		random.nextLong(),
		random.nextLong(),
		tasksPerState,
		jobVertexMetrics);
}
 
Example #19
Source Project: flink   Author: flink-tpc-ds   File: SubtaskExecutionAttemptDetailsInfo.java    License: Apache License 2.0 5 votes vote down vote up
public static SubtaskExecutionAttemptDetailsInfo create(AccessExecution execution, MutableIOMetrics ioMetrics) {
	final ExecutionState status = execution.getState();
	final long now = System.currentTimeMillis();

	final TaskManagerLocation location = execution.getAssignedResourceLocation();
	final String locationString = location == null ? "(unassigned)" : location.getHostname();

	long startTime = execution.getStateTimestamp(ExecutionState.DEPLOYING);
	if (startTime == 0) {
		startTime = -1;
	}
	final long endTime = status.isTerminal() ? execution.getStateTimestamp(status) : -1;
	final long duration = startTime > 0 ? ((endTime > 0 ? endTime : now) - startTime) : -1;

	final IOMetricsInfo ioMetricsInfo = new IOMetricsInfo(
		ioMetrics.getNumBytesIn(),
		ioMetrics.isNumBytesInComplete(),
		ioMetrics.getNumBytesOut(),
		ioMetrics.isNumBytesOutComplete(),
		ioMetrics.getNumRecordsIn(),
		ioMetrics.isNumRecordsInComplete(),
		ioMetrics.getNumRecordsOut(),
		ioMetrics.isNumRecordsOutComplete());

	return new SubtaskExecutionAttemptDetailsInfo(
		execution.getParallelSubtaskIndex(),
		status,
		execution.getAttemptNumber(),
		locationString,
		startTime,
		endTime,
		duration,
		ioMetricsInfo
	);
}
 
Example #20
Source Project: flink   Author: flink-tpc-ds   File: JobDetailsInfoTest.java    License: Apache License 2.0 5 votes vote down vote up
private JobDetailsInfo.JobVertexDetailsInfo createJobVertexDetailsInfo(Random random) {
	final Map<ExecutionState, Integer> tasksPerState = new HashMap<>(ExecutionState.values().length);
	final IOMetricsInfo jobVertexMetrics = new IOMetricsInfo(
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean());

	for (ExecutionState executionState : ExecutionState.values()) {
		tasksPerState.put(executionState, random.nextInt());
	}

	return new JobDetailsInfo.JobVertexDetailsInfo(
		new JobVertexID(),
		"jobVertex" + random.nextLong(),
		random.nextInt(),
		ExecutionState.values()[random.nextInt(ExecutionState.values().length)],
		random.nextLong(),
		random.nextLong(),
		random.nextLong(),
		tasksPerState,
		jobVertexMetrics);
}
 
Example #21
Source Project: flink   Author: apache   File: SubtaskExecutionAttemptDetailsInfoTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected SubtaskExecutionAttemptDetailsInfo getTestResponseInstance() throws Exception {
	final Random random = new Random();

	final IOMetricsInfo ioMetricsInfo = new IOMetricsInfo(
		Math.abs(random.nextLong()),
		random.nextBoolean(),
		Math.abs(random.nextLong()),
		random.nextBoolean(),
		Math.abs(random.nextLong()),
		random.nextBoolean(),
		Math.abs(random.nextLong()),
		random.nextBoolean()
	);

	return new SubtaskExecutionAttemptDetailsInfo(
		Math.abs(random.nextInt()),
		ExecutionState.values()[random.nextInt(ExecutionState.values().length)],
		Math.abs(random.nextInt()),
		"localhost:" + random.nextInt(65536),
		Math.abs(random.nextLong()),
		Math.abs(random.nextLong()),
		Math.abs(random.nextLong()),
		ioMetricsInfo,
		"taskmanagerId"
	);
}
 
Example #22
Source Project: flink   Author: apache   File: JobDetailsInfoTest.java    License: Apache License 2.0 5 votes vote down vote up
private JobDetailsInfo.JobVertexDetailsInfo createJobVertexDetailsInfo(Random random) {
	final Map<ExecutionState, Integer> tasksPerState = new HashMap<>(ExecutionState.values().length);
	final IOMetricsInfo jobVertexMetrics = new IOMetricsInfo(
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean());

	for (ExecutionState executionState : ExecutionState.values()) {
		tasksPerState.put(executionState, random.nextInt());
	}

	return new JobDetailsInfo.JobVertexDetailsInfo(
		new JobVertexID(),
		"jobVertex" + random.nextLong(),
		random.nextInt(),
		ExecutionState.values()[random.nextInt(ExecutionState.values().length)],
		random.nextLong(),
		random.nextLong(),
		random.nextLong(),
		tasksPerState,
		jobVertexMetrics);
}
 
Example #23
Source Project: Flink-CEPplus   Author: ljygz   File: SubtaskExecutionAttemptDetailsInfo.java    License: Apache License 2.0 4 votes vote down vote up
public IOMetricsInfo getIoMetricsInfo() {
	return ioMetricsInfo;
}
 
Example #24
Source Project: Flink-CEPplus   Author: ljygz   File: JobDetailsInfo.java    License: Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public IOMetricsInfo getJobVertexMetrics() {
	return jobVertexMetrics;
}
 
Example #25
Source Project: Flink-CEPplus   Author: ljygz   File: JobVertexDetailsHandler.java    License: Apache License 2.0 4 votes vote down vote up
private static JobVertexDetailsInfo createJobVertexDetailsInfo(AccessExecutionJobVertex jobVertex, JobID jobID, @Nullable MetricFetcher metricFetcher) {
	List<JobVertexDetailsInfo.VertexTaskDetail> subtasks = new ArrayList<>();
	final long now = System.currentTimeMillis();
	int num = 0;
	for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) {
		final ExecutionState status = vertex.getExecutionState();

		TaskManagerLocation location = vertex.getCurrentAssignedResourceLocation();
		String locationString = location == null ? "(unassigned)" : location.getHostname() + ":" + location.dataPort();

		long startTime = vertex.getStateTimestamp(ExecutionState.DEPLOYING);
		if (startTime == 0) {
			startTime = -1;
		}
		long endTime = status.isTerminal() ? vertex.getStateTimestamp(status) : -1;
		long duration = startTime > 0 ? ((endTime > 0 ? endTime : now) - startTime) : -1;

		MutableIOMetrics counts = new MutableIOMetrics();
		counts.addIOMetrics(
			vertex.getCurrentExecutionAttempt(),
			metricFetcher,
			jobID.toString(),
			jobVertex.getJobVertexId().toString());
		subtasks.add(new JobVertexDetailsInfo.VertexTaskDetail(
			num,
			status,
			vertex.getCurrentExecutionAttempt().getAttemptNumber(),
			locationString,
			startTime,
			endTime,
			duration,
			new IOMetricsInfo(
				counts.getNumBytesInLocal() + counts.getNumBytesInRemote(),
				counts.isNumBytesInLocalComplete() && counts.isNumBytesInRemoteComplete(),
				counts.getNumBytesOut(),
				counts.isNumBytesOutComplete(),
				counts.getNumRecordsIn(),
				counts.isNumRecordsInComplete(),
				counts.getNumRecordsOut(),
				counts.isNumRecordsOutComplete())));

		num++;
	}

	return new JobVertexDetailsInfo(
		jobVertex.getJobVertexId(),
		jobVertex.getName(),
		jobVertex.getParallelism(),
		now,
		subtasks);
}
 
Example #26
Source Project: Flink-CEPplus   Author: ljygz   File: JobVertexDetailsInfoTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected JobVertexDetailsInfo getTestResponseInstance() throws Exception {
	final Random random = new Random();
	final IOMetricsInfo jobVertexMetrics = new IOMetricsInfo(
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean());
	List<JobVertexDetailsInfo.VertexTaskDetail> vertexTaskDetailList = new ArrayList<>();
	vertexTaskDetailList.add(new JobVertexDetailsInfo.VertexTaskDetail(
		0,
		ExecutionState.CREATED,
		random.nextInt(),
		"local1",
		System.currentTimeMillis(),
		System.currentTimeMillis(),
		1L,
		jobVertexMetrics));
	vertexTaskDetailList.add(new JobVertexDetailsInfo.VertexTaskDetail(
		1,
		ExecutionState.FAILED,
		random.nextInt(),
		"local2",
		System.currentTimeMillis(),
		System.currentTimeMillis(),
		1L,
		jobVertexMetrics));
	vertexTaskDetailList.add(new JobVertexDetailsInfo.VertexTaskDetail(
		2,
		ExecutionState.FINISHED,
		random.nextInt(),
		"local3",
		System.currentTimeMillis(),
		System.currentTimeMillis(),
		1L,
		jobVertexMetrics));

	return new JobVertexDetailsInfo(
		new JobVertexID(),
		"jobVertex" + random.nextLong(),
		random.nextInt(),
		System.currentTimeMillis(),
		vertexTaskDetailList);
}
 
Example #27
Source Project: flink   Author: flink-tpc-ds   File: SubtaskExecutionAttemptDetailsInfo.java    License: Apache License 2.0 4 votes vote down vote up
public IOMetricsInfo getIoMetricsInfo() {
	return ioMetricsInfo;
}
 
Example #28
Source Project: flink   Author: flink-tpc-ds   File: JobDetailsInfo.java    License: Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public IOMetricsInfo getJobVertexMetrics() {
	return jobVertexMetrics;
}
 
Example #29
Source Project: flink   Author: flink-tpc-ds   File: JobVertexDetailsHandler.java    License: Apache License 2.0 4 votes vote down vote up
private static JobVertexDetailsInfo createJobVertexDetailsInfo(AccessExecutionJobVertex jobVertex, JobID jobID, @Nullable MetricFetcher metricFetcher) {
	List<JobVertexDetailsInfo.VertexTaskDetail> subtasks = new ArrayList<>();
	final long now = System.currentTimeMillis();
	int num = 0;
	for (AccessExecutionVertex vertex : jobVertex.getTaskVertices()) {
		final ExecutionState status = vertex.getExecutionState();

		TaskManagerLocation location = vertex.getCurrentAssignedResourceLocation();
		String locationString = location == null ? "(unassigned)" : location.getHostname() + ":" + location.dataPort();

		long startTime = vertex.getStateTimestamp(ExecutionState.DEPLOYING);
		if (startTime == 0) {
			startTime = -1;
		}
		long endTime = status.isTerminal() ? vertex.getStateTimestamp(status) : -1;
		long duration = startTime > 0 ? ((endTime > 0 ? endTime : now) - startTime) : -1;

		MutableIOMetrics counts = new MutableIOMetrics();
		counts.addIOMetrics(
			vertex.getCurrentExecutionAttempt(),
			metricFetcher,
			jobID.toString(),
			jobVertex.getJobVertexId().toString());
		subtasks.add(new JobVertexDetailsInfo.VertexTaskDetail(
			num,
			status,
			vertex.getCurrentExecutionAttempt().getAttemptNumber(),
			locationString,
			startTime,
			endTime,
			duration,
			new IOMetricsInfo(
				counts.getNumBytesIn(),
				counts.isNumBytesInComplete(),
				counts.getNumBytesOut(),
				counts.isNumBytesOutComplete(),
				counts.getNumRecordsIn(),
				counts.isNumRecordsInComplete(),
				counts.getNumRecordsOut(),
				counts.isNumRecordsOutComplete())));

		num++;
	}

	return new JobVertexDetailsInfo(
		jobVertex.getJobVertexId(),
		jobVertex.getName(),
		jobVertex.getParallelism(),
		now,
		subtasks);
}
 
Example #30
Source Project: flink   Author: flink-tpc-ds   File: JobVertexDetailsInfoTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
protected JobVertexDetailsInfo getTestResponseInstance() throws Exception {
	final Random random = new Random();
	final IOMetricsInfo jobVertexMetrics = new IOMetricsInfo(
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean(),
		random.nextLong(),
		random.nextBoolean());
	List<JobVertexDetailsInfo.VertexTaskDetail> vertexTaskDetailList = new ArrayList<>();
	vertexTaskDetailList.add(new JobVertexDetailsInfo.VertexTaskDetail(
		0,
		ExecutionState.CREATED,
		random.nextInt(),
		"local1",
		System.currentTimeMillis(),
		System.currentTimeMillis(),
		1L,
		jobVertexMetrics));
	vertexTaskDetailList.add(new JobVertexDetailsInfo.VertexTaskDetail(
		1,
		ExecutionState.FAILED,
		random.nextInt(),
		"local2",
		System.currentTimeMillis(),
		System.currentTimeMillis(),
		1L,
		jobVertexMetrics));
	vertexTaskDetailList.add(new JobVertexDetailsInfo.VertexTaskDetail(
		2,
		ExecutionState.FINISHED,
		random.nextInt(),
		"local3",
		System.currentTimeMillis(),
		System.currentTimeMillis(),
		1L,
		jobVertexMetrics));

	return new JobVertexDetailsInfo(
		new JobVertexID(),
		"jobVertex" + random.nextLong(),
		random.nextInt(),
		System.currentTimeMillis(),
		vertexTaskDetailList);
}