Example Scripts

The batch/examples directory contains a handful of example scripts that are intended to act as guides for writing scripts of your own. They can be run using the same run.bat or run.pl  script described in Writing Scripts and Interactive Mode.

./run.pl examples/delete_all.py

The following examples are included in the directory:

  • delete_all.py: This script deletes each scheduler and business area one at a time, using the schedulers(), delete_scheduler(), business_areas(), and delete_business_area() commands.

  • add_every_jobstream.py: This script uses the potential_jobstreams() and add_jobstream() commands to create a jobstream for every potential target job.

  • help.py:This script simply prints the result of the help() command, which summarizes all the available commands and their options.

  • export.py:This more complicated script uses several commands, as well as direct inspection of the Java objects they return, to generate a script which can reproduce the Automation Analytics & Intelligence configuration.

  • add_jobstream.py: Script creates a single jobstream, taking parameters for the name of the target job, scheduler, jobstream, and business area.

  • job_impact_report.py: Generate a report showing details of all jobs which ran as successors to the most recent run of a particular job.

    • Parameters:
      • job name

      • scheduler

      • name

      • time span (defaults to '24:00:00')

      • include jobs that have no runs (true or false; defaults to true)

  • processing_load_detail.py:Reports on all jobs by scheduler that either have a start_time, end_time or are running within the date range provided. The details of the report include job name, start time, running time, end time, and termination status.

    • Parameters:
      • from_time: (required) - start of the range of included times, in the format handled by parse_date(); "yyyy/mm/dd hh:mm:ss zzz"

      • to_time: (required) - end of the range of included times, in the format handled by parse_date(); "yyyy/ mm/dd hh:mm:ss zzz"

      • scheduler: (optional) - name of the scheduler that defines the job; default: None, to use the one and only scheduler

      • runs: (optional) - number of runs per scheduler to include in the report. Default is 500.

  • running_streams: The running jobstreams script provides a way to query Automation Analytics & Intelligence for currently running jobstreams, as well as historical runs of those streams.

    • Usage - To run the script, go to the “batch” subdirectory under the Automation Analytics & Intelligence installation directory, and execute the command run examples/running_streams.py  with appropriate additional parameters as explained below.
    • Parameters - All command-line parameters are supplied as a pair of the form <name> <value>. Login parameters and their defaults are as follows:
      • -server 'localhost'
      • -port 8080
      • -user 'admin'
      • -password 'password'
      • -domain 'JAWS'
    • Other optional parameters are:

      • -b: <area>:will show only jobstreams in a particular business area
      • -h N:will show up to N historical runs of each running jobstream
      • -s: <jobstream_name>will show information for a particular jobstream only (the default is to show all running jobstreams)
      • -d: true: will show detailed output
      • -f: <tab|csv|xml>:output in csv or xml format (tab-separated is the default)

run examples\running_streams.py –user admin –password password –f xml

  • find_jobs.py: The find jobs script provides a way to flexibly query Automation Analytics & Intelligence for jobs based on the values of various attributes. In addition, an option is provided to show information on the most recent run of the selected jobs.

    • Usage - To run the script, go to the "batch" subdirectory under the Automation Analytics & Intelligence installation directory, and execute the command run examples/find_jobs.py with appropriate additional parameters as explained below.
    • Parameters - All command-line parameters are supplied as a pair of the form <name> <value>. Login parameters and their defaults are as follows:
      • -server 'localhost'
      • -port 8080
      • -user 'admin'
      • -password 'password'
      • -domain 'JAWS'
    • In addition to login parameters, at least one other parameter from the ones below must be supplied.

      • -show_runs true:will show the most recent run for matching jobs
      • -csv true:will output information in a comma-separated format
      • -file <filename>:will output information to a file

      Job attribute parameters are job attributes followed by quoted text expressions to match with the at- tribute, for instance -job_name "long*". The asterisk '*' is a wildcard matching any number of characters. To specify an asterisk character (i.e. not used as a wildcard) precede the asterisk with a backslash.

      Example: run examples/find_jobs.py –user admin –password password –job_name “long*” – show_runs true

  • system_check.py:Displays the system status of several different server components.

For more information about specific commands, see Commands for the CLI and Scripts.