Skip to content

Commit

Permalink
expose task finish time via debug API
Browse files Browse the repository at this point in the history
  • Loading branch information
klsince committed Oct 5, 2022
1 parent e1aa147 commit 05e7c72
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,10 @@ private synchronized TaskDebugInfo getTaskDebugInfo(WorkflowContext workflowCont
if (jobExecutionStartTimeMs > 0) {
taskDebugInfo.setExecutionStartTime(DateTimeUtils.epochToDefaultDateFormat(jobExecutionStartTimeMs));
}
long jobFinishTimeMs = jobContext.getFinishTime();
if (jobFinishTimeMs > 0) {
taskDebugInfo.setFinishTime(DateTimeUtils.epochToDefaultDateFormat(jobFinishTimeMs));
}
Set<Integer> partitionSet = jobContext.getPartitionSet();
TaskCount subtaskCount = new TaskCount();
for (int partition : partitionSet) {
Expand Down Expand Up @@ -798,11 +802,15 @@ public void deleteTaskMetadataByTable(String taskType, String tableNameWithType)
MinionTaskMetadataUtils.deleteTaskMetadata(propertyStore, taskType, tableNameWithType);
}

@JsonPropertyOrder({"taskState", "subtaskCount", "startTime", "executionStartTime", "subtaskInfos"})
@JsonPropertyOrder({"taskState", "subtaskCount", "startTime", "executionStartTime", "finishTime", "subtaskInfos"})
@JsonInclude(JsonInclude.Include.NON_NULL)
public static class TaskDebugInfo {
// Time at which the task (which may have multiple subtasks) got created.
private String _startTime;
// Time at which the first subtask of the task got scheduled.
private String _executionStartTime;
// Time at which the task has ended.
private String _finishTime;
private TaskState _taskState;
private TaskCount _subtaskCount;
private List<SubtaskDebugInfo> _subtaskInfos;
Expand All @@ -818,6 +826,10 @@ public void setExecutionStartTime(String executionStartTime) {
_executionStartTime = executionStartTime;
}

public void setFinishTime(String finishTime) {
_finishTime = finishTime;
}

public void setTaskState(TaskState taskState) {
_taskState = taskState;
}
Expand All @@ -841,6 +853,10 @@ public String getExecutionStartTime() {
return _executionStartTime;
}

public String getFinishTime() {
return _finishTime;
}

public TaskState getTaskState() {
return _taskState;
}
Expand Down

0 comments on commit 05e7c72

Please sign in to comment.