📄 xcu_chap03.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title>Batch Environment Services</title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h2><a name="tag_03"></a>Batch Environment Services</h2><div class="box"><p><sup>[<a href="javascript:open_code('BE')">BE</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0">This chapter describes the services and utilities that shall be implemented on all systems that claim conformance to the BatchEnvironment Services and Utilities option. This functionality is dependent on support of this option (and the rest of this sectionis not further marked for this option). <img src="../images/opt-end.gif" alt="[Option End]" border="0"></p></div><h3><a name="tag_03_01"></a>General Concepts</h3><h4><a name="tag_03_01_01"></a>Batch Client-Server Interaction</h4><p>Batch jobs are created and managed by batch servers. A batch client interacts with a batch server to access batch services onbehalf of the user. In order to use batch services, a user must have access to a batch client.</p><p>A batch server is a computational entity, such as a daemon process, that provides batch services. Batch servers route, queue,modify, and execute batch jobs on behalf of batch clients.</p><p>The batch utilities described in this volume of IEEE Std 1003.1-2001 (and listed in <a href="#tagtcjh_6">BatchUtilities</a> ) are clients of batch services; they allow users to perform actions on the job such as creating, modifying, anddeleting batch jobs from a shell command line. Although these batch utilities may be said to accomplish certain services, theyactually obtain services on behalf of a user by means of requests to batch servers.<br></p><center><b><a name="tagtcjh_6"></a> Table: Batch Utilities</b></center><center><table cellpadding="3" align="center"><tr valign="top"><td align="left"><p class="tent"><br><a href="../utilities/qalter.html"><i>qalter</i></a><br><a href="../utilities/qdel.html"><i>qdel</i></a><br><a href="../utilities/qhold.html"><i>qhold</i></a><br> </p></td><td align="left"><p class="tent"><br><a href="../utilities/qmove.html"><i>qmove</i></a><br><a href="../utilities/qmsg.html"><i>qmsg</i></a><br><a href="../utilities/qrerun.html"><i>qrerun</i></a><br> </p></td><td align="left"><p class="tent"><br><a href="../utilities/qrls.html"><i>qrls</i></a><br><a href="../utilities/qselect.html"><i>qselect</i></a><br><a href="../utilities/qsig.html"><i>qsig</i></a><br> </p></td><td align="left"><p class="tent"><br><a href="../utilities/qstat.html"><i>qstat</i></a><br><a href="../utilities/qsub.html"><i>qsub</i></a><br> </p></td></tr></table></center><p>Client-server interaction takes place by means of the batch requests defined in this chapter. Because direct access to batchjobs and queues is limited to batch servers, clients and servers of different implementations can interoperate, since dependencieson private structures for batch jobs and queues are limited to batch servers. Also, batch servers may be clients of other batchservers.</p><h4><a name="tag_03_01_02"></a>Batch Queues</h4><p>Two types of batch queue are described: routing queues and execution queues. When a batch job is placed in a routing queue, itis a candidate for routing. A batch job is removed from routing queues under the following conditions:</p><ul><li><p>The batch job has been routed to another queue.</p></li><li><p>The batch job has been deleted from the batch queue.</p></li><li><p>The batch job has been aborted.</p></li></ul><p>When a batch job is placed in an execution queue, it is a candidate for execution.</p><p>A batch job is removed from an execution queue under the following conditions:</p><ul><li><p>The batch job has been executed and exited.</p></li><li><p>The batch job has been aborted.</p></li><li><p>The batch job has been deleted from the batch queue.</p></li><li><p>The batch job has been moved to another queue.</p></li></ul><p>Access to a batch queue is limited to the batch server that manages the batch queue. Clients never access a batch queue or abatch job directly, either to read or write information; all client access to batch queues or jobs takes place through batchservers.</p><h4><a name="tag_03_01_03"></a>Batch Job Creation</h4><p>When a batch server creates a batch job on behalf of a client, it shall assign a batch job identifier to the job. A batch jobidentifier consists of both a sequence number that is unique among the sequence numbers issued by that server and the name of theserver. Since the batch server name is unique within a name space, the job identifier is likewise unique within the name space.</p><p>The batch server that creates a batch job shall return the batch server-assigned job identifier to the client that requested thejob creation. If the batch server routes or moves the job to another server, it sends the job identifier with the job. Onceassigned, the job identifier of a batch job shall never change.</p><h4><a name="tag_03_01_04"></a>Batch Job Tracking</h4><p>Since a batch job may be moved after creation, the batch server name component of the job identifier need not indicate thelocation of the job. An implementation may provide a batch job tracking mechanism, in which case the user generally does not needto know the location of the job. However, an implementation need not provide a batch job tracking mechanism, in which case the usermust find routed jobs by probing the possible destinations.</p><h4><a name="tag_03_01_05"></a>Batch Job Routing</h4><p>To route a batch job, a batch server either moves the job to some other queue that is managed by the batch server, or requeststhat some other batch server accept the job.</p><p>Each routing queue has one or more queues to which it can route batch jobs. The batch server administrator creates routingqueues.</p><p>A batch server may route a batch job from a routing queue to another routing queue. Batch servers shall prevent or otherwisehandle cases of circular routing paths. As a deferred service, a batch server routes jobs from the routing queues that it manages.The algorithm by which a batch server selects a batch queue to which to route a batch job is implementation-defined.</p><p>A batch job need not be eligible for routing to all the batch queues fed by the routing queue from which it is routed. A batchserver that has been asked to accept the job may reject the request if the job requires resources that are unavailable to thatbatch server, or if the client is not authorized to access the batch server.</p><p>Batch servers may route high-priority jobs before low-priority jobs, but, on other than overloaded systems, the effect may beimperceptible to the user. If all the batch servers fed by a routing queue reject requests to accept the job for reasons that arepermanent, the batch server that manages the job shall abort the job. If all or some rejections are temporary, the batch servershould try to route the job again at some later point.</p><p>The reasons for rejecting a batch job are implementation-defined. The reasons for which the routing should be retried later andthe reasons for which the job should be aborted are also implementation-defined.</p><h4><a name="tag_03_01_06"></a>Batch Job Execution</h4><p>To execute a batch job is to create a session leader (a process) that runs the shell program indicated by the <i>Shell_Path</i>attribute of the job. The script shall be passed to the program as its standard input. An implementation may pass the script to theprogram by other implementation-defined means. At the time a batch job begins execution, it is defined to enter the RUNNING state.The primary program that is executed by a batch job is typically, though not necessarily, a shell program.</p><p>A batch server shall execute eligible jobs as a deferred service-no client request is necessary once the batch job is createdand eligible. However, the attributes of a batch job, such as the job hold type, may render the job ineligible. A batch servershall scan the execution queues that it manages for jobs that are eligible for execution. The algorithm by which the batch serverselects eligible jobs for execution is implementation-defined.</p><p>As part of creating the process for the batch job, the batch server shall open the standard output and standard error streams ofthe session.</p><p>The attributes of a batch job may indicate that the batch server executing the job shall send mail to a list of users at thetime it begins execution of the job.</p><h4><a name="tag_03_01_07"></a>Batch Job Exit</h4><p>When the session leader of an executing job terminates, the job exits. As part of exiting a batch job, the batch server thatmanages the job shall remove the job from the batch queue in which it resides. The server shall transfer output files of the job toa location described by the attributes of the job.</p><p>The attributes of a batch job may indicate that the batch server managing the job shall send mail to a list of users at the timethe job exits.</p><h4><a name="tag_03_01_08"></a>Batch Job Abort</h4><p>A batch server shall abort jobs for which a required deferred service cannot be performed. The attributes of a batch job mayindicate that the batch server that aborts the job shall send mail to a list of users at the time it aborts the job.</p><h4><a name="tag_03_01_09"></a>Batch Authorization</h4><p>Clients, such as the batch environment utilities (marked BE), access batch services by means of requests to one or more batchservers. To acquire the services of any given batch server, the user identifier under which the client runs must be authorized touse that batch server.</p><p>The user with an associated user name that creates a batch job shall own the job and can perform actions such as read, modify,delete, and move.</p><p>A user identifier of the same value at a different host need not be the same user. For example, user name <i>smith</i> at host<b>alpha</b> may or may not represent the same person as user name <i>smith</i> at host <b>beta</b>. Likewise, the same person mayhave access to different user names on different hosts.</p><p>An implementation may optionally provide an authorization mechanism that permits one user name to access jobs under another username.</p><p>A process on a client host may be authorized to run processes under multiple user names at a batch server host. Whereappropriate, the utilities defined in this volume of IEEE Std 1003.1-2001 provide a means for a user to choose from amongsuch user names when creating or modifying a batch job.</p><h4><a name="tag_03_01_10"></a>Batch Administration</h4><p>The processing of a batch job by a batch server is affected by the attributes of the job. The processing of a batch job may alsobe affected by the attributes of the batch queue in which the job resides and by the status of the batch server that manages thejob. See also the Base Definitions volume of IEEE Std 1003.1-2001, <a href="../basedefs/xbd_chap03.html">Chapter 3,Definitions</a> for batch definitions.</p><h4><a name="tag_03_01_11"></a>Batch Notification</h4><p>Whereas batch servers are persistent entities, clients are often transient. For example, the <a href="../utilities/qsub.html"><i>qsub</i></a> utility creates a batch job and exits. For this reason, batch servers notify users ofbatch job events by sending mail to the user that owns the job, or to other designated users.</p><h3><a name="tag_03_02"></a>Batch Services</h3><p>The presence of Batch Environment Services and Utilities option services is indicated by the configuration variable POSIX2_PBS.A conforming batch server provides services as defined in this section.</p><p>A batch server shall provide batch services in two ways:</p><ol><li><p>The batch server provides a service at the request of a client.</p></li><li><p>The batch server provides a deferred service as a result of a change in conditions monitored by the batch server.</p></li></ol><p>If a batch server cannot complete a request, it shall reject the request. If a batch server cannot complete a deferred servicefor a batch job, the batch server shall abort the batch job. <a href="#tagtcjh_7">Environment Variable Summary</a> is a summary ofenvironment variables that shall be supported by an implementation of the batch server and utilities.<br></p><center><b><a name="tagtcjh_7"></a> Table: Environment Variable Summary</b></center><center><table border="1" cellpadding="3" align="center"><tr valign="top"><th align="center"><p class="tent"><b>Variable</b></p></th><th align="center"><p class="tent"><b>Description</b></p></th></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_DPREFIX</i></p></td><td align="left"><p class="tent">Defines the directive prefix (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_ENVIRONMENT</i></p></td><td align="left"><p class="tent">Batch Job is batch or interactive (see <a href="#tag_03_02_02_01">Batch Job Execution</a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_JOBID</i></p></td><td align="left"><p class="tent">The <i>job_identifier</i> attribute of job (see <a href="#tag_03_02_03_08">Queue Batch Job Request</a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_JOBNAME</i></p></td><td align="left"><p class="tent">The <i>job_name</i> attribute of job (see <a href="#tag_03_02_03_08">Queue Batch Job Request</a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_HOME</i></p></td><td align="left"><p class="tent">Defines the <i>HOME</i> of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_HOST</i></p></td><td align="left"><p class="tent">Defines the host name of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_LANG</i></p></td><td align="left"><p class="tent">Defines the <i>LANG</i> of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_LOGNAME</i></p></td><td align="left"><p class="tent">Defines the <i>LOGNAME</i> of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_MAIL</i></p></td><td align="left"><p class="tent">Defines the <i>MAIL</i> of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_PATH</i></p></td><td align="left"><p class="tent">Defines the <i>PATH</i> of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_QUEUE</i></p></td><td align="left"><p class="tent">Defines the submit queue of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_SHELL</i></p></td><td align="left"><p class="tent">Defines the <i>SHELL</i> of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_TZ</i></p></td><td align="left"><p class="tent">Defines the <i>TZ</i> of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_O_WORKDIR</i></p></td><td align="left"><p class="tent">Defines the working directory of the batch client (see <a href="qsub.html"><i>qsub</i></a> )</p></td></tr><tr valign="top"><td align="left"><p class="tent"><i>PBS_QUEUE</i></p></td><td align="left"><p class="tent">Defines the initial execution queue (see <a href="#tag_03_02_02_01">Batch Job Execution</a> )</p></td></tr></table></center><h4><a name="tag_03_02_01"></a>Batch Job States</h4><p>A batch job shall always be in one of the following states: QUEUED, RUNNING, HELD, WAITING, EXITING, or TRANSITING. The state ofa batch job determines the types of requests that the batch server that manages the batch job can accept for the batch job. A batchserver shall change the state of a batch job either in response to service requests from clients or as a result of deferredservices, such as job execution or job routing.</p><p>A batch job that is in the QUEUED state resides in a queue but is still pending either execution or routing, depending on thequeue type.</p><p>A batch server that queues a batch job in a routing queue shall put the batch job in the QUEUED state. A batch server that putsa batch job in an execution queue, but has not yet executed the batch job, shall put the batch job in the QUEUED state. A batch jobthat resides in an execution queue and is executing is defined to be in the RUNNING state. While a batch job is in the RUNNINGstate, a session leader is associated with the batch job.</p><p>A batch job that resides in an execution queue, but is ineligible to run because of a hold attribute, is defined to be in theHELD state.</p><p>A batch job that is not held, but must wait until a future date and time before executing, is defined to be in the WAITINGstate.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -