Create a Task

Applies To: Windows Compute Cluster Server 2003

A task is an instruction to run a specific user executable, as defined by a command line. Like a job, a task has a name and a variety of user options. A task cannot be created outside of a job, but it can be saved to a job template file representing an otherwise undefined job. A task cannot be submitted independently of a job, although a job can contain only one task. You can also add tasks to jobs that have Queued, Running, Failed, or Cancelled status.

To create a task

  1. In the Submit Job dialog box or on the Job Properties property sheet, click the Tasks tab.

  2. For each task to be added, change or accept the default task name in the Task Name text box. If your job contains more than one task and you want to specify task precedence, you must give each task a unique name.

  3. Enter the task command line in the Task Command Line text box. A task command line may contain up to 480 characters. Enter the executable name as follows:

    • If the application exists on all compute nodes and has been added to the cluster-wide Path environment variable, enter only the executable name.

    • If the application resides on a file server, enter the UNC path. For example: \\<My_Fileserver>\myapp.exe.

    • Use double quotes for paths that are part of the task command line. For example:
      mpiexec "bio diesel project\hello.exe"

    • If your command line is the name of a batch file, see Use Batch and Script Files with Compute Cluster Jobs.

    • For parametric sweeps, you can enter a command line and associated input, output, and error files with an asterisk for series replication. For instructions, see Create a Parametric Sweep.

    • For MPI executables, the executable must be preceded by mpiexec. For more information about mpiexec, see Add MPI Tasks.


      For information about installing and setting up user applications, see Install and License Parallel Applications.

  4. Click Add. The new task will appear as a new entry in the center pane. The entry will display the task command line and the task order ID. The task list is sorted by ascending task order ID.

  5. If you want to specify task properties, select the task in the center pane and click Edit… to open the Task Properties propertysheet.

  6. Enter Standard input, Standard output, and Standard error file names as required, unless these are included in the Command Line. Unless these files are found in or written to the Working Directory (as described in the following step), they must be entered as full paths.

  7. Enter the Working Directory if it is different from the default (%USERPROFILE%,which is C:\Documents and Settings\<your_alias>). The working directory is the location where the scheduler will look for the input files and write the output and error files.

  8. If you want to set a run time for the task, enter it in days, hours, and minutes. These are identical in form to the equivalent fields for the job and must be a subset. The task cannot run longer than the job.

  9. Click the Processors tab and enter the minimum and maximum number of processors required for the task. These fields are identical in form to the equivalent fields for the job and must be a subset. The task cannot reserve more processes than the job.

  10. Click the Task Dependencies tab and click any task that depends on one or more other tasks.

  11. Click Preceding Tasks. This produces a pop-up list containing the other tasks.

  12. Select the check box for each task on which the selected task depends.

  13. If required, click the Environment tab and click a task in the upper pane of the screen.

  14. Enter the environment variable that you want to define and enter its value in the appropriate fields. For more information about environment variables, see Use Environment Variables.

  15. Click the Advanced tab to do any of the following:

    • Give the task exclusive use of the node.

    • Turn off the rerun task option.

    • Specify any individual nodes that you require for this task.

    • Highlight a task in the upper pane of the screen.

    • If you do not want to make processors on nodes used by this task available to other tasks, select the Use the allocated nodes exclusively for this task check box.

    • If needed, clear the Allow task to rerun on failure check box.


      This prevents the task from being rerun regardless of the reason for failure or cancellation.

    • In the list of nodes, select the specific nodes that you want to be used for your task. The task will use these nodes and only these nodes and it will not run until all of them are available.


      Specifying required nodes overrides the minimum-maximum processors request. It also forces the job to reserve the nodes specified.

  16. Click Apply if you want to apply your changes to the task but not close the Task Properties property sheet, or click OK to apply your changes and return to the Job Properties property sheet or the Submit Job dialog box.

Creating a task from the command line

To create a task from the command line, you must first have a job with a job ID to which you can add the task. You can do this by entering the command job new, which will return a JobID. A task command line may contain up to 480 characters.

To create a task from the command line, type:

job add <JobID> [standard_task_options] [/taskfile:<template_file>] <command> [arguments]


When a task is specified at the command line, any file paths containing spaces must be enclosed in double quotes.

Standard task options

Option Definition Maximum Characters


Specifies the name of the task.


/numprocessors:<min_processors> or <min_processors>, <max_processors>

Specifies individual nodes that are eligible to be reserved by the task. By default, all nodes in the cluster are candidates.


/rerunnable: true | false

Flag indicating that the task can be rerun after a failure. Default is true.

The scheduler allows a failed job to be requeued if the failure is due to any error that can be fixed without changing the task command line. If the task or task fails because of system failure (for example, a node crashes), the scheduler requeues the job automatically. Only incomplete tasks are re-run.



Specifies by name the nodes to be allocated to the task. /requirednodes overrides /numprocessors and also forces the job to reserve the nodes that are specified.


/env:name1=val1 /env:<name2=val2 … /env:nameN=valN>

Specifies the environment variables for the task. (For more information about environment variables, see Use Environment Variables.)


/exclusive: true | false

Flag indicating that the task will have exclusive use of reserved nodes. Default is false.


/runtime:[[[days:<num>]hours:<num>]minutes: <num>| infinite]

Maximum run time in day-hour-minute format. The job will be cancelled rather than allowed to run past the maximum run time. Default is Infinite.



The full path of the work directory (the directory for input, output, and error files). The path may contain environment variables. Default is %USERPROFILE%.



Take standard input for the task from file <file_name>.



Redirect standard output of the task to the file <file_name>.



Redirect standard error of the task to a file <file_name>.



Specifies that this task depends on a task or tasks of the name <task_name>. (Multiple tasks of the same name will have different task IDs.) If multiple tasks of different names are depended on, the job add command needs to be repeated:

job add 21 /name:task3 /depend:task1 myapp3.exe

job add 21 /name:task3 /depend:task2 myapp3.exe


Additional task options

Option Definition


Overwrites the contents of the task with the values in this job template file, except where a different value is explicitly set in the command line.

For more information about the command-line interface, see Compute Cluster Server Command Line Interface Reference.

See Also


Add MPI Tasks
Use Batch and Script Files with Compute Cluster Jobs
Create a Parametric Sweep
Install and License Parallel Applications