@@ -39,7 +39,6 @@ type TaskInfo struct {
3939 Type TaskType
4040 Status TaskStatus
4141 Group int // The group helps represent the order of execution of nodes. Nodes with the same group should run concurrently
42- Branch int // copied from task
4342}
4443
4544func newTaskInfo (task Task , group int ) * TaskInfo {
@@ -52,7 +51,7 @@ func newTaskInfo(task Task, group int) *TaskInfo {
5251}
5352
5453func (ni * TaskInfo ) Equals (ni2 * TaskInfo ) bool {
55- return ni .Id == ni2 .Id && ni .Type == ni2 .Type && ni .Status == ni2 .Status && ni .Group == ni2 .Group && ni . Branch == ni2 . Branch
54+ return ni .Id == ni2 .Id && ni .Type == ni2 .Type && ni .Status == ni2 .Status && ni .Group == ni2 .Group
5655}
5756
5857type TaskStatus string
@@ -303,8 +302,8 @@ func InitProgressRecursive(reqId ReqId, workflow *Workflow) *Progress {
303302 }
304303}
305304
306- // popMinGroupAndBranchNode removes the node with minimum group and, in case of multiple nodes in the same group, minimum branch
307- func popMinGroupAndBranchNode (infos * []* TaskInfo ) * TaskInfo {
305+ // popMinGroupNode removes a node with minimum group
306+ func popMinGroupNode (infos * []* TaskInfo ) * TaskInfo {
308307 // finding min group nodes
309308 minGroup := math .MaxInt
310309 var minGroupNodeInfo []* TaskInfo
@@ -318,16 +317,8 @@ func popMinGroupAndBranchNode(infos *[]*TaskInfo) *TaskInfo {
318317 minGroupNodeInfo = append (minGroupNodeInfo , info )
319318 }
320319 }
321- minBranch := math .MaxInt // when there are ties
322- var minGroupAndBranchNode * TaskInfo
323320
324- // finding min branch node from those of the minimum group
325- for _ , info := range minGroupNodeInfo {
326- if info .Branch < minBranch {
327- minBranch = info .Branch
328- minGroupAndBranchNode = info
329- }
330- }
321+ var minGroupAndBranchNode * TaskInfo = minGroupNodeInfo [0 ]
331322
332323 // finding index to remove from starting list
333324 var indexToRemove int
@@ -344,7 +335,7 @@ func popMinGroupAndBranchNode(infos *[]*TaskInfo) *TaskInfo {
344335func reorder (infos []* TaskInfo ) []* TaskInfo {
345336 reordered := make ([]* TaskInfo , 0 )
346337 for len (infos ) > 0 {
347- next := popMinGroupAndBranchNode (& infos )
338+ next := popMinGroupNode (& infos )
348339 reordered = append (reordered , next )
349340 }
350341 return reordered
@@ -429,10 +420,10 @@ func (p *Progress) Print() {
429420
430421func (p * Progress ) PrettyString () string {
431422 str := fmt .Sprintf ("\n Progress for workflow request %s - G = node group, B = node branch\n " , p .ReqId )
432- str += fmt .Sprintln ("G. |B| Type ( NodeID ) - Status" )
423+ str += fmt .Sprintln ("G. Type ( NodeID ) - Status" )
433424 str += fmt .Sprintln ("-------------------------------------------------" )
434425 for _ , info := range p .TaskInfos {
435- str += fmt .Sprintf ("%d. |%d| % -6s (%-22s) - %s\n " , info .Group , info . Branch , printType (info .Type ), info .Id , printStatus (info .Status ))
426+ str += fmt .Sprintf ("%d. % -6s (%-22s) - %s\n " , info .Group , printType (info .Type ), info .Id , printStatus (info .Status ))
436427 }
437428 return str
438429}
0 commit comments