3.0 Scheduler Commands > Commands > msub > Applying the msub Submit Filter

Conventions

Applying the msub Submit Filter

When using msub to submit a job by specifying a job script, msub processes that script and then sends an XML representation of the job to the Moab scheduler. It is possible to change the job XML before it is sent to Moab via an msub submission filter.

The filter gives administrators the ability to customize the submission process. Customization may be helpful if jobs should have certain defaults assigned to them, if an administrator wants to keep detailed submission statistics, or if an administrator wants to change job requests based on custom needs.

The submit filter, which must be written by an administrator, is a simple executable or script that receives XML via its standard input and then returns the modified XML in its standard output. To see the schema for job submission XML, please refer to Submitting Jobs via msub in XML.

Sample Submit Filter Script

#!/usr/bin/perl
use strict;

## Simple filter example that re-directs the output to a file.

my $file = "xmllog.out";

open FILE,">>$file" or die "Couldn't open $file: $!";
while (<>)
{
print FILE;
print;
}
close FILE;

The script is executed by the user running msub.

To configure msub to use the submit filter, each submission host must have access to the submit filter script. Also, you must add a SUBMITFILTER parameter to the Moab configuration file (moab.cfg) on each submission host. The following exemplifies how you might modify the moab.cfg file:

SUBMITFILTER /home/submitfilter/filter.pl

If you experience problems with your submit filter and want to debug its interaction with msub, enter msub --loglevel=9, which causes msub to print verbose log messages to the terminal.

Global job submit filter

To configure Moab to automatically apply a filter to all job submissions, use the SERVERSUBMITFILTER parameter. SERVERSUBMITFILTER specifies the path to a global job submit filter script, which Moab will run on the head node and apply to every job submitted.

SERVERSUBMITFILTER /opt/moab/scripts/jobFilter.pl

Moab runs jobFilter.pl, located in the /opt/moab/scripts directory, on the head node, applying the filter to all jobs submitted.