The Action and Process Objects
This section goes deeper into understanding how the Action and Process objects looks like when using the code layer.
How to get them
In the Deeper into code section you can see the following code example
function getAction(pId) { let p = getProcessById(pId)//Get the process. if(!p ||!p.length)return; p = p[p.length-1].actions; //Get all actions let action = p[Object.keys(p)[0]];//get the needed action return action }
Since the object returns as a JSON file – if you would like to see it, you should stringify the action – like the following method:
function echoAction() { let uuid = <THE PROCESS ID> let action = getAction(uuid) return `echo ${JSON.stringify(action)}` // Print Action Output }
The Action object
The following table will describe the Object and parameters within the ACTION object
Parameters | Description |
---|---|
retries | This is the number of retries you added to this action. If the action fails you may ask it to be re-executed the number of retries |
mandatory | In case the action is mandatory then if the action fails – the execution of the rest of the steps will stop. |
isEnabled | You can switch the action to run or not. This flag means that the action will be executed. |
Params | This the command sent to execute |
Id | Action unique ID |
name | This is the name of the action. By default it is Action and the number in the line (ie Action #1). You can change the name to be more informative. |
timeout | You can set a timeout to the action. When time passes and the action doesn’t stop – the action will return failure. |
startTime | The time that the execution started |
finishTime | The time when the execution stopped |
numParallel | Indicates if the action should be executed in parallel |
actionIndex | The index number of this action inside the process array |
action | The Id of the action |
retriesLeft | How many retries were left |
uniqueRunUId | This is the run Id of the the action which will change each and every execution |
status | The Status result of the execution This is actually an ENUM, with only the following options: “running” “done” “pending” “error” “stopped” “canceled” “success” |
plugin | The plugin to use (more details in the following table) |
Result.stdout | Action result stdout |
Result.stderr | Action stderr |
Result.result | The actual result of the command |
result.status | If the execution succeeded or failed |