return workers info of index level
This commit is contained in:
parent
f3569c2701
commit
9f60c4685f
|
@ -301,6 +301,7 @@ func (h *APIHandler) getDataComparisonTaskOfIndex(w http.ResponseWriter, req *ht
|
||||||
startTime, completedTime, duration, completedPartitions := h.calcMajorTaskInfo(subTasks, taskInfo.Repeating)
|
startTime, completedTime, duration, completedPartitions := h.calcMajorTaskInfo(subTasks, taskInfo.Repeating)
|
||||||
|
|
||||||
var partitionTaskInfos []util.MapStr
|
var partitionTaskInfos []util.MapStr
|
||||||
|
var workers = map[string]struct{}{}
|
||||||
|
|
||||||
for i, subTask := range subTasks {
|
for i, subTask := range subTasks {
|
||||||
cfg := migration_model.IndexComparisonTaskConfig{}
|
cfg := migration_model.IndexComparisonTaskConfig{}
|
||||||
|
@ -312,6 +313,10 @@ func (h *APIHandler) getDataComparisonTaskOfIndex(w http.ResponseWriter, req *ht
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
taskInfo.Step = cfg.Source.Step
|
taskInfo.Step = cfg.Source.Step
|
||||||
}
|
}
|
||||||
|
instID := migration_util.GetMapStringValue(subTask.Metadata.Labels, "execution_instance_id")
|
||||||
|
if instID != "" {
|
||||||
|
workers[instID] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
var durationInMS int64
|
var durationInMS int64
|
||||||
var subCompletedTime int64
|
var subCompletedTime int64
|
||||||
|
@ -381,6 +386,14 @@ func (h *APIHandler) getDataComparisonTaskOfIndex(w http.ResponseWriter, req *ht
|
||||||
if taskInfo.StartTime == 0 {
|
if taskInfo.StartTime == 0 {
|
||||||
taskInfo.StartTime = startTime
|
taskInfo.StartTime = startTime
|
||||||
}
|
}
|
||||||
|
for _, node := range taskConfig.Settings.Execution.Nodes.Permit {
|
||||||
|
if _, ok := workers[node.ID]; ok {
|
||||||
|
taskInfo.Workers = append(taskInfo.Workers, util.MapStr{
|
||||||
|
"id": node.ID,
|
||||||
|
"name": node.Name,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
taskInfo.Partitions = partitionTaskInfos
|
taskInfo.Partitions = partitionTaskInfos
|
||||||
taskInfo.CompletedPartitions = completedPartitions
|
taskInfo.CompletedPartitions = completedPartitions
|
||||||
h.WriteJSON(w, taskInfo, http.StatusOK)
|
h.WriteJSON(w, taskInfo, http.StatusOK)
|
||||||
|
|
Loading…
Reference in New Issue