#71: Added more skipped branch checks. Need to fix visited in worker
This commit is contained in:
@@ -681,7 +681,7 @@ func handleGetStreamResults(resp http.ResponseWriter, request *http.Request) {
|
|||||||
// Finds the child nodes of a node in execution and returns them
|
// Finds the child nodes of a node in execution and returns them
|
||||||
// Used if e.g. a node in a branch is exited, and all children have to be stopped
|
// Used if e.g. a node in a branch is exited, and all children have to be stopped
|
||||||
func findChildNodes(workflowExecution WorkflowExecution, nodeId string) []string {
|
func findChildNodes(workflowExecution WorkflowExecution, nodeId string) []string {
|
||||||
log.Printf("\nNODE TO FIX: %s\n\n", nodeId)
|
//log.Printf("\nNODE TO FIX: %s\n\n", nodeId)
|
||||||
allChildren := []string{nodeId}
|
allChildren := []string{nodeId}
|
||||||
|
|
||||||
// 1. Find children of this specific node
|
// 1. Find children of this specific node
|
||||||
@@ -690,6 +690,21 @@ func findChildNodes(workflowExecution WorkflowExecution, nodeId string) []string
|
|||||||
if branch.SourceID == nodeId {
|
if branch.SourceID == nodeId {
|
||||||
log.Printf("Children: %s", branch.DestinationID)
|
log.Printf("Children: %s", branch.DestinationID)
|
||||||
allChildren = append(allChildren, branch.DestinationID)
|
allChildren = append(allChildren, branch.DestinationID)
|
||||||
|
|
||||||
|
childNodes := findChildNodes(workflowExecution, branch.DestinationID)
|
||||||
|
for _, bottomChild := range childNodes {
|
||||||
|
found := false
|
||||||
|
for _, topChild := range allChildren {
|
||||||
|
if topChild == bottomChild {
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !found {
|
||||||
|
allChildren = append(allChildren, bottomChild)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -884,6 +899,31 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
|
|||||||
workflowExecution.Results = append(workflowExecution.Results, actionResult)
|
workflowExecution.Results = append(workflowExecution.Results, actionResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Have a check for skippednodes and their parents
|
||||||
|
for resultIndex, result := range workflowExecution.Results {
|
||||||
|
if result.Status != "SKIPPED" {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Checks if all parents are skipped or failed. Otherwise removes them from the results
|
||||||
|
for _, branch := range workflowExecution.Workflow.Branches {
|
||||||
|
if branch.DestinationID == result.Action.ID {
|
||||||
|
for _, subresult := range workflowExecution.Results {
|
||||||
|
if subresult.Action.ID == branch.SourceID {
|
||||||
|
if subresult.Status != "SKIPPED" && subresult.Status != "FAILURE" {
|
||||||
|
log.Printf("SUBRESULT PARENT STATUS: %s", subresult.Status)
|
||||||
|
log.Printf("Should remove resultIndex: %d", resultIndex)
|
||||||
|
|
||||||
|
workflowExecution.Results = append(workflowExecution.Results[:resultIndex], workflowExecution.Results[resultIndex+1:]...)
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
extraInputs := 0
|
extraInputs := 0
|
||||||
for _, result := range workflowExecution.Results {
|
for _, result := range workflowExecution.Results {
|
||||||
if result.Action.Name == "User Input" && result.Action.AppName == "User Input" {
|
if result.Action.Name == "User Input" && result.Action.AppName == "User Input" {
|
||||||
@@ -893,7 +933,6 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
|
|||||||
|
|
||||||
log.Printf("LENGTH: %d - %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions))
|
log.Printf("LENGTH: %d - %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions))
|
||||||
|
|
||||||
//log.Printf("Checking results %d vs %d", len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extraInputs)
|
|
||||||
if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
|
if len(workflowExecution.Results) == len(workflowExecution.Workflow.Actions)+extraInputs {
|
||||||
finished := true
|
finished := true
|
||||||
lastResult := ""
|
lastResult := ""
|
||||||
@@ -906,8 +945,29 @@ func handleWorkflowQueue(resp http.ResponseWriter, request *http.Request) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: Check if ALL parents are skipped or if its just one. Otherwise execute it
|
||||||
if result.Status == "SKIPPED" {
|
if result.Status == "SKIPPED" {
|
||||||
skippedNodes = true
|
skippedNodes = true
|
||||||
|
|
||||||
|
// Checks if all parents are skipped or failed. Otherwise removes them from the results
|
||||||
|
for _, branch := range workflowExecution.Workflow.Branches {
|
||||||
|
if branch.DestinationID == result.Action.ID {
|
||||||
|
for _, subresult := range workflowExecution.Results {
|
||||||
|
if subresult.Action.ID == branch.SourceID {
|
||||||
|
if subresult.Status != "SKIPPED" && subresult.Status != "FAILURE" {
|
||||||
|
//log.Printf("SUBRESULT PARENT STATUS: %s", subresult.Status)
|
||||||
|
//log.Printf("Should remove resultIndex: %d", resultIndex)
|
||||||
|
finished = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if !finished {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastResult = result.Result
|
lastResult = result.Result
|
||||||
|
|||||||
@@ -325,6 +325,14 @@ const AngularWorkflow = (props) => {
|
|||||||
incomingEdges.addClass('success-highlight')
|
incomingEdges.addClass('success-highlight')
|
||||||
currentnode.addClass('executing-highlight')
|
currentnode.addClass('executing-highlight')
|
||||||
break
|
break
|
||||||
|
case "SKIPPED":
|
||||||
|
currentnode.removeClass('not-executing-highlight')
|
||||||
|
currentnode.removeClass('success-highlight')
|
||||||
|
currentnode.removeClass('failure-highlight')
|
||||||
|
currentnode.removeClass('awaiting-data-highlight')
|
||||||
|
currentnode.removeClass('executing-highlight')
|
||||||
|
currentnode.addClass('skipped-highlight')
|
||||||
|
break
|
||||||
case "WAITING":
|
case "WAITING":
|
||||||
currentnode.removeClass('not-executing-highlight')
|
currentnode.removeClass('not-executing-highlight')
|
||||||
currentnode.removeClass('success-highlight')
|
currentnode.removeClass('success-highlight')
|
||||||
|
|||||||
@@ -113,6 +113,16 @@ const data = [{
|
|||||||
'background-color': '#77b0d0',
|
'background-color': '#77b0d0',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
selector: '.skipped-highlight',
|
||||||
|
css: {
|
||||||
|
'background-color': 'grey',
|
||||||
|
'border-color': 'grey',
|
||||||
|
'border-width': '8px',
|
||||||
|
'transition-property': 'background-color',
|
||||||
|
'transition-duration': '0.5s',
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
selector: '.success-highlight',
|
selector: '.success-highlight',
|
||||||
css: {
|
css: {
|
||||||
|
|||||||
@@ -502,9 +502,9 @@ func handleExecution(client *http.Client, req *http.Request, workflowExecution W
|
|||||||
nextActions = []string{startAction}
|
nextActions = []string{startAction}
|
||||||
} else {
|
} else {
|
||||||
for _, item := range workflowExecution.Results {
|
for _, item := range workflowExecution.Results {
|
||||||
|
// FIXME: Check whether the item should be visited or not
|
||||||
visited = append(visited, item.Action.ID)
|
visited = append(visited, item.Action.ID)
|
||||||
nextActions = children[item.Action.ID]
|
nextActions = children[item.Action.ID]
|
||||||
// FIXME: check if nextActions items are finished?
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user