Skip to content

Commit

Permalink
Added CheckNextActions() notes for @yashsinghcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
frikky committed Oct 25, 2024
1 parent d15d62a commit 3621997
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions db-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -1572,6 +1572,7 @@ func GetExecutionVariables(ctx context.Context, executionId string) (string, int
cacheData := []byte(cache.([]uint8))
err = json.Unmarshal(cacheData, &wrapper)
if err == nil {

return wrapper.StartNode, wrapper.Extra, wrapper.Children, wrapper.Parents, wrapper.Visited, wrapper.Executed, wrapper.NextActions, wrapper.Environments
}
} else {
Expand Down
23 changes: 22 additions & 1 deletion shared.go
Original file line number Diff line number Diff line change
Expand Up @@ -23555,7 +23555,24 @@ func CheckNextActions(ctx context.Context, workflowExecution *WorkflowExecution)

nextActions = findMissingChildren(ctx, workflowExecution, children, inputNode, []string{})

//log.Printf("[DEBUG][%s] Checking what are next actions in workflow %s. Results: %d/%d. NextActions: %s", workflowExecution.ExecutionId, workflowExecution.ExecutionId, len(workflowExecution.Results), len(workflowExecution.Workflow.Actions)+extra, nextActions)
// SHOULD WE: Write code here which returns IF an action should be SKIPPED. If ALL parents are SKIPPED/FAILED, return something like []string{id:SKIPPED} -> parent function that calls this should make it SKIPPED
// Question: Should we just run SKIPPED requests directly from here, then NOT return the ID?

// Skipped request info:
// Look into sendSelfRequest AND areas where we send requests for ActionResult to self:
/*
ActionResult{
Action: curaction,
ExecutionId: workflowExecution.ExecutionId,
Authorization: workflowExecution.Authorization,
Result: `{"success": false, "reason": "Skipped because it's not under the startnode (1)"}`,
StartedAt: 0,
CompletedAt: 0,
Status: "SKIPPED",
}
*/



return nextActions
}
Expand All @@ -23580,6 +23597,10 @@ func DecideExecution(ctx context.Context, workflowExecution WorkflowExecution, e
}
}

if len(nextActions) == 0 {
nextActions = CheckNextActions(ctx, &workflowExecution)
}

// Dedup results just in case
newResults := []ActionResult{}
handled := []string{}
Expand Down

0 comments on commit 3621997

Please sign in to comment.