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 File: SubtaskExecutionAttemptDetailsInfo.java    From Flink-CEPplus with 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 #2
Source File: JobVertexTaskManagersInfoTest.java    From flink with 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 #3
Source File: JobVertexTaskManagersInfo.java    From flink with 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 #4
Source File: JobDetailsInfo.java    From flink with 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 #5
Source File: SubtaskExecutionAttemptDetailsInfo.java    From flink with 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 #6
Source File: JobVertexTaskManagersInfoTest.java    From flink with 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 File: SubtaskExecutionAttemptDetailsInfoTest.java    From flink with 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 #8
Source File: JobVertexTaskManagersInfo.java    From flink with 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 #9
Source File: JobDetailsInfo.java    From flink with 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 File: SubtaskExecutionAttemptDetailsInfo.java    From flink with 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 #11
Source File: JobVertexDetailsInfo.java    From flink with 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 #12
Source File: JobVertexDetailsInfo.java    From Flink-CEPplus with 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 #13
Source File: SubtaskExecutionAttemptDetailsInfoTest.java    From Flink-CEPplus with 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 #14
Source File: JobDetailsInfo.java    From Flink-CEPplus with 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 File: JobVertexTaskManagersInfoTest.java    From Flink-CEPplus with 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 #16
Source File: JobVertexTaskManagersInfo.java    From Flink-CEPplus with 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 #17
Source File: JobDetailsInfoTest.java    From flink with 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 #18
Source File: JobDetailsInfoTest.java    From flink with 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 File: SubtaskExecutionAttemptDetailsInfoTest.java    From flink with 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 #20
Source File: SubtaskExecutionAttemptDetailsInfo.java    From Flink-CEPplus with 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 #21
Source File: SubtaskExecutionAttemptDetailsInfo.java    From flink with 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 #22
Source File: JobDetailsInfoTest.java    From Flink-CEPplus with 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 File: JobVertexDetailsInfoTest.java    From flink with 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 #24
Source File: JobVertexDetailsHandler.java    From flink with 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 #25
Source File: JobVertexDetailsHandler.java    From Flink-CEPplus with 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 File: JobDetailsInfo.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public IOMetricsInfo getJobVertexMetrics() {
	return jobVertexMetrics;
}
 
Example #27
Source File: JobDetailsInfo.java    From flink with Apache License 2.0 4 votes vote down vote up
@JsonIgnore
public IOMetricsInfo getJobVertexMetrics() {
	return jobVertexMetrics;
}
 
Example #28
Source File: SubtaskExecutionAttemptDetailsInfo.java    From flink with Apache License 2.0 4 votes vote down vote up
public IOMetricsInfo getIoMetricsInfo() {
	return ioMetricsInfo;
}
 
Example #29
Source File: SubtaskExecutionAttemptDetailsInfo.java    From flink with Apache License 2.0 4 votes vote down vote up
public static SubtaskExecutionAttemptDetailsInfo create(AccessExecution execution, @Nullable MetricFetcher metricFetcher, JobID jobID, JobVertexID jobVertexID) {
	final ExecutionState status = execution.getState();
	final long now = System.currentTimeMillis();

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

	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 MutableIOMetrics ioMetrics = new MutableIOMetrics();
	ioMetrics.addIOMetrics(
		execution,
		metricFetcher,
		jobID.toString(),
		jobVertexID.toString()
	);

	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,
		taskmanagerId
	);
}
 
Example #30
Source File: JobVertexDetailsInfoTest.java    From Flink-CEPplus with 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);
}