Jobstream Commands

This page includes the following:

add_jobstream()

Add a new jobstream in the root business area.

Parameters:

  • target_job_name - name of the job which defines the jobstream

  • scheduler (optional) - name of the scheduler containing the target job (required if more than one scheduler is defined)

    Default: None

  • name (optional) - if not provided, the target job name is used

    Default: None

  • monitorable (optional) - True if the jobstream being added should appear in the monitoring tab when the jobstream is running

    Default: True

  • since_date (optional) - include only runs since this date, in the format understood by parse_date() ('2007/1/15 13:21:00 MST')

    Default: None - include all history, see parse_date()

  • areas (optional) - list of names of business areas to add the jobstream under

    Default: None - the stream is added to the root domain

  • included_trim_points (optional) - list of names or tuples (job name, scheduler name, sched_id for CA7) of jobs whose predecessors are not part of the jobstream

    Default: [ ]

    Note: If only a job name is given, the trim point is assumed to be in the same scheduler as the target job and sched_id for CA7 will be all schedule ids. If a sched_id is specified, the scheduler name is required.

  • excluded_trim_points (optional) - list of names or tuples (job name, scheduler name, sched_id for CA7) that are not part of the jobstream, and whose predecessors are also not

    Default: [ ]

    Note: If only a job name is given, the excluded trim point is assumed to be in the same scheduler as the target job and sched_id for CA7 will be all schedule ids. If a sched_id is specified, the scheduler name is required.

  • start_jobs [optional, AutoSys only.

    Default: [ ]

  • annotation (optional) - description which is displayed in the "Edit User" dialog

    Default: None

  • email_addresses (optional) - string containing a comma-separated list of email addresses to notify if any email alerts are issued on this jobstreamDefault: None

  • max_jobs (optional) - maximum number of jobs in the new jobstream. If it is exceeded, an error results and the jobstream is not added

    Default: 3000

  • forecasted (optional) - True if forecasts for the jobstream being added should appear in the monitoring tab

    Default: False

  • critical (optional) - True if the jobstream is considered critical. This will allow the user to filter on critical only jobstreams in various filtering views throughout the product

    Default: False

  • auto_place_repetitive_jobs (optional) - False if repetitive jobs should not be automatically placed in the jobstream

    Default: True

  • sched_id (optional, CA7 only) - The 3-digit string of the schedule ID for the jobstream. The jobstream will only be defined for runs of the target job on the specified schedule ID. If this parameter is zero or None, the jobstream will be defined for any run of the target job regardless of schedule ID

    Default: None

  • max_run_duration (optional) - limit the duration of jobstream runs to the duration specified in hours

    Default: server default

  • allow_force_start_starts (optional) - allows jobstreams to be created from force started jobs or jobs that are successors of force started jobs

    Default: True

  • retention_days (optional) - the number of days of jobstream history to be kept in the database. If not present, then the default number supplied by the server parameter dbMaintenance.jobStream.retentionDaysDefaultLimit will be used.

  • allow_group_starts_jobstream_run (optional, Tidal only) - allows a group to start a jobstream run. If not present, the default choice by the AAI parameter client.allowGroupStartJobstreamRun will be used.

  • auto_trim_options (optional) - AutoTrimOptions object. If none is provided, auto trim system defaults will be used

    Default: None

Dependencies:

  • Must be logged in as admin

Result:

  • New jobstream added in root business area

Example add_jobstream() command line usage:

>>> add_jobstream(target_job_name='n-sod-pstbckp-pl',
    scheduler='autosys45', name='autosys45-2', monitorable=True,
    since_date='2015/7/25 10:00:00 MDT', areas=['area1', 'area5'],
    included_trim_points=[(u'd_eom_chk_on_stat_bat', u'CLI - API - cm03'),
    (u'e-eom-cleanup-bat', u'autosysR11-02')],
    excluded_trim_points=[(u'tsjs1_target', u'autosysR11-01'),
    (u'FS45_jobC', u'autosys45')], start_jobs=[
    (u'k-som-dropidx-bat', u'autosysR11-01'),
    (u'ATEXDS3', u'CA7')], annotation='autosys scheduler',
    email_addresses='a@b.c, b@c.d', max_jobs=2750, forecasted=True,
    critical=False, auto_place_repetitive_jobs=True,
    allow_force_start_starts=True, retention_days=90)
add jobstream "autosys45-2"
done

>>> add_jobstream(target_job_name='US2913T', scheduler='CA7',
    name='ca7jobstream', areas=['area2', 'area5'], forecasted=True,
    critical=True, sched_id='001',
    auto_trim_options=AutoTrimOptions(1.8, 0.3, True, True))

Example add_jobstream() script usage:

import sys
from jaws import *

login()
print 'begin'
try:
    add_jobstream(target_job_name='d_eom_chk_on_stat_bat',
      scheduler='CLI - API - cm03', name='jobstream8', monitorable=True,
      since_date='2015/6/22 12:00:00 MDT', areas=['area1', 'area2'],
      annotation='5th jobstream', max_jobs=2500, forecasted=False,
      critical=False, auto_place_repetitive_jobs=True, max_run_duration=12,
      allow_force_start_starts=True, retention_days=100)

    print 'end'

finally:
    logout()

copy_jobstream()

Add a new jobstream copying the definition of an existing jobstream.

With exception of the name, the duplicate jobstream will have exactly the same definition, job exclusions, and attributes.

Note: Copying a jobstream is a one time operation. Subsequent changes to the original jobstream would not be reflected in the duplicate.

Parameters:

  • existing_jobstream_name - name of the jobstream to be copied
  • new_jobstream_name - name of the duplicate jobstream

Dependencies:

  • Must be logged in as admin

Result:

  • Existing jobstream duplicated and given new name

Example copy_jobstream() command line usage:

>>> copy_jobstream(existing_jobstream_name='DE3503_A',
    new_jobstream_name='DE3503_copy')
add jobstream "DE3503_copy"
done
Update jobstream attributes: "DE3503_copy"
done

Example copy_jobstream() script usage:

import sys
from jaws import *

login()
print 'begin'
try:
    copy_jobstream(existing_jobstream_name='DE3503_A',
      new_jobstream_name='DE3503_copy')

    print 'end'

finally:
    logout()

delete_jobstream()

Delete the jobstream with the given name.

Parameters:

  • name - name of the jobstream to be deleted

Dependencies:

  • Must be logged in as admin
  • Need at least one jobstream

Result:

  • Given jobstream deleted

Example delete_jobstream() command line usage:

>>> delete_jobstream(name='DE3503_copy')
delete jobstream "DE3503_copy"
done

>>> delete_jobstream('DE3503_copy')

Example delete_jobstream() script usage:

import sys
from jaws import *

login()
print 'begin'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
    delete_jobstream(j)

    print 'end'

finally:
    logout()

get_jobstream_alerts()

Get information about alerts for the jobstream with a given name.

Parameters:

  • job_stream_name - name of the jobstream

Dependencies:

  • Must be logged in
  • Need at least one jobstream

Result:

  • The results returned are a dictionary of alert types to alert configuration dictionaries. The configuration dictionaries are maps of configuration names to the values. The results are suitable for passing to update_jobstream_alerts(), possibly after changing some configuration settings, see update_jobstream_alerts().
  • All alert types valid for the scheduler that contain the target job of the jobstream are specified in the returned map, even alerts that are not enabled. Such alerts will have a False value for the 'active' key, and all other settings will be the defaults.
  • When called on a jobstream with no alerts the return will be this structure:
    {
    'target job started':
    {'severity': 'NORMAL', 'snmp': False, 'active': False, 'email': False},
    'jobstream complete':
    {'severity': 'NORMAL', 'snmp': False, 'active': False, 'email': False},
    'jobstream exceeded sla':
    {'severity': 'CRITICAL', 'snmp': False, 'active': False, 'email': False},
    'jobstream not predicted to finish':
    {'severity': 'CRITICAL', 'snmp': False, 'active': False, 'email': False},
    'jobstream late':
    {'every n minutes': 15, 'only if % complete': 0, 'severity': 'CRITICAL',
        'snmp': False, 'active': False, 'email': False},
    'jobstream not started':
    {'severity': 'NORMAL', 'snmp': False, 'active': False, 'email': False},
    'jobstream started':
    {'severity': 'NORMAL', 'snmp': False, 'active': False, 'email': False},
    'jobstream back on track':
    {'severity': 'CRITICAL', 'snmp': False, 'active': False, 'email': False},
    'checkpoint':
    {'completion percentages': [50, 75, 90], 'severity': 'MINOR',
        'snmp': False, 'active': False, 'email': False}
    }

    Note: Some scheduler types will not return all alert types.

Example get_jobstream_alerts() command line usage:

>>> get_jobstream_alerts(job_stream_name='d_group')
get alerts for "d_group"
{
'target job started':
{'severity': u'NORMAL', 'snmp': False, 'active': False, 'email': False},
'jobstream exceeded sla':
{'severity': u'CRITICAL', 'snmp': False, 'active': False, 'email': False},
'jobstream late':
{'every n minutes': 15, 'only if % complete': 0, 'severity': u'CRITICAL',
     'snmp': False, 'active': False, 'email': False},
'checkpoint':
{'completion percentages': [50, 75, 90], 'severity': u'MINOR',
    'snmp': False, 'active': False, 'email': False}
}

>>> get_jobstream_alerts('d_group')

Example get_jobstream_alerts() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
    gja = get_jobstream_alerts(j).iteritems()
    for key, value in gja:
    print ' ' + key
    print ' ' + str(value)

    print 'end output'

finally:
    logout()

jobstream_business_areas()

Get a list of the names of all business areas which contain the jobstream.

Parameters:

  • jobstream - name of a jobstream

Dependencies:

  • Must be logged in

Result:

  • A list of business areas which contain the given jobstream

Example jobstream_business_areas() command line usage:

>>> jobstream_business_areas(jobstream='d_group')
[u'All Jobstreams', u'area2', u'area4']

>>> jobstream_business_areas('d_group')

Example jobstream_business_areas() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ": " + str(jobstream_business_areas(j))

    print 'end output'

finally:
    logout()

jobstream_excluded_trim_points()

Get jobs which are excluded from the jobstream as well as their predecessors.

Parameters:

  • jobstream - name of a jobstream

Dependencies:

  • Must be logged in

Result:

  • A list of tuples (job name, scheduler name)

Example jobstream_excluded_trim_points() command line usage:

>>> jobstream_excluded_trim_points(jobstream='a-box')
[(u'a-candp-pl', u'autosys45'), (u'a-4-del', u'autosys45')]

>>> jobstream_excluded_trim_points('a-box')

Example jobstream_excluded_trim_points() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ":"
      jetp = jobstream_excluded_trim_points(j)
      for p in jetp:
    print ' job: ' + p[0] + ', scheduler: ' + p[1]

    print 'end output'

finally:
    logout()

jobstream_filewatchers()

Get filewatcher jobs in the new jobstream.

Parameters:

  • target_job_name - name of the target job that defines the jobstream in which to look for filewatcher jobs

  • scheduler (optional) - name of the scheduler containing the job (required if more than one scheduler is defined)

    Default: None

  • included_trim_points (optional) - list of names or tuples (job name, scheduler name) of "included trim points"

    Default:: [ ]

    Note: If only a job name is given, the trim point is assumed to be in the same scheduler as the target job.

  • excluded_trim_points (optional) - list of names or tuples (job name, scheduler name) of "excluded trim points"

    Default: [ ]

    Note: If only a job name is given, the trim point is assumed to be in the same scheduler as the target job.

  • sched_id (optional, CA7 only) - a 3-digit string representing the schedule ID for the target job of the jobstream. If this parameter is zero or None, the jobstream will be defined for any run of the target job regardless of schedule ID

    Default: None

  • auto_trim_options (optional) - AutoTrimOptions object. If none is provided, auto trim system defaults will be used

    Default: None

Dependencies:

  • Must be logged in as admin

Result:

  • A list of tuples (job name, scheduler name)

Example jobstream_filewatchers() command line usage:

>>> jobstream_filewatchers(target_job_name='p-dly-vlu-2-sh',
    scheduler='autosys45')
[(u'p-rates-fw', u'autosys45'), (u'p-prices-fw', u'autosys45'),
    (u'p-mrn-fw', u'autosys45')]

>>> jobstream_filewatchers(target_job_name='SZ001',
    scheduler='CA7', included_trim_points=[
    (u'p-4-del', u'ENGAUTOSYS45-01'),
    (u'e-topsval1-sh', u'ENGAUTOSYS45-01')],
    excluded_trim_points=[(u'e-eom-cleanup-bat', u'autosysR11-02'),
    (u'engautosysr11-01g_0_10m', u'autosysR11-02')], sched_id='001',
    auto_trim_options=AutoTrimOptions(1.8, 0.3, True, True))

Example jobstream_filewatchers() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    filew = jobstream_filewatchers(target_job_name='p-dly-vlu-2-sh',
      scheduler='autosys45')
    for f in filew:
      print 'job: ' + f[0] + ', scheduler: ' + f[1]

    print 'end output'

finally:
    logout()

jobstream_impl_attr()

Get the JobStreamAttributes object containing the monitorable flag, late, and alert criteria settings.

Parameters:

  • name - name of the jobstream

Dependencies:

  • Must be logged in

Result:

Example jobstream_impl_attr() command line usage:

>>> jobstream_impl_attr(name='DE3503_A')
com.broadcom.dto.jobstream.JobStreamAttributes@2fd91d6

>>> jobstream_impl_attr('DE3503_A')

Example jobstream_impl_attr() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ": " + str(jobstream_impl_attr(j))

    print 'end output'

finally:
    logout()

jobstream_impl_def()

Get the JobStreamDefinition object containing jobs in the jobstream and other information.

Parameter:

  • name - name of the jobstream

Dependencies:

  • Must be logged in

Result:

Example jobstream_impl_def() command line usage:

>>> jobstream_impl_def(name='DE3503_A')
com.broadcom.dto.jobstream.JobStreamDefinition@2f313d98

>>> jobstream_impl_def('DE3503_A')

Example jobstream_impl_def() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ": " + str(jobstream_impl_def(j))

    print 'end output'

finally:
    logout()

jobstream_impl_key()

Get the JobStreamKey object for the jobstream with the given name.

Parameters:

  • name - name of the jobstream

Dependencies:

  • Must be logged in

Result:

  • A JobStreamKey object representing the given jobstream, see JobStreamKey

Example jobstream_impl_key() command line usage:

>>> jobstream_impl_key(name='DE3503_A')
JobStreamKey[DE3503_A]

>>> jobstream_impl_key('DE3503_A')

Example jobstream_impl_key() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ": " + str(jobstream_impl_key(j))

    print 'end output'

finally:
    logout()

jobstream_included_trim_points()

Get jobs whose predecessors are excluded from the jobstream. Returns a list of tuples (job name, scheduler name).

Parameters:

  • jobstream - name of a jobstream

Dependencies:

  • Must be logged in

Result:

  • A list of tuples (job name, scheduler name)

Example jobstream_included_trim_points() command line usage:

>>> jobstream_included_trim_points(jobstream='a-box')
[(u'a-dly-vlu-4-sh', u'autosys45'), (u'a-dly-vlu-rm', u'autosys45')]

>>> jobstream_included_trim_points('a-box')

Example jobstream_included_trim_points() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ":"
      jitp = jobstream_included_trim_points(j)
      for p in jitp:
    print ' job: ' + p[0] + ', scheduler: ' + p[1]

    print 'end output'

finally:
    logout()

jobstream_run_impl()

Get the JobStreamRunLite object containing details of a particular run.

Note: If there is more than one run at the specified start time and an end time is not given, then the first run is returned.

Parameter:

  • name - name of the jobstream

  • start - start time of the run in parse_date() format ('2007/1/15 13:21:00 MST'), as returned by jobstream_runs()

  • end (optional) - end time of the run in parse_date() format ('2007/1/15 13:21:00 MST') as returned by jobstream_runs2() - only required if there is more than one jobstream run with the same start time

    Default: None

    More information:

Dependencies:

  • Must be logged in

Result:

  • A JobStreamRunLite object representing a specified run of a jobstream, see JobStreamRunLite

Example jobstream_run_impl() command line usage:

>>> jobstream_run_impl(name='DE3503_A', start='2015/06/07 14:00:05 MDT',
    end='2015/06/07 14:04:36 MDT')
JobStreamRunLite[2015/06/07 14:00:05.000 MDT to 2015/06/07
    14:04:36.000 MDT]

Example jobstream_run_impl() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ": " + str(jobstream_run_impl(j,
    start=jobstream_runs(j)[0]))

    print 'end output'

finally:
    logout()

jobstream_runs()

Get list containing start times of every run of a jobstream, in chronological order.

Parameter:

  • name - name of the jobstream

Dependencies:

  • Must be logged in

Result:

  • A list of start times of all the runs of a jobstream, as strings in the format used by parse_date() and format_date() ('2007/1/15 13:21:00 MST').

    More information:

Example jobstream_runs() command line usage:

>>> jobstream_runs(name='DE3503_A')
[u'2015/06/07 14:00:05 MDT', u'2015/06/08 14:00:03 MDT',
    u'2015/06/09 14:00:02 MDT', u'2015/06/10 14:00:05 MDT',
    u'2015/06/11 14:00:05 MDT', u'2015/06/12 14:00:05 MDT',
    u'2015/06/13 14:00:05 MDT', u'2015/06/14 14:00:05 MDT',
    u'2015/06/15 14:00:06 MDT', u'2015/06/16 14:00:04 MDT',
    u'2015/06/17 14:00:05 MDT', u'2015/06/18 14:00:05 MDT',
    u'2015/06/19 14:00:02 MDT', u'2015/06/20 14:00:05 MDT',
    u'2015/06/21 14:00:02 MDT', u'2015/06/22 14:00:05 MDT',
    u'2015/06/23 14:00:05 MDT']

>>> jobstream_runs('DE3503_A')

Example jobstream_runs() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ": " + str(jobstream_runs(j))

    print 'end output'

finally:
    logout()

jobstream_runs2()

Get list containing start and end times of every run of a jobstream, sorted by start time.

Parameter:

  • name - name of the jobstream

Dependencies:

  • Must be logged in

Result:

  • A list of start and end times of all the runs of a jobstream, as strings in the format used by parse_date() and format_date() ('2007/1/15 13:21:00 MST'), sorted by start time.

    More information:

Example jobstream_runs2() command line usage:

>>> jobstream_runs2(name='DE3503_A')
    [[u'2015/06/07 14:00:05 MDT', u'2015/06/07 14:04:36 MDT'],
    [u'2015/06/08 14:00:03 MDT', u'2015/06/08 14:05:24 MDT'],
    [u'2015/06/09 14:00:02 MDT', u'2015/06/09 14:05:22 MDT'],
    [u'2015/06/10 14:00:05 MDT', u'2015/06/10 14:05:38 MDT'],
    [u'2015/06/11 14:00:05 MDT', u'2015/06/11 14:05:41 MDT'],
    [u'2015/06/12 14:00:05 MDT', u'2015/06/12 14:05:15 MDT'],
    [u'2015/06/13 14:00:05 MDT', u'2015/06/13 14:05:27 MDT'],
    [u'2015/06/14 14:00:05 MDT', u'2015/06/14 14:05:03 MDT'],
    [u'2015/06/15 14:00:06 MDT', u'2015/06/15 14:05:27 MDT'],
    [u'2015/06/16 14:00:04 MDT', u'2015/06/16 14:05:20 MDT'],
    [u'2015/06/17 14:00:05 MDT', u'2015/06/17 14:05:12 MDT'],
    [u'2015/06/18 14:00:05 MDT', u'2015/06/18 14:05:19 MDT'],
    [u'2015/06/19 14:00:02 MDT', u'2015/06/19 14:04:58 MDT'],
    [u'2015/06/20 14:00:05 MDT', u'2015/06/20 14:04:56 MDT'],
    [u'2015/06/21 14:00:02 MDT', u'2015/06/21 14:05:02 MDT'],
    [u'2015/06/22 14:00:05 MDT', u'2015/06/22 14:05:00 MDT'],
    [u'2015/06/23 14:00:05 MDT', u'2015/06/23 14:05:07 MDT']]

>>> jobstream_runs2('DE3503_A')

Example jobstream_runs2() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ": " + str(jobstream_runs2(j))

    print 'end output'

finally:
    logout()

jobstream_scheduler()

Get the name of the scheduler which contains the target job of the jobstream.

Parameters:

  • jobstream - name of a jobstream

Dependencies:

  • Must be logged in

Result:

  • The name of the scheduler containing the given jobstream's target job

Example jobstream_scheduler() command line usage:

>>> jobstream_scheduler(jobstream='Hourly_Target3')
u'autosysR11-02'

>>> jobstream_scheduler('Hourly_Target3')

Example jobstream_scheduler() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ": " + jobstream_scheduler(j)

    print 'end output'

finally:
    logout()

jobstream_size()

Get the number of jobs in a new jobstream.

Without actually creating the jobstream, calculates how many jobs would be present in it if it were defined.

Parameters:

  • target_job_name - name of the target job that defines the jobstream for which to calculate the size

  • scheduler (optional) - name of the scheduler containing the job (required if more than one scheduler is defined)

    Default: None

  • included_trim_points (optional) - list of names or tuples (job name, scheduler name) of designated inclusive trim points (jobs whose predecessors are not part of the jobstream)

    Default: [ ]

    Note: If only a job name is given, the trim point is assumed to be in the same scheduler as the target job.

  • excluded_trim_points (optional) - list of names or tuples (job name, scheduler name) of designated exclusive trim points (jobs that, along with their predecessors, are excluded from the jobstream)

    Default: [ ]

    Note: If only a job name is given, the trim point is assumed to be in the same scheduler as the target job.

  • sched_id (optional, CA7 only) - a 3-digit string representing the schedule ID for the target job of the jobstream. If this parameter is zero or None, the jobstream will be defined for any run of the target job regardless of schedule ID

    Default: None

  • auto_trim_options (optional) - AutoTrimOptions object. If none is provided, auto trim system defaults will be used

    Default: None

Dependencies:

  • Must be logged in as admin

Result:

  • The number of jobs in a given jobstream

Example jobstream_size() command line usage:

>>> jobstream_size(target_job_name='a-eom-backup-pl',
    scheduler='autosysR11-02')
18

>>> jobstream_size(target_job_name='RDAYWE', scheduler='CA7',
    included_trim_points=[(u'p-4-del', u'ENGAUTOSYS45-01'),
    (u'e-topsval1-sh', u'ENGAUTOSYS45-01')],
    excluded_trim_points=[(u'e-eom-cleanup-bat', u'autosysR11-02'),
    (u'engautosysr11-01g_0_10m', u'autosysR11-02')], sched_id='001',
    auto_trim_options=AutoTrimOptions(1.8, 0.3, True, True))

Example jobstream_size() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbs = ['DE3360_job1', 'd_som_pre_settle_bat']
    scheds = ['CLI - API - cm03', 'tidal53']

    for x in range(0,2):
      print jbs[x] + ", " + scheds[x] + ": " + str(
        jobstream_size(jbs[x], scheds[x]))

    print 'end output'

finally:
    logout()

jobstream_target_job()

Get the name of the target job of the jobstream.

Parameters:

  • jobstream - name of a jobstream

Dependencies:

  • Must be logged in

Result:

  • The name of the target job of the given jobstream

Example jobstream_target_job() command line usage:

>>> jobstream_target_job(jobstream='DE3503_A')
u'DE3505_agent'

>>> jobstream_target_job('DE3503_A')

Example jobstream_target_job() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j + ": " + jobstream_target_job(j)

    print 'end output'

finally:
    logout()

jobstreams()

Get a list of names of jobstreams within a given business area.

Parameters:

  • area (optional) - name of a business area in which to look

    Default: None (the root business area is used)

  • descendants (optional) - if True, streams which are defined in areas which are contained by the given area are also returned. If False, only streams which are immediate children of the area are returned

    Default: True

Dependencies:

  • Must be logged in

Result:

  • A list of jobstreams

Example jobstreams() command line usage:

>>> jobstreams(area='area1', descendants=False)
[u'd_group', u'a-box']

>>> jobstreams()

Example jobstreams() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbstrms = jobstreams()
    for j in jbstrms:
      print j

    print 'end output'

finally:
    logout()

potential_jobstreams()

Gets a tuple of potential target jobs, scheduler and number of upstream jobs. A potential target job has no parent box and no successors.

Parameters:

  • pattern (optional) - regex to match against target job names

    Default: '.*' to include all jobs

  • scheduler (optional) - specific scheduler to get jobs from

    Default: None - all schedulers

  • upstream (optional) - minimum number of predecessor jobs

    Default: 1

  • auto_trim_options (optional) - AutoTrimOptions object. If none is provided, auto trim system defaults will be used

    Default: None

Dependencies:

  • Must be logged in as admin

Result:

  • A list of tuples (job name, scheduler name, # upstream)

Example potential_jobstreams() command line usage:

>>> potential_jobstreams(pattern='Hourly_Target1')
[(u'Hourly_Target1', u'autosysR11-02', 5), (u'Hourly_Target1',
    u'autosys45', 5), (u'Hourly_Target1', u'autosysR11-01', 5)]

>>> potential_jobstreams(pattern='Hourly_Target1',
    scheduler='autosys45', upstream=3)
>>> potential_jobstreams(scheduler='autosys45')
>>> potential_jobstreams(upstream=113,
auto_trim_options=AutoTrimOptions(1.8, 0.3, True, True))

Example potential_jobstreams() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    pjs = potential_jobstreams(pattern='Hourly_Target1')
    for p in pjs:
      print 'pattern: ' + p[0]
      print ' scheduler: ' + p[1]
      print ' # upstream: ' + str(p[2])

    print 'end output'

finally:
    logout()

rebuild_jobstream_jobs()

Rebuild all the jobstream jobs for the specified scheduler.

Parameters:

  • scheduler - name of the scheduler whose jobstream jobs will be rebuilt

Dependencies:

  • Must be logged in as admin

Result:

  • No return value. Returns when the jobstream job structures for all jobstreams in the scheduler have been rebuilt.

Example rebuild_jobstream_jobs() command line usage:

>>> rebuild_jobstream_jobs(scheduler='tidal53')
done

>>> rebuild_jobstream_jobs('tidal53')

Example rebuild_jobstream_jobs() script usage:

import sys
from jaws import *

login()
print 'begin'
try:
    scheds = schedulers()
    for s in scheds:
      print s, rebuild_jobstream_jobs(s)

    print 'end'

finally:
    logout()

running_jobstreams()

Get currently running jobstreams within a single business area.

Parameters:

  • businessArea - name of the area to look in

Dependencies:

  • Must be logged in

Result:

Example running_jobstreams() command line usage:

>>> running_jobstreams(businessArea='All Jobstreams')
[com.broadcom.jawsthinclient.impl.RunningJobStreamInfo2@6e91dce3]

>>> running_jobstreams('All Jobstreams')

Example running_jobstreams() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    areas=['area1', 'area2', 'area3', 'area4', 'area5']
    for a in areas:
    print a + ": " + str(running_jobstreams(a))

    print 'end output'

finally:
    logout()

update_filter_jobs()

Update the trim points and start jobs of an existing jobstream.

Notes:

  • The jobstream will also be automatically trimmed according to the jobstream's auto trim options. This may automatically remove any trim points or start jobs that were explicitly given, if the trim points or start jobs are further upstream any new automatically generated trim points.

  • Start Jobs feature only applies to jobstreams defined for AutoSys schedulers. By default this tab is not available. This is an advanced feature that can be useful in certain situations. To enable this feature, have your AAI administrator set the parameter client.enableJobstreamStartJobs to "true" in the Automic Automation Intelligence Configuration Tool.

  • The entire run history of the jobstream is rebuilt.

Parameters:

  • job_stream_name - name of the jobstream to update

  • included_trim_points (optional) - list of names or tuples (job name, scheduler name) of "included trim points"

    Default: [ ]

    Note: If only a job name is given, the trim point is assumed to be in the same scheduler as the target job.

  • excluded_trim_points (optional) - list of names or tuples (job name, scheduler name) of "excluded trim points"

    Default: [ ]

    Note: If only a job name is given, the trim point is assumed to be in the same scheduler as the target job.

  • start_jobs (optional) - list of names or tuples (job name, scheduler name) of "jobs that can start a jobstream run"

    Default: [ ]

Dependencies:

  • Must be logged in

Result:

  • Included/excluded trim points and start jobs are updated for the specified jobstream, with the jobstream automatically trimmed according to its current auto trim options settings.

Example update_filter_jobs() command line usage:

  • Update included_trim_points, excluded_trim_points, and start_jobs.

>>> update_filter_jobs(job_stream_name='d_group',
    included_trim_points=[(u'e_som_imprtfx_bat', u'CLI - API - cm03'),
        (u'd_eom_chk_on_stat_bat', u'CLI - API - cm03')],
    excluded_trim_points=[(u'p-som-ratechk-pl', u'autosysR11-01'),
        (u'e-1-del', u'autosysR11-01')],
    start_jobs=[(u'd_som_pre_settle_bat', u'tidal53'),
        (u'n_eom_chk_on_stat_bat', u'tidal53')])
update start jobs for "d_group"
done

Example update_filter_jobs() script usage:

import sys
from jaws import *

login()
print 'begin'
try:
    update_filter_jobs(job_stream_name='d_group',
      included_trim_points=[(u'e_som_imprtfx_bat', u'CLI - API - cm03'),
        (u'd_eom_chk_on_stat_bat', u'CLI - API - cm03')],
      excluded_trim_points=[(u'DE4186_customHS', u'autosys45'),
        (u'd_dly_vlu_3_sh', u'tidal53')],
      start_jobs=[(u'd_som_pre_settle_bat', u'tidal53'),
        (u'n_eom_chk_on_stat_bat', u'tidal53')])

    print 'end'

finally:
    logout()

update_jobstream()

Update the attributes and parent business areas for a jobstream.

Parameters:

  • attr - JobStreamAttributes object, as returned by jobstream_impl_attr(), see jobstream_impl_attr()

  • add_to_areas (optional) - list of names of business areas to add this stream to

    Default: None

  • remove_from_areas (optional) - list of names of business areas to remove this stream from

    Default: None

Dependencies:

  • Must be logged in

Result:

  • Specified parameters updated for given jobstream

Example update_jobstream() command line usage:

>>> update_jobstream(attr=jobstream_impl_attr('d_group'),
    add_to_areas=['area1', 'area4'], remove_from_areas=['area2'])
Update jobstream attributes: "d_group"
done

Example update_jobstream() script usage:

import sys
from jaws import *

login()
print 'begin'
try:
    update_jobstream(attr=jobstream_impl_attr('d_group'),
      add_to_areas=['area2', 'area5'], remove_from_areas=[
      'area1', 'area4'])

    print 'end'

finally:
    logout()

update_jobstream_alerts()

Update the alert settings on a jobstream.

The alerts_dict is a python dictionary of alert types to alert configuration dictionaries. The configuration dictionaries are maps of configuration names to the values. All the keys are the lower case strings used in the GUI to specify the alert type or the specific configuration option.

See get_jobstream_alerts() for a complete listing of alert types and configuration options, see get_jobstream_alerts().

The values of the 'severity' property are 'critical', 'major', 'minor', 'normal', and 'warning'.

There are four mutually exclusive Late Alert types: once, 'every n minutes', 'every % duration change', and 'every hh:mm:ss end time change'. Assigning more than one of them causes errors.

Note: Changing the configuration of an alert that is not active has no effect. The call will succeed, but no change will be made.

Parameters:

  • job_stream_name - name of the jobstream
  • alerts_dict - a python dictionary of alert types to alert configuration dictionaries

Dependencies:

  • Must be logged in

Result:

  • Alerts updated for given jobstream

Example update_jobstream_alerts() command line usage:

  • Notify every 15 minutes by default:
    >>> update_jobstream_alerts('myStream', {'jobstream late': {}})
  • Set alert inactive:
    >>> update_jobstream_alerts('myStream', {'jobstream late': 
        {'active':False}})
  • Make alert have "critical" severity:
    >>> update_jobstream_alerts('myStream', {'jobstream late':
        {'severity':'critical'}})
  • Send jobstream late alert once only:
    >>> update_jobstream_alerts('myStream', {'jobstream late':
        {'every n minutes':0}})
  • Send jobstream late alert every 15 minutes if it is at least 50% complete:
    >>> update_jobstream_alerts('myStream', {'jobstream late':
        {'every n minutes':15, 'only if % complete':50}})
  • Send jobstream late alert if the duration change between two predictions is equal to or greater than 5%:
     >>> update_jobstream_alerts('myStream', {'jobstream late':
        {'every % duration change':5}})
  • Send jobstream late alert if the end time change between two predictions is equal to or greater than 1 min:
    >>> update_jobstream_alerts('myStream', {'jobstream late':
        {'every hh:mm:ss end time change':'1:00'}})
  • Do not specify more than one 'jobstream late' alert type:
    >>> update_jobstream_alerts('myStream', {'jobstream late':
        {'every n minutes':15, 'every % duration change':5, 
        'every hh:mm:ss end time change':'1:00'}})

    The AAI server will throw an exception.

  • Send the checkpoint alert whenever the jobstream is 25% or 75% complete:
    >>> update_jobstream_alerts('myStream', {'checkpoint':
        {'completion percentages':(25, 75)}})
  • Make the jobstream complete alert active:
    >>> update_jobstream_alerts('myStream', {'jobstream complete': {}})

    or

    >>> update_jobstream_alerts('myStream', {'jobstream complete':{'active':True}})
  • Deactivate the jobstream complete alert:
    >>> update_jobstream_alerts('myStream', {'jobstream complete':
        {'active':False}})
  • Use SNMP for notifications of the jobstream complete alert:
    >>> update_jobstream_alerts('myStream', {'jobstream complete':
        {'snmp':True}})
  • Use email for notifications of the jobstream complete alert:
    >>> update_jobstream_alerts('myStream', {'jobstream complete':
        {'email':True}})
  • The following commands will enable all alert types with the default settings:
    >>> update_jobstream_alerts('myStream', {'jobstream late': {}})
    >>> update_jobstream_alerts('myStream', {'jobstream complete': {}})
    >>> update_jobstream_alerts('myStream', {'checkpoint': {}})
    >>> update_jobstream_alerts('myStream', {'jobstream back on track': {}})
    >>> update_jobstream_alerts('myStream',
        {'jobstream not predicted to finish': {}})
    >>> update_jobstream_alerts('myStream', {'jobstream started': {}})
    >>> update_jobstream_alerts('myStream', {'target job started': {}})
    >>> update_jobstream_alerts('myStream', {'jobstream not started': {}})
    >>> update_jobstream_alerts('myStream', {'jobstream exceeded sla': {}})
  • You can specify multiple alerts in one call:
    >>> update_jobstream_alerts('myStream', {
        'jobstream late': {'every n minutes':15, 'only if % complete':50},
        'checkpoint': {'completion percentages':[50]},
        'jobstream started': {},
        'jobstream complete': {'active':True},
        'jobstream not started': {'active':False},
        'jobstream exceeded sla': None,
        'jobstream back on track': {},
        'jobstream not predicted to finish': {}, })

Example update_jobstream_alerts() script usage:

import sys
from jaws import *

login()
print 'begin'
try:
    update_jobstream_alerts('a-box', {
      'jobstream late': {'every n minutes':15, 'only if % complete':50},
      'checkpoint': {'completion percentages':[50]},
      'jobstream started': {},
      'jobstream complete': {'active':True},
      'jobstream not started': {'active':False},
      'jobstream exceeded sla': None,
      'jobstream back on track': {},
      'jobstream not predicted to finish': {}, })

    print 'end'

finally:
    logout()