Personal tools

4.5.2.2. PBS

Up one level
How to use and configure the supplied PBS platform scripts

The following sections describe how to configure the pre-supplied platform scripts for PBS. These scripts are working for a very basic PBS configuration. However, they can be very easily modified to adapt many customised PBS configurations. The basic PBS testbed platform we used to develop and test these scripts had the following configuration:

  • All PBS and GRIA services run on the same machine, i.e. pbs_server, pbs_sched, pbs_mom
  • There is a default PBS queue, e.g. dqueue
  • System users e.g. the GRIA user (tomcat) can submit and run simple PBS jobs

PBS platform scripts can be easily customised in the following sections:

Submit Job: startJob.pl

This is a perl script which can submit GRIA jobs to PBS. Customisation of this script will require modifications to the following:

  • SECTION A: Initialise Resource Manager global vars, such as path for PBS binaries, PBS server name, etc. In particular make sure that the following variables are set up correctly:
    • RM_PATH=<PBS binary path>
    • RM_SERVER=<PBS server name>
  • SECTION B: Turn verbose debug flags on/off. This step is optional.
  • SECTION C: This section generates a job description file (JDF), which is the file submitted to PBS to run the job. This section of the script should be adequate for simple PBS configurations. You should edit this part of code if you want to change any of the default PBS directives or change the way jobs are submitted.
    The PBS JDF file has two main parts, the first one describes all the PBS directives required to run the job. The second part of the file describes how to invoke the application wrapper, etc. This section of the code should be edited only when we have to pass specific PBS directives than the exiting ones or to parse RM directives passed with the -r arguments, i.e. see section E below. The default directives used in this script are:
    #PBS -N J${SESSION_NAME}
    #PBS -o job.out
    #PBS -e job.err
    #PBS -l     cput=3600
    #PBS -q dque
    ${raString} # see SECTION E
    ...
    The second part of the file describes how to invoke the application wrapper and how to, create time-stamp files, etc. This part of the code should cover a wider range of PBS configurations.
  • SECTION D: This section contains the PBS submit command. According to your PBS system configuration you may have to edit it only for customised PBS configurations that use multiple queues, PBS servers, etc. The example code in this section submits jobs to the default queue in the PBS server defined in SECTION A, e.g.
    # compose submit command to the default queue 
    my $command_line="$RM_SUBMIT -q \@$RM_SERVER $JDF";
    
    # execute the submit command and store submission job ID
    my $sub = 0xffff & system "$command_line > $JOB_PID";
  • SECTION E: This subroutine should parse command line arguments for the RM. It should return a text string with valid PBS directives that os attached in the JDF file PBS directives section, e.g. ${raString}. The current implementation of this subroutine returns an empty string. However, if you intend to pass RM directives dynamically using the -r command line arguments you should parse them in this subroutine and return them as a PBS directive string, e.g.
    ...
    #PBS cput=2300
    #PBS -l 2
    ...

Check Job: getJobStatus.pl

This is a perl script that checks and reports to GRIA the status of a PBS job. For most PBS configurations the editing of this script should be minimal:

  • SECTION A: Initialise Resource Manager global vars, such as path for PBS binaries, PBS server name, etc. In particular make sure that the following variables are set up correctly:
    • RM_PATH=<PBS binary path>
    • RM_SERVER=<PBS server>
  • SECTION B: Turn verbose debug flags on/off. This step is optional.
  • SECTION C: The first part of this section reads the status of the PBS job. According to your PBS configuration you may have to edit the code that grabs the job status, e.g. in a PBS qstat command the status of a job is always the 6th field, etc.
    my $qString = `${RM_QUEUE} | grep $concatPID`;
    my @words = &quotewords('\s+', 0, $qString);
    my $jStatus = $words[9];
    Unless the output format of qstat is different you do not need to change this section, e.g.
    Job id           Name             User             Time Use S Queue
    ---------------- ---------------- ---------------- -------- - -----
    74.siegerrebe    pm               tomcate           00:30 0 R dque

Kill Job: killJob

This is a perl script for terminating PBS jobs, the following parts of the code need editing:

  • SECTION A: Initialise Resource Manager global vars, such as path for PBS binaries, PBS server name, etc. In particular make sure that the following variables are set up correctly:
    • RM_PATH=<PBS binary path>
    • RM_SERVER=<PBS server>
  • SECTION B: Turn verbose debug flags on/off. This step is optional.
  • SECTION C: The first part of this section reads the status of the PBS job. According to your PBS configuration you may have to edit the code that grabs the job status, e.g. in a PBS qstat command the status of a job is always the 6th field, etc.
    my $qString = `${RM_QUEUE} | grep $concatPID`;
    my @words = &quotewords('\s+', 0, $qString);
    my $jStatus = $words[9];
    Unless the output format of qstat is different you do not need to change this section, e.g.
    Job id           Name             User             Time Use S Queue
    ---------------- ---------------- ---------------- -------- - -----
    74.siegerrebe    pm               tomcate           00:30 0 R dque