Uploaded image for project: 'JS - JobScheduler'
  1. JS - JobScheduler
  2. JS-1323

Plugin for global pre- and postprocessing

    XMLWordPrintable

    Details

      Description

      What it does

      • Currently monitors are configured on a per job basis and are included with a <job><monitor> element.
      • This feature allows to configure monitors for pre- and postprocessing at a global level. Monitors can be configured centrally and are automatically associated to jobs based on rules that are implemented by the plugin.
      • You wouldn't have to configure the same monitor(s) for a number of jobs. Instead, based on the location of the monitor(s) in the file system and a set of rules the corresponding monitors are automatically added to the respective jobs.

      How it works

      • A plugin is provided that allows the use of global Named Monitors for a number of jobs as provided by the JobScheduler features JS-1145 (Provide named monitors) and JS-1322 (Plugin interface for loading jobs).
      • The plugin is executed by JobScheduler when loading jobs.
        • JobScheduler hands over the job configuration to the plugin.
        • The plugin selects a number of Named Monitors based on its configuration.
        • The plugin returns the job configuration to JobScheduler having added a <monitor.use> element for each applicable monitor.

      Configuration

      • The plugin implements configurable rules for the use of Named Monitors as stated in JS-1145 for
        • selection by patterns (regular expressions)
        • recursive use starting from a configurable directory
      <plugins>
      			<plugin java_class="com.sos.scheduler.plugins.globalmonitor.GlobalMonitorPlugin">
      			<plugin.config>
      			<jobparams>
      				<param name="configuration_directory" value="C:/Users/ur/Documents/sos-berlin.com/jobscheduler/scheduler_current/config/live"/>
      				<param name="exclude_dir" value="sos"/>
      				<param name="exclude_file" value="Neuer Ordner/job1"/>
      				<param name="recursive" value="true"/>
      				<param name="regex_selector" value="^job.*$"/>
      			</jobparams>
      			<monitorparams>
      				<param name="exclude_dir" value="sos"/>
      				<param name="exclude_file" value="fileExclusions"/>
      				<param name="recursive" value="true"/>
      				<param name="regex_selector" value="^global_.*$"/>
      			</monitorparams>
      			</plugin.config>
      			</plugin>
       
      
        • ordering
          • for pre-processing Named Monitors from outer folders are applied before those from inner folders
          • for postprocessing Named Monitors from inner folders are applied before those from outer folders
          • the ordering will be assigned by setting the ordering attribute in the use named monitor files.
      • All named monitors that comply with the configured rules are applied.
      • The plugin decides whether or not the job should be changed. The plugin therefore creates a list with the jobs that are to be handled. The plugin uses the following parameters to do this
        • a static directory
        • recursiv yes/no
        • a regular expression that defines the jobs to be handled.
        • an exclusion list for jobs
        • an exclusion list for directories

      Ordering of monitors

      • suppose the job is in the folder a/b/c
        • all before_process monitors in a will be executed before monitors in b and c
        • all after_process monitors in c will be executed before monitors in b and a
        • for all monitors in one folder the ordering atttribute will have an effect for the monitors in the current folder.

      Handling of result code

      • All after monitors will be executed
      • Even if one after monitore returns false
      • The return value of the last after monitor sets the return value of the job
      • The value of spooler_process_reusult is coming from the monitore that was executed before the current monitor.
      • If one of the before monitors returns false no more monitors will be executed.

      Example for recursive use with specific job directories

      • Configuration sample for jobs
        directory=live
        recursive=true
        regex=^job_.*\.job.xml$
        exclude_dir=sos
        
      • Behavior
        • All job names that begin with job_ will be included in the list. Jobs in the directory live/sos will be excluded.
      • Explanations
        • If the current job is included in the list then the plugin will modify the <monitor.use> list in the job definition. The plugin makes use of the following parameters to create the list of monitors:
          • use_parent_folders=true: gather all monitors from the parent folder
          • a regular expression to define the set of the monitors.

      Example for use with monitors from a parent folder

      • Configuration sample for monitors
        use_parent_folders=true
        regex=^global_.*\.monitor.xml$
        
      • Behavior
        • All monitor names in the directory of the current job that begin with global_ will be included in the list.
      • Explanations
        • The parameters are specified with the plugin configuration.
        • The directory name is assumed to begin with $SCHEDULER_HOME/config/live, therefore the value sos is translated to $SCHEDULER_HOME/config/live/sos.

      Complete Configuration Examples

      1. Use exclusively parent folders for monitors. All job names in the live folder that begin with job_ will be handled, except for jobs in the folder live/sos,
        <spooler xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.sos-berlin.com/repository/scheduler/1.9/scheduler.xsd">
            <config>
                <plugins>
                    <plugin java_class="...ConfigurationModifierPlugin">
                        <plugin.config>
                                <jobs>
                                    <param name="configuration_directory" value="live"/>
                                    <param name="regex_selector" value="^job_.*\.job.xml$"/>
                                    <param name="exclude_dir" value="sos"/>                           
                                    <param name="exlude_file" value="xxx"/>
                                </jobs>
                                <monitors>
                                    <param name="recursive" value="true"/>
                                </monitors>
                        </plugin.config>
                    </plugin>
                </plugins>
            </config>
        </spooler>
        
      2. Use a regular expression to filter applicable monitors
        <spooler xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.sos-berlin.com/repository/scheduler/1.9/scheduler.xsd">
            <config>
                <plugins>
                    <plugin java_class="...ConfigurationModifierPlugin">
                        <plugin.config>
                                <jobs>
                                    <param name="configuration_directory" value="live"/>
                                    <param name="regex_selector" value="^job_.*\.job.xml$"/>
                                    <param name="exclude_dir" value="sos"/>
                                </jobs>
                                <monitors>
                                    <param name="recursive" value="true"/>
                                    <param name="regexSelector" value="^global_.*\.monitor.xml$"/>
                                </monitors>
                        </plugin.config>
                    </plugin>
                </plugins>
            </config>
        </spooler>
        
      3. Use exclusively named monitors located in the directory of the current job
        <spooler xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.sos-berlin.com/repository/scheduler/1.9/scheduler.xsd">
            <config>
                <plugins>
                    <plugin java_class="...ConfigurationModifierPlugin">
                        <plugin.config>
                                <jobs>
                                    <param name="configuration_directory" value="."/>
                                    <param name="regex_selector" value="^job_.*\.job.xml$"/>
                                    <param name="exclude_dir" value="sos"/>
                                </jobs>
                                <monitors>
                                    <param name="recursive" value="false"/>
                                </monitors>
                        </plugin.config>
                    </plugin>
                </plugins>
            </config>
        </spooler>
        
      4. Use an exclusion list (e.g. live/sos)
        <spooler xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.sos-berlin.com/repository/scheduler/1.9/scheduler.xsd">
            <config>
                <plugins>
                    <plugin java_class="...ConfigurationModifierPlugin">
                        <plugin.config>
                                <jobs>
                                    <param name="configuration_directory" value="live"/>
                                    <param name="regex_selector" value="^job_.*\.job.xml$"/>
                                    <param name="exclude_dr" value="sos"/>
                                </jobs>
                                <monitors>
                                    <param name="recursive" value="false"/>
                                </monitors>
                        </plugin.config>
                    </plugin>
                </plugins>
            </config>
        </spooler>
        
      5. Use monitors recursively
        <spooler xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.sos-berlin.com/repository/scheduler/1.9/scheduler.xsd">
            <config>
                <plugins>
                    <plugin java_class="...ConfigurationModifierPlugin">
                        <plugin.config>
                                <jobs>
                                    <param name="configuration_directory" value="live"/>
                                    <param name="regex_selector" value="^job_.*\.job.xml$"/>
                                    <param name="exclude_dir" value="sos"/>
                                    <param name="recursive" value="true"/>
                                </jobs>
                                <monitors>
                                    <param name="recursive" value="true"/>
                                </monitors>
                        </plugin.config>
                    </plugin>
                </plugins>
            </config>
        </spooler>
        

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ur Uwe Risse
                Reporter:
                ap Andreas PĆ¼schel
                Approver:
                Uwe Risse
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 1 week, 3 days
                  1w 3d
                  Remaining:
                  Remaining Estimate - 1 week, 3 days
                  1w 3d
                  Logged:
                  Time Spent - Not Specified
                  Not Specified