Skip to content

Commit 2ada8cf

Browse files
committed
Removes reference to branch in progress.go
1 parent 975d3ae commit 2ada8cf

2 files changed

Lines changed: 7 additions & 18 deletions

File tree

internal/workflow/progress.go

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -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

4544
func newTaskInfo(task Task, group int) *TaskInfo {
@@ -52,7 +51,7 @@ func newTaskInfo(task Task, group int) *TaskInfo {
5251
}
5352

5453
func (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

5857
type 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 {
344335
func 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

430421
func (p *Progress) PrettyString() string {
431422
str := fmt.Sprintf("\nProgress 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
}

internal/workflow/task.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ type HasOutput interface {
3131
}
3232

3333
// TODO: GetNext() should be differentiated for the case of single vs multiple successor nodes
34-
// TODO: check the implementation in ChoiceNode, where it returns a different next task depending on the execution state
35-
// TODO: check also FanOut
3634
type HasNext interface {
3735
GetNext() []TaskId
3836
}

0 commit comments

Comments
 (0)