This chapter describes how you can create batch requests. The following topics are covered:
What batch requests are (“What Are Batch Requests?”)
Creating requests (“Creating Requests”)
Deciding what to include (“Deciding What to Include”)
Specifying options within requests (“Specifying Request Options”)
|Note: To use NQE, you must ensure that environment variables are set as described in Chapter 2, “Preparing to Use NQE”. You also must ensure that NQS validation and NQE database authorization requirements are met as described in Chapter 2, “Preparing to Use NQE”.|
A batch request is a set of commands submitted to NQE for execution. The request is executed independently of any interactive terminal connection. The batch request is essentially a shell script, but it also can include directions to NQS, file transfer requests, and even your programs.
NQS directives are request submission options that tell NQS how to process your request. They have the same format as cqsub options, except that they are preceded by the string #QSUB. See “Specifying Request Options”, for a description of NQS directives.
You can create a batch request in one of the following ways:
Put the commands in a file, which is called a shell script. You can submit the file by using the NQE GUI Submit window, the cqsub command, or the qsub command.
Enter your commands in the job edit area of the NQE GUI Submit window, and let NQE create the request from these commands.
Enter your commands at your terminal login prompt, and let NQE create the request from these commands.
The method that you use depends on the purpose of your request. Batch requests often contain work that you want to reproduce. You can put such work in a file and submit it as often as necessary.
Many sites have templates for requests that set the correct parameters for users. To see whether this is true, check with your support personnel.
To create and edit request files, use any UNIX editor (such as vi(1)). You can name your files whatever you choose.
To enter commands in the job edit area of the NQE GUI Submit window, enter the nqe command at your terminal prompt to invoke the NQE GUI, and click on the Submit button (using the left mouse button). In the job edit area of the Submit window, enter the commands, and then click on the Submit action button that is located at the bottom of the window. For detailed information about submitting requests, see Chapter 4, “Submitting Requests”.
To enter commands at your terminal login prompt, enter the cqsub or qsub command without a batch request file name, enter the commands, and then press CONTROL-d, as shown in the following example:
% cqsub ls date CONTROL-d
|Note: When using the command line interface, if you make an error halfway through entering a request and do not find the error until after you have started the next line, you cannot return and correct the error. To terminate the cqsub command and start again, press CONTROL-c.|
When you submit requests by entering commands in the job edit area of the NQE GUI Submit window or at your terminal login prompt, NQS names them STDIN. You can change the name of your request. If you use the NQE GUI, select General Options of the Configure menu on the NQE GUI Submit window. If you use the command line interface, use the cqsub -r or qsub -r command.
If you check the request status, you will see the name of your request. The name of your request also is used in your output file names. For more information about monitoring the status of your requests, see Chapter 10, “Monitoring Requests”. For more information about output file names, see “Naming Output Files” in Chapter 6.
Your batch request can contain any commands that you can enter when logged in interactively. However, you should keep the following special considerations in mind:
Many factors participate in determining when your request executes. Including NQS directives in a request can help you control these factors. See “Specifying Request Options”, for a description of the NQS directives.
You cannot provide input to commands that require an interactive response. Do not put such commands in a batch request, unless you redirect standard input.
The UNIX shell used to execute NQS batch requests may not be the same as your interactive login shell. Therefore, the results of batch request execution may differ from interactive execution of the commands in the request file. For more information on NQS and shells, see “Specifying a Shell” in Chapter 5.
You can specify options for your request in the following ways:
If you use the command line interface, you specify cqsub or qsub command options on the command line. You do not have to include the directives in your batch request file, although you must reenter the options each time you submit the request.
If you use a batch request file, you can embed the options at the beginning of the file. You must prefix these options by the string #QSUB; when they are embedded in a batch request file, these options are referred to as NQS directives.
|Note: Options specified through the NQE GUI or command line interface override embedded #QSUB NQS directives.|
If you use the NQE GUI, you can specify these options by using the Submit window Configure menu options and then save them to be reused as needed. You do not have to include the directives in your batch request file. To save the request-related options, select Save Current Job Profile on the Configure menu of the Submit window.
Specifying request-related options gives you the following benefits:
You can avoid re-specifying options. Many of the options you specify are always required by your request. It is more convenient to define these options once by using the NQE GUI or by embedding them at the beginning of your batch request file so that you do not have to enter them each time you submit the request.
Examples of such options are as follows:
You can override these options for unique cases. For example, you may want to specify a time to submit your request during off-peak hours because it less expensive at your site. You can do this in the following ways:
Your request's resource requirements (see “Using Resource Limits” in Chapter 5)
Specific request attributes, such as applications it uses (see “Using Request Attributes” in Chapter 4)
Which shell to use (see “Specifying a Shell” in Chapter 5)
The name of a queue you want to use (see “Specifying an NQS Queue” in Chapter 5)
Output file names and location (see Chapter 6, “Working with Output Files”)
Requests for mail when specific events occur (see “Using NQS Mail” in Chapter 4)
Password prompting if NQS requires it (see “Using Password Prompting” in Chapter 5)
Another user name for request execution (see “Using Alternative User Names” in Chapter 5)
If you use the command line interface, use the -a option on the cqsub or qsub command line. Options you change on the command line take precedence over any options in the script file.
If you use the NQE GUI, use the Submit window Configure menu Run After option. Specify a different time, apply the change, and submit your request. If you do not select Save Current Job Profile on the Configure menu of the Submit window, your changes will not be saved to be reused. Options you indicate on the Configure menu of the Submit window take precedence over any options in the script file.
If you embed options (NQS directives) in a request file, they must come before the first executable line. Each directive must be on a separate line, and you must prefix each line by the string #QSUB. The following example shows NQS directives embedded in a request file to set the conditions indicated by the comments:
#QSUB -eo #merge stdout and stderr #QSUB -J m #append NQS job log to stdout #QSUB -o "%[email protected]/nppa_latte:/home/gale/fred/eve.jjob.output" #returnsstdout to fred as eve.jjob.output at the host gale #QSUB -me #sends mail to submitter at completion #QSUB #optional qsub delimiter echo job start date #prints date rft -user eve -host nppa_latte -nopassword -function get jan.data nqs.data #use FTA to transfer jan.data and name it nqs.data cc loop.c -o prog.out #compile loop.c and name executable prog.out ./prog.out #execute prog.out rm -f loop.c prog.out jan.data nqs.data #delete files echo job complete
If you do not want to embed options (NQS directives) in a request file, use the NQE GUI to select all request-related options. To save the options, select Save Current Job Profile on the Configure menu of the Submit window. If you have an existing file of options (job profile file), you can load the content of that file to be used with your request by selecting Load New Job Profile on the Configure menu of the Submit window.