Task Commands are used in Job Flow to execute Unix shell scripts or Windows batch scripts. The scripts are executed on the Agent associated with the task command job. Most common use of Task Command job is to perform operations on a single or multiple files before or after the data flow completes.

The syntax and validity of commands used in the scripts defined for the Task Command job should be validated by the user before execution. Any issues with the script will result in failure during runtime.
Note:  To create a new Job Flow, refer Creating New Job Flow

To create the Task Command Job follow the below steps. 

Step I: From the Jobs menu, drag and drop the Task Command on canvas.

Step II: Provide the General details of Job.

On Canvas, select the Task Command Job, and then under Properties, provide the General details.

Name - The Name field displays the name of the job. To edit the Job name, click the arrow next to the name field.

Description - In the text box, you can provide a description and is optional.

Disable task - Check Disable task, if the job need not be executed as part of the Job Flow, and you do not want to delete the Job.

Step III: Provide the Properties for Job.

Under Properties, click Properties and change the entries for below.

Success Codes: Define the exit codes from the script that should be treated as Successful exit. By default only when the script exists with codes 0 and 99 the Task Command will be marked as success. If the script exits with any other code then the Task Command will be marked as Failed. You can add any numeric value here separated by comma (,) ans these will be considered as successful exit codes.

Retry Enabled: Check the retry option if you want to enable retry attempts for task command job execution.

  • No. of Retry Attempts: Specify the number of attempts to retry task command job execution if in case the job fails to execute. By default, the retry attempts is set to 2.
  • Retry Wait Time (in Seconds): Specify the duration in seconds for the job to retry next execution. By default, the duration is set to 60 seconds. If the Job fails to execute, it retries again for next execution attempt after the specified wait time. 

Step IV: Provide the script to be executed

1. Under Properties, click Command tab. Select the Command Type as External for Linux commands.

The Command Type drop-down lists the command types such as External and File Watcher. For more information about File Watcher, refer Working with File Watcher Job.

2. Under Command, click on the Expression Editor arrow.

The Expression Editor window opens, and you can define the script here. Once you enter the expression, click Validate to verify that there are no syntax errors. If everything is correct then, a success message is displayed. 

Step V: Assign Agent

1. To assign or change the associated agent click Change

  • If Default agent is assigned to the Project then automatically, the Default agent will be associated with the Task Command job created.
  • If Default agent is not assigned to the Project then, no agent will be assigned automatically and appropriate agent needs to be assigned to the Task Command job.

2. The Agent window lists all the available Agents. Choose the required Agent

The script defined in the Task Command job should be compatible with OS on which the selected Agent is installed.

Note:

  • To save the Job Flow, on the Actions menu, click Save. For more information, refeSaving Job Flow
  • To revert the changes before saving the Job Flow, on the Actions menu, click Revert. For more information, refer Reverting changes in Job Flow
  • To execute individual job in the Job Flow, on the Actions menu, click Run Job. For more information, refer Executing individual Job in Job Flow.
  • To execute the Job Flow, on the Actions menu, click Run. For more information, refer Executing Job Flow.
  • Once the Job is created and the changes are saved, then, close or unlock the Job Flow so that it is editable by other users. For more information, refer Closing Job Flow and Unlocking Job Flow