Customize host information output
By default, the bhosts command displays a predefined set of host information. While you can use various bhosts options to display specific host information based on your needs, you can also customize the specific fields that bhosts displays. Customize output to create a specific bhosts output format that shows all the required information so you can easily parse the information by using custom scripts or to display the information in a predefined format.
Use the LSB_BHOSTS_FORMAT parameter in lsf.conf or the LSB_BHOSTS_FORMAT runtime environment variable to define the default bhosts output format for LSF:
LSB_BHOSTS_FORMAT="field_name[:[-][output_width]] ... [delimiter='character']"
Use the bhosts -o option to define the custom output at the command level:
bhosts ... -o "field_name[:[-][output_width]] ... [delimiter='character']"
The following alternative method of using bhosts -o is useful for special delimiter characters in a csh environment (for example, $):
bhosts ... -o 'field_name[:[-][output_width]] ... [delimiter="character"]'
- Specify which bhosts fields (or aliases instead of the full field names), in which order, and with what width to display.
- Specify only the bhosts field name or alias to set its output to unlimited width and left justification.
- (Available starting in Fix Pack 14) Specify all to display all fields. Specify the colon (:) with an output width that applies to all fields.
- Specify the colon (:) without a width to set the output width to the recommended width for that field.
- Specify the colon (:) with a width to set the maximum number of characters to display for the field. When its value exceeds this width, bhosts truncates the ending characters.
- Specify a hyphen (-) to set right justification when bhosts displays the output for the specific field. If not specified, the default is to set left justification when bhosts displays the output for a field.
- Specify
a second colon (:) with a unit to specify a unit prefix for the output for
the following fields: mem, max_mem,
avg_mem, memlimit,
swap, swaplimit,
corelimit, stacklimit, and
hrusage (for hrusage, the unit prefix is
for mem and swap resources only).
This unit is KB (or K) for kilobytes, MB (or M) for megabytes, GB (or G) for gigabytes, TB (or T) for terabytes, PB (or P) for petabytes, EB (or E) for exabytes, ZB (or Z) for zettabytes), or S to automatically adjust the value to a suitable unit prefix and remove the "bytes" suffix from the unit. The default is to automatically adjust the value to a suitable unit prefix, but keep the "bytes" suffix in the unit.
The display value keeps two decimals but rounds up the third decimal. For example, if the unit prefix is set to G, 10M displays as 0.01G.
The unit prefix specified here overrides the value of the LSB_UNIT_FOR_JOBS_DISPLAY environment variable, which also overrides the value of the LSB_UNIT_FOR_JOBS_DISPLAY parameter in the lsf.conf file.
- Use delimiter= to set the delimiting character to display between different headers and fields. This delimiter must be a single character. By default, the delimiter is a space.
The bhosts -o option overrides the LSB_BHOSTS_FORMAT environment variable, which overrides the LSB_BHOSTS_FORMAT setting in lsf.conf.
- LSB_BHOSTS_FORMAT and bhosts -o both apply to output for the bhosts command with no options, and for bhosts options with output that filter information, including the following options: -a, -alloc, -cname, -R, -x, -X.
- LSB_BHOSTS_FORMAT and bhosts -o do not apply to output for bhosts options that use a modified format, including the following options: -aff, -e, -l, -s, -w.
The following are the field names used to specify the bhosts fields to display, with valid widths and any supported aliases (which you can use instead of the field names). Units of measurement for the fields are an automatically chosen units of bytes (such as gigabytes, megabytes, and so on), depending on the field name.
Field name | Width | Alias |
---|---|---|
host_name | 20 | hname |
status | 15 | stat |
cpuf | 10 | |
jl_u | 8 | jlu |
max | 8 | |
njobs | 8 | |
run | 8 | |
ssusp | 8 | |
ususp | 8 | |
rsv | 8 | |
dispatch_window | 50 | dispwin |
ngpus | 8 | ng |
ngpus_alloc | 8 | ngu |
ngpus_excl_alloc | 8 | ngx |
ngpus_shared_alloc | 8 | ngs |
ngpus_shared_jexcl_alloc | 8 | ngsjx |
ngpus_excl_avail | 8 | ngfx |
ngpus_shared_avail | 8 | ngfs |
attribute | 50 | attr |
mig_alloc | 5 | |
comments Note: If combined with the bhosts -json option,
this field displays full details of host closure events such as event time, administrator ID, lock
ID, and comments, as shown in the bhosts -l option.
|
128 | |
available_mem (Available starting in Fix Pack 14) |
15 | |
reserved_mem (Available starting in Fix Pack 14) |
15 | |
total_mem (Available starting in Fix Pack 14) |
15 |
Field names and aliases are not case-sensitive. Valid values for the output width are any positive integer 1 - 4096.
Remove column headings from the host information output
Use the bhosts -noheader option to remove column headings from the bhosts output. When bhosts -noheader is specified, bhosts displays the values of the fields without displaying the names of the fields. This option is useful for script parsing, when column headings are not necessary.
This option applies to output for the bhosts command with no options, and to output for all bhosts options with output that uses column headings, including the following options: -a, -alloc, -cname, -e, -o, -R, -s, -w, -x, -X.
This option does not apply to output for bhosts options that do not use column headings, including the following options: -aff, -json, -l.
View customized host information in JSON format
Use the bhosts -json option to view the customized bhosts output in JSON format. Since JSON is a customized output format, you must use the bhosts -json option together with the -o option.