3.8
Creating or Editing a Job Submission Script
You may need to edit a job submission script when creating a job. If you have the Templates Page Viewpoint permission, you can also create a default job submission script associated with a job template. See 4.4.7 Job Submission Script for more information.
Do the following:
- If you have not already done so, click Customize Script on the Create Job page. The Script Builder appears.
- Enter the script in the pane on the left side of the Script Builder. To assist you in building your script, there is a list of variables on the right side of the Script builder that you can drag and drop into your script. Hover the mouse over the variable to view its description. When used in the script, the variables shown in the right pane are highlighted and the number of times the variable is used in this script is displayed.
- When you are done editing your script, click Done Editing to save.
Click to enlarge |
Click to enlarge |
Another method for adding variables to a script is to type Ctrl+Space when editing a script in the left pane. You can select the variables directly in this list instead of having to drag them from the right pane.
Click to enlarge |
In addition to Viewpoint input variables, the list may include Custom Inputs, which are defined in the Custom Settings section of the job template, and Moab environment variables. See 3.8.0.A Script Variables for more information about script variables.
You can also import a script from a file by clicking Import and selecting the file containing the script.
If you want to export a script for use in other jobs or job templates, click Export and enter a file name for the script file.
The Script Builder provides a number of script variables that you can insert into your script. During script execution, Viewpoint replaces the variable with its current value. General patterns Viewpoint follows when replacing variables with current values is shown in the table below.
Text in Script Editor | Current Value of Variable | Text After Replacement |
---|---|---|
%VAR% | 1 | 1 |
text%VAR%text | 1 | text1text |
\%VAR% | 1 | \%VAR% |
\\%VAR% | 1 | \1 |
%INVALID% | (Undefined variable) | %INVALID% |
\%INVALID% | (Undefined variable) | %INVALID% |
%VAR%VAR% | 1 | 1VAR% |
%VAR%%VAR% | 1 | 11 |
%DURATION% | 5 (Value set in one of the job template's widgets, such as the Time Management Duration widget) | 5 |
%PATH% | /home/hpotter (Value of a path variable) | /home/hpotter |
%DATE% | 2017-03-15 11:00 UTC (Value of a date variable) | 2017-03-15 11:00 UTC |
%BOOL% | true (Value of a boolean variable) | true |
Script variables in the Script Builder are categorized as Viewpoint Inputs, Moab Environment Variables, and Custom Inputs. Viewpoint Inputs are variables associated with the job.
Variable | Description |
---|---|
ACCOUNT | Account associated with the job. |
ARCHITECTURE | Defines the system architecture required by the job. Example: x86_64. |
DESTINATIONQUEUE | The destination queue or class of the job. |
DURATION | The expected amount of time the job is expected to run. |
ELIGIBLEDATE | The time at which the job is eligible for execution. |
EMAILOPTIONS | A comma-delimited list of requested email options, expressed as key/value pairs. Example: "START:TRUE,COMPLETION:FALSE,FAILURE:FALSE" |
ENDINDEX | The end index of the job array. |
ERRORPATH | The path to be used for the job's standard error stream. |
EXECUTIONDIRECTORY | The job's execution directory. |
FEATURESEXCLUDED | A comma-delimited list of feature tags representing features that cannot be present on the hardware on which the job will run. For example, "feature1,feature2,feature3". |
FEATURESREQUESTED | A comma-delimited list of feature tags representing features that must be present on the hardware on which the job will run. For example, "feature1,feature2,feature3". |
GENERICRESOURCES | A comma-delimited list of additional job attributes, expressed as key/value pairs. Example: "ANSYS:3,MATLAB:4" |
HOLD | Specifies that a user hold will be placed on the job when submitted. |
JOIN | Specifies whether to merge the standard output and standard error streams. |
MAILLIST | A comma- and quote-delimited list of email addresses to be notified in the event of job or system failures or under other general conditions. Overrides the EMAILADDRESS specified on the USERCFG [credential]. Example: "[email protected]","[email protected]". |
MEMORYAMOUNT | Defines the resources that are required by the job and establishes a limit to the amount of resource that can be consumed. |
MOABENVIRONMENTVARIABLES | Specifies whether to push Moab environment variables to the job. |
MOABTEMPLATE | Specifies a MOAB job template to be used for the job. |
NAME | Specifies a name for the job (must be alphanumeric). |
NODEACCESSPOLICY | Specifies whether other tasks may execute on the job's compute node. See 1.1 Node Access Policies for more more information. |
NODEALLOCATIONPOLICY | Specifies the criteria for determining whether a node is busy. See 1.1 Node Availability Policies for more information. |
NODESREQUESTED |
Specifies the exact set, superset, or subset of nodes on which the job must run. |
NODESREQUESTEDPOLICY | Indicates an exact set, superset, or subset of nodes on which the job must run. Only relevant if NODESREQUESTED is provided. |
NUMOFCORES | If "Total Amount of Cores" is selected and total cores = 4, the value of the variable is "4". If "Nodes with Core Count" is selected, total nodes =2, and cores per node = 4, the value of the variable is "2:4". |
OPERATINGSYSTEM | Specifies the job's required operating system. |
OUTPUTPATH | Specifies the path to be used for the job's standard output stream. |
QOS | Specifies the desired QoS for the job. |
SHELL | The shell to execute the job script. Example: /bin/bash. |
STARTINDEX | The start index of the job array. |
USERPRIORITY | Specifies the priority at which the job is to run. |
Moab Environment Variables are variable whose values Viewpoint uses when submitting a job to Moab.
Variable | Description |
---|---|
MOAB_ACCOUNT | Account name. |
MOAB_BATCH | Set if a batch job (non-interactive). |
MOAB_CLASS | Class name. |
MOAB_DEPEND | Job dependency string. |
MOAB_GROUP | Group name. |
MOAB_JOBID | Job ID. |
MOAB_JOBNAME | Job name. |
MOAB_MACHINE | Name of the machine (i.e. destination resource manager) on which the job is to run. |
MOAB_NODECOUNT | Number of nodes allocated to the job. |
MOAB_NODELIST | Comma-delimited list of nodes on which the job is to run. |
MOAB_PARTITION | Partition name in which the job is to run. |
MOAB_PROCCOUNT | Number of processors allocated to the job. |
MOAB_QOS | QoS name. |
MOAB_SUBMITDIR | Directory from which the job is submitted. |
MOAB_TASKMAP | Node list with tasks allocated to each node listed. <nodename>.<tasklist> |
MOAB_USER | User name. |
Custom Inputs are variables defined in the Custom Settings section of a job template. If you are creating a job template, Custom Inputs are variables you have defined. If you are creating a job, Custom Inputs are the variables defined by the designer of your selected job template. For example, the Nitro Application job template has a TASKFILE Custom Input variable that contains the name of the task file associated with the job.
Related Topics