]>

Customizing Platform LSF job query output format and reducing job query network traffic

The default bjobs command output provides basic job information. When you need additional job information, you may like the job output displayed line by line. Controlling the format of bjobs output can also make the output easily parsed by scripts and also reduce network traffic by transferring only the required information from mbatchd to the bjobs command.

LSF supports three ways to customize job query output and information returned from mbatchd:

The following job query output format is supported by LSB_BJOBS_FORMAT and bjobs -o:

"field_name[:[-][output_width]] ... [delimiter='character']"

Where:

field_name:   sets bjobs fields or aliases instead of the full field names, sets recommended width for the specified field, and sets right justification for the specific field

output_width:           sets output width for the specified field

delimiter:     sets the delimiting character to display between different headers and fields.

character:     a single character as delimiter. By default, the delimiter is a space.

Here are a few examples to show bjobs –o usage. See the IBM LSF Command Reference for detailed information about bjobs –o.

A single line output to display all spanning execution hosts for every job.

# bjobs  -o "jobid exec_host"

JOBID EXEC_HOST

2593 lsfrhel02:lsfrhel02:lsfrhel02

2594 lsfrhel02:lsfrhel02:lsfrhel02

2595 lsfrhel02:lsfrhel02:lsfrhel01:lsfrhel01:lsfrhel01

A single line output to display all spanning execution hosts for every job. Field exec_host is displayed right justified with a 50 character width.

 

# bjobs -o "jobid exec_host:-50"

JOBID                                          EXEC_HOST

2593                      lsfrhel02:lsfrhel02:lsfrhel02

2594                      lsfrhel02:lsfrhel02:lsfrhel02

2595  lsfrhel02:lsfrhel02:lsfrhel01:lsfrhel01:lsfrhel01

A single line output to display all spanning execution hosts for every job. Slash (/) is used as the delimiter for each field.

# bjobs -o "jobid exec_host delimiter='/'"

JOBID/EXEC_HOST

2593/lsfrhel02:lsfrhel02:lsfrhel02

2594/lsfrhel02:lsfrhel02:lsfrhel02

2595/lsfrhel02:lsfrhel02:lsfrhel01:lsfrhel01:lsfrhel01

With LSB_BJOBS_FORMAT defined in lsf.conf or defined as environment variable, the default output display of bjobs can be customized to show only the fields you want.

 

LSB_BJOBS_FORMAT="ID: STAT: QUEUE: USER: NAME: MAX_REQ_PROC: FIRST_HOST: CPU_USED:12 MEM: "

 

# bjobs

JOBID  STAT  QUEUE   USER   JOB_NAME   MAX_REQ_PROC FIRST_HOST  CPU_USED     MEM

2596   RUN   normal  user1  testrun    4            lsfrhel01   26 second(s) 2 Mbytes

2597   RUN   normal  user1  bigmem_run 100          lsfrhel02   1 second(s)  2 Mbytes