forkBranches - noetl/noetl GitHub Wiki

E.g. exitCode = forkBranches(taskInstance, branchQueue)

Parameters

  • task: task instance
  • branchQueue: queue containing the branches to fork

Key Variables

  • exitCode: records the success or failure of forkBranches
  • branch: Thread instance for each branch

Functionality

ForkBranches initializes the exitCode to 0. It iterates through the branchQueue, and on each iteration it creates a Thread instance with a target function of runBranchQueue and arguments task and branchQueue that will be passed into runBranchQueue for each branch. It calls start on each branch, and after they have all been started, branchQueue waits to merge all the branches, then returns the exitCode.

Except Statement

If an error arises, the except block writes to the log file, recording the time and the error message. The exitCode is set equal to -1, indicating a failure.

Return Value

Returns the exitCode.