runTask - noetl/noetl GitHub Wiki

E.g. exitCode = runTask(taskInstance)

Parameters

  • task: current task instance

Key Variables

  • exitCode: records the success or failure of runTask
  • taskStartDate: date and time when task starts
  • branchQueue: Queue object which holds the branches to fork
  • mergeStep: key in task.start dictionary
  • branchName: value in task.start dictionary which lists the starting steps of the task
  • branch: branch object of the task's starting branch

Functionality

The exitCode is initialized to 0, and the taskStartDate is set to the current time.

  • If the length of the values in the task.start dictionary is more than 1, then the task starts off with a fork. RunTask iterates through each of the values in the start dictionary, and puts the branch in the branchQueue. Then, forkBranches is called on the branchQueue, and exitCode is set to the return value.
  • Otherwise, if the number of values is 1, then the task starts of with just 1 step. The branchName is retrieved from the task.start dictionary, and the branch object is retrieved from the task.branchesDict. The exitCode is set equal to the return value of calling getStep on the branch. If the exitCode is None, then the task.start dictionary didn't fit any of the if clauses, and the exitCode is set to -1.

Except Statement

If an error arises, the except block writes to the log file, recording the time, current task, and the error message.

The exitCode is set equal to -1, indicating a failure.

Return Value

Returns the exitCode.