LSF batch queues hold jobs in LSF batch and according to scheduling policies and limits on resource usage.
lsb_queueinfo() gets information about the queues in LSF batch. This includes:
The example program in this section uses lsb_queueinfo() to get the queue information:
lsb_queueinfo() has the following parameters:
char **queues; Array containing names of queues of interestint *numQueues; Number of queueschar *hostname; Specified queues using hostnamechar *username; Specified queues enabled for userint options; Reserved for future use; supply 0
To get information on all queues, set *numQueues to 0. If *numQueues is 1 and queue is NULL, information on the default system queue is returned.
If hostname is not NULL, then all queues using host hostname as a batch server host will be returned. If username is not NULL, then all queues allowing user username to submit jobs to will be returned.
On success, lsb_queueinfo() returns an array containing a queueInfoEnt structure (see below) for each queue of interest and sets *numQueues to the size of the array. On failure, lsb_queueinfo() returns NULL and sets lsberrno to indicate the error.
The queueInfoEnt structure is defined in lsbatch.h as
struct queueInfoEnt {char *queue; Name of the queuechar *description; Description of the queueint priority; Priority of the queueshort nice; Value that runs jobs in the queuechar *userList; Users allowed to submit jobs to the queuechar *hostList; Hosts that can run jobs in the queueint nIdx; Size of the loadSched and loadStop arraysfloat *loadSched; Load thresholds that control scheduling of jobfrom the queuefloat *loadStop; Load thresholds that control suspension ofjobs from the queueint userJobLimit; Number of unfinished jobs a user can dispatchfrom the queueint procJobLimit; Number of unfinished jobs the queue candispatch to a processorchar *windows; Queue run windowint rLimits[LSF_RLIM_NLIMITS]; Per-process resource limits forjobschar *hostSpec; Obsolete. Use defaultHostSpec insteadint qAttrib; Attributes of the queueint qStatus; Status of the queueint maxJobs; Job slot limit of the queue.int numJobs; Total number of job slots required by all jobsint numPEND; Number of job slots needed by pending jobsint numRUN; Number of jobs slots used by running jobsint numSSUSP; Number of job slots used by systemsuspended jobsint numUSUSP; Number of jobs slots used by usersuspended jobsint mig; Queue migration threshold in minutesint schedDelay; Schedule delay for new jobsint acceptIntvl; Minimum interval between two jobs dispatchedto the same hostchar *windowsD; Queue dispatch windowchar *nqsQueues; Blank-separated list of NQS queue specifierschar *userShares; Blank-separated list of user shareschar *defaultHostSpec; Value of DEFAULT_HOST_SPEC for thequeue in lsb.queuesint procLimit; Maximum number of job slots a job can takechar *admins; Queue level administratorschar *preCmd; Queue level pre-exec commandchar *postCmd; Queue’s post-exec commandchar *requeueEValues; Queue’s requeue exit statusint hostJobLimit; Per host job slot limitchar *resReq; Queue level resource requirementint numRESERVE; Reserved job slots for pending jobsint slotHoldTime; Time period for reserving job slotschar *sndJobsTo; Remote queues to forward jobs tochar *rcvJobsFrom; Remote queues which can forward to mechar *resumeCond; Conditions to resume jobschar *stopCond; Conditions to suspend jobschar *jobStarter; Queue level job starterchar *suspendActCmd; Action commands for SUSPENDchar *resumeActCmd; Action commands for RESUMEchar *terminateActCmd; Action commands for TERMINATEint sigMap[LSB_SIG_NUM]; Configurable signal mappingchar *preemption; Preemption policyint maxRschedTime; Time period for remote cluster to schedule jobstruct shareAcctInfoEnt *shareAccts; Array of shareAcctInfoEntchar *chkpntDir; chkpnt directoryint chkpntPeriod; chkpnt periodint imptJobBklg; Number of important jobs kept in the queueint defLimits[LSF_RLIM_NLIMITS]; LSF resource limits (soft)int chunkJobSize; Maximum number of jobs in one chunkint minProcLimit; Minimum processor limitint defProcLimit; Default processor limitchar *fairshareQueues;char *defExtSched; Default external schedulingchar *mandExtSched; Mandatory external schedulingint slotShare; The share of cpus to use in the poolchar *slotPool; The cpu pool nameint underRCond;int overRCond;float idleCond;int underRJobs;int overRJobs;int idleJobs;int warningTimePeriod; Warning time period in secondschar *warningAction; Warning action, SIGNAL | CHKPNT | command */char *qCtrlMsg; AdminAction - queue control message*/char *acResReq;int symJobLimit; Limit of running service job/symphony job*/char *cpuReq; cpu_req for service partition of symphony */int proAttr; Indicates willingness to donate/borrowint lendLimit; Grace period to lend/return idle hostsint hostReallocInterval; Grace period to lend/return idle hostsint numCPURequired; Number of cpus required by CPU provisionint numCPUAllocated; Number of cpus actually allocatedint numCPUBorrowed; Number of cpus borrowedint numCPULent; Number of cpus lent/* the number of reserved cpu(numCPUReserved) = numCPUAllocated - numCPUBorrowed + numCPULent *//* the following fields are for real-time app(ex. murex) of symphony */int schGranularity; Scheduling granularity in millisecondsint symTaskGracePeriod; Grace period for stopping symphony tasksint minOfSsm; Minimum number of ssmint maxOfSsm; Maximum number of ssmint numOfAllocSlots; Number of allocated slotschar *servicePreemption; Service preemptin policyint provisionStatus; Dynamic cpu provision statusint minTimeSlice; Minimal time for preemt. backfill (sec)char *queueGroup; List of queues defined in QUEUE_GROUPint numApsFactors;struct apsFactorInfo *apsFactorInfoList;struct apsFactorMap *apsFactorMaps; Mapping from factors to subfactorsstruct apsLongNameMap *apsLongNames; Mapping from factors to their long namesint maxJobPreempt; Maximum number of job preempted timesint maxPreExecRetry; Maximum number of pre-exec retry timesint localMaxPreExecRetry; Maximum number of pre-exec retry times for local clusterint maxJobRequeue; Maximum number of job re-queue timesint usePam; Use Linux-PAMint cu_type_exclusive; Compute unit typechar *cu_str_exclusive; String specified in EXCLUSIVE=CU[<string>]};
The variable nIdx is the number of load threshold values for job scheduling. This is the total number of load indices returned by LIM. The parameters sndJobsTo, rcvJobsFrom, and maxRschedTime are used with LSF MultiCluster. The variable chunkJobSize must be larger than 1.
For a complete description of the fields in the queueInfoEnt structure, see the lsb_queueinfo() man page.
Include lsbatch.h in every application that uses LSBLIB functions. lsf.h does not have to be explicitly included in your program because lsbatch.h includes lsf.h.
Like the data structures returned by LSLIB functions, the data structures returned by an LSBLIB function are dynamically allocated inside LSBLIB and are automatically freed next time the same function is called. Do not attempt to free the space allocated by LSBLIB. To keep this information across calls, make your own copy of the data structure.
The program below takes a queue name as the first argument and displays information about the named queue.
/******************************************************* LSBLIB -- Examples** simbqueues* Display information about a specific queue in the* cluster.* (Queue name is given on the command line argument)* It is similar to the command "bqueues QUEUE_NAME".******************************************************/# include <lsf/lsbatch.h>int main (int argc, char *argv[]){struct queueInfoEnt *qInfo;char *queues;/* take the command line argument as the queue name */int numQueues = 1;/* only 1 queue name in the array queue */char *host = NULL;/* all queues are of interest */char *user = NULL;/* all queues are of interest */int options = 0;/* check if input is in the right format: "./simbqueuesQUEUENAME" */if (argc != 2) {printf("Usage: %s queue_name\n", argv[0]);exit(-1);}queues = argv[1];/* initialize LSBLIB and get the configuration environment */if (lsb_init(argv[0]) < 0) {lsb_perror("simbqueues: lsb_init() failed");exit(-1);}/* get queue information about the specified queue */qInfo = lsb_queueinfo(&queues, &numQueues, host, user,options);if (qInfo == NULL) {lsb_perror("simbqueues: lsb_queueinfo() failed");exit(-1);}/* display the queue information (name, descriptions,priority, nice value, max num of jobs, num of PEND, RUN,SUSP and TOTAL jobs) */printf("Information about %s queue:\n", queues);printf("Description: %s\n", qInfo[0].description);printf("Priority: %d Nice: %d \n", qInfo[0].priority, qInfo[0].nice);printf("Maximum number of job slots:");if (qInfo->maxJobs < INFINIT_INT)printf("%5d\n", qInfo[0].maxJobs);elseprintf("%5s\n", "unlimited");printf("Job slot statistics: PEND(%d) RUN(%d) SUSP(%d) TOTAL(%d).\n", qInfo[0].numPEND, qInfo[0].numRUN, qInfo[0].numSSUSP + qInfo[0].numUSUSP, qInfo[0].numJobs);exit(0);} /* main */
In the above program, INFINIT_INT is defined in lsf.h and is used to indicate that there is no limit set for maxJobs. This applies to all Platform LSF API function calls. Platform LSF will supply INFINIT_INT automatically whenever the value for the variable is either invalid (not available) or infinity. This value should be checked for all variables that are optional. For example, if you display the loadSched/loadStop values, an INFINIT_INT indicates that the threshold is not configured and is ignored.
Similarly, lsb_perror() prints error messages regarding function call failure. You can check lsberrno if you want to take different actions for different errors.
The above program will produce output similar to the following: