Job Commands

This page includes the following:

downstream_jobs()

Get a list of all jobs which are successors of a given job.

This includes direct successors, as well as parent boxes (whose end time is determined by the job,) and indirect successors.

Parameters:

  • job - name of the job to start with
  • scheduler (optional) - name of the scheduler containing the job (required if more than one scheduler is defined); default: None

Dependencies:

  • Must be logged in as admin

Result:

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

Example downstream_jobs() command line usage:

>>> downstream_jobs(job='DE4186_customHS', scheduler='autosys45')
done
[(u'DE4186_customHS', u'autosys45')]

Example downstream_jobs() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbs = ['SSDELAY2', 'k-som-pre-settle-bat']
    scheds = ['CA7', 'autosys45']

    for x in range(0, 2):
      print jbs[x] + ":"
      dsj = downstream_jobs(jbs[x], scheds[x])
      for d in dsj:
        print ' job: ' + d[0] + ', scheduler: ' + d[1]

    print 'end output'

finally:
    logout()

get_frequency_for_job()

Get the frequency of the given job.

Parameters:

  • job_id - the id of the job

Dependencies:

  • Must be logged in

Result:

  • Returns the estimated number of runs of the job per day

Example get_frequency_for_job() command line usage:

>>> get_frequency_for_job(job_id='402881ab49c95caa0149cb2432ac04cc') 
5.130163423760628

Example get_frequency_for_job() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    get_frequency_for_job(job_id='402881ab49c95caa0149cb2432ac04cc')

    print 'end output'
           
finally:
    logout()

get_job_predecessors()

Get the names of all immediate predecessors of the given job.

Parameters:

  • job_name - the name of the given job
  • scheduler_name - the name of the scheduler on which the job runs

Dependencies:

  • Must be logged in

Result:

  • A list of names and UUIDs of immediate predecessor jobs

Example get_job_predecessors() command line usage:

>>> get_job_predecessors(job_name='k-som-cashchk-pl',
    scheduler_name='autosysR11-02')
[JobKey[k-som-cash-bat; UUID[402882aa4db54022014db589f74c1a50]]]

Example get_job_predecessors() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbs = ['SSDELAY2', 'h_som_clrcomp_bat']
    scheds = ['CA7', 'tidal53']
    for x in range(0, 2):
      print 'job: ' + jbs[x] + ', ' + 'scheduler: ' + scheds[x]
      print ' ' + str(get_job_predecessors(jbs[x], scheds[x]))

    print 'end output'

finally:
    logout()

get_job_property_fields()

Get JobPropertyFields according to the scheduler type.

Parameters:

  • scheduler_type - a scheduler type, 'AUTOSYS'/'CA7'/'TIDAL'/'TIDAL53'

Dependencies:

  • Must be logged in

Result:

  • A list of JobPropertyFields appropriate for the given scheduler type. If no scheduler type is given, only job properties common to all schedulers are returned.

Example get_job_property_fields() command line usage:

>>> get_job_property_fields(scheduler_type='CA7')
[BUSINESS_DOMAIN, CA7.AGENT, CA7.ARFSET, CA7.AUTOGENERATION_OF_7_RMS,
CA7.CALENDAR_NAME, ...]

Example get_job_property_fields() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jpf = get_job_property_fields(scheduler_type='CA7')
    get_jobs_matching_fields(patterns_by_field_name={jpf[0]: 'Marketing'})

    print 'end output'

finally:
    logout()

get_jobs_matching_fields()

Get jobs whose string attributes match the supplied regex patterns.

Parameters:

  • patterns_by_field_name - a Dictionary of regex patterns keyed by attribute/field name. The possible list of fields is quite long - call get_job_property_fields() for the full list, see get_job_property_fields().

    Common fields include:

    • NAME
    • SCHEDULER
    • JOB_TYPE
    • MOST_RECENT_JOB_STATUS
  • use_or - if True, conditions are ORed together instead of ANDed

    Default: False

Dependencies:

  • Must be logged in

Result:

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

Example get_jobs_matching_fields() command line usage:

>>> get_jobs_matching_fields(patterns_by_field_name={
    'NAME':'e_som_imprtfx_bat', 'SCHEDULER':'CLI - API - cm03'})
[(u'e_som_imprtfx_bat', u'CLI - API - cm03'),
    (u'e_som_imprtfx_bat', u'CLI - API - cm03')]

Example get_jobs_matching_fields() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    gjmf = get_jobs_matching_fields(patterns_by_field_name={
      'NAME':'e_som_imprtfx_bat', 'SCHEDULER':'CLI - API - cm03'})

    for g in gjmf:
      print 'job: ' + g[0] + ', scheduler: ' + g[1]

    print 'end output'

finally:
    logout()

get_most_recent_run()

Get information about the most recent run of the given job.

Parameters:

  • job_name - the name of the job

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

    Default: None

Dependencies:

  • Must be logged in

Result:

  • The Job Run object representing the most recent run of a job or the special value None, see Job Run

Example get_most_recent_run() command line usage:

>>> get_most_recent_run(job_name='k-som-cashchk-pl',
    scheduler='autosysR11-02')
<job run: k-som-cashchk-pl/autosysR11-02; 2015/06/22 21:19:59 MDT;
    2015/06/22 21:19:59 MDT; 2015/06/22 21:24:21 MDT>

Example get_most_recent_run() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    gmrr = get_most_recent_run(job_name = 'k-som-pre-settle-bat',
      scheduler='autosys45')

    print "job: " + gmrr.job()
    print "scheduler: " + gmrr.scheduler()
    print "start time: " + str(gmrr.start_time())
    print "running time: " + str(gmrr.running_time())
    print "end time: " + str(gmrr.end_time())
    print "term status: " + str(gmrr.term_status())
    print "machine : " + str(gmrr.machine())
    print "run impl: " + str(gmrr.run_impl())
    print "job impl: " + str(gmrr.job_impl())

    print 'end output'

finally:
    logout()

job_runs_for_jobs()

Get information about specific jobs that were running during a given time span.

Parameters:

  • jobs - sequence of tuples, (job name, scheduler name), such as are returned by jobs() or downstream_jobs()
  • from_date - start of the range of included times, in the format handled by parse_date() ('2007/1/15 13:21:00 MST')
  • to_date - end of the range of included times, in the format handled by parse_date() ('2007/1/15 13:21:00 MST')
  • More information:

Dependencies:

  • Must be logged in

Result:

  • A list of Job Run objects representing each run of a job, see Job Run

Example job_runs_for_jobs() command line usage:

Example job_runs_for_jobs() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    list = job_runs_for_jobs(jobs=[(u'e-som-totwrth-bat', u'autosys45'),
      (u'h_prices_fw', u'tidal53')], from_date='2015/6/22 14:00:00 MDT',
      to_date='2015/6/23 02:00:00 MDT')

    for l in list:
      print "job: " + l.job()
      print " scheduler: " + l.scheduler()
      print " start time: " + l.start_time()
      print " running time: " + str(l.running_time())
      print " end time: " + str(l.end_time())
      print " term status: " + str(l.term_status())
      print " machine : " + str(l.machine())
      print " run impl: " + str(l.run_impl())
      print " job impl: " + str(l.job_impl())

    print 'end output'

finally:
    logout()

job_runs_for_scheduler()

Get information about all jobs that were running on one or more schedulers during a given time span.

Note: Depending on the arguments, this call could be very expensive and/or return a very large result.

Parameters:

  • from_date - start of the range of included times, in the format handled by parse_date() ('2007/1/15 13:21:00 MST'), see parse_date()

  • to_date - end of the range of included times, in the format handled by parse_date() ('2007/1/15 13:21:00 MST')

  • scheduler (optional) - name of a single scheduler

    Default: include runs for all schedulers

Dependencies:

  • Must be logged in

Result:

  • A list of Job Run objects representing each run of a scheduler, see Job Run

Example job_runs_for_scheduler() command line usage:

>>> job_runs_for_scheduler(from_date='2015/6/22 11:00:00 MDT',
    to_date='2015/6/22 11:00:01 MDT', scheduler='ENGAUTOSYS45-01')
done (0.2s elapsed)
[<job run: long_box1_b1_02/ENGAUTOSYS45-01; 2015/06/22 10:35:51 MDT;
    2015/06/22 10:35:53 MDT; 2015/06/22 11:46:57 MDT>,
    <job run: e-candp-pl/ENGAUTOSYS45-01; 2015/06/22 10:55:54 MDT;
        2015/06/22 10:55:57 MDT; 2015/06/22 11:06:21 MDT>,
    <job run: a-som-dropidx-bat/ENGAUTOSYS45-01; 2015/06/22 10:56:42 MDT;
        2015/06/22 10:56:44 MDT; 2015/06/22 11:05:23 MDT>,
    <job run: e-box/ENGAUTOSYS45-01; 2015/06/22 07:30:01 MDT;
        None; 2015/06/22 16:09:28 MDT>,
    <job run: long_box1_b1/ENGAUTOSYS45-01; 2015/06/22 09:40:56 MDT;
        None; 2015/06/22 11:46:58 MDT>,
    <job run: a-box/ENGAUTOSYS45-01; 2015/06/22 04:05:04 MDT;
        None; 2015/06/22 12:39:50 MDT>,
    <job run: pgo_us2856_pred4/ENGAUTOSYS45-01;
        2015/06/22 10:30:19 MDT; 2015/06/22 10:30:21 MDT;
        2015/06/22 11:00:21 MDT>,
    <job run: long_box1/ENGAUTOSYS45-01; 2015/06/22 06:35:26 MDT;
        None; 2015/06/22 11:46:59 MDT>,
    <job run: a-som-box/ENGAUTOSYS45-01; 2015/06/22 08:35:01 MDT;
        None; 2015/06/22 12:38:39 MDT>,
    <job run: e_longbox1/ENGAUTOSYS45-01; 2015/06/22 06:33:40 MDT;
        None; 2015/06/22 11:33:48 MDT>,
    <job run: e_longbox1_b1_02/ENGAUTOSYS45-01; 2015/06/22 10:26:46 MDT;
        2015/06/22 10:26:48 MDT; 2015/06/22 11:33:46 MDT>,
    <job run: e_longbox1_b1/ENGAUTOSYS45-01; 2015/06/22 09:33:06 MDT;
        None; 2015/06/22 11:33:47 MDT>]

Example job_runs_for_scheduler() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    list = job_runs_for_scheduler(from_date='2015/6/22 11:00:00 MDT',
    to_date='2015/6/22 11:00:01 MDT', scheduler='autosys45')

    for l in list:
      print "job: " + l.job()
      print " scheduler: " + l.scheduler()
      print " start time: " + l.start_time()
      print " running time: " + str(l.running_time())
      print " end time: " + str(l.end_time())
      print " term status: " + str(l.term_status())
      print " machine : " + str(l.machine())
      print " run impl: " + str(l.run_impl())
      print " job impl: " + str(l.job_impl())

    print 'end output'

finally:
    logout()

job_runs_for_jobs_by_start_time()

Get information about specific jobs that were started during a given time span.

Note: Depending on the arguments, this call could be very expensive and/or return a very large result.

Parameters:

  • jobs - sequence of tuples, (job name, scheduler name), such as are returned by jobs() or downstream_jobs()

  • from_date - earliest allowed start time of the returned runs, in the format handled by parse_date() ('2007/1/15 13:21:00 MST')

  • to_date - latest allowed start time of the returned runs, in the format handled by parse_date() ('2007/1/15 13:21:00 MST')

    More information:

Dependencies:

  • Must be logged in

Result:

  • A list of Job Run objects representing runs of a given sequence of jobs, see Job Run.

Example job_runs_for_jobs_by_start_time() command line usage:

>>> job_runs_for_jobs_by_start_time(jobs=[
    (u'e-eom-cleanup-bat', u'autosysR11-02'),
    (u'Hourly_Target3', u'autosysR11-02')],
    from_date='2015/6/1 10:00:00 MDT',
    to_date='2015/6/1 12:00:00 MDT')
done
[<job run: Hourly_Target3/autosysR11-02; 2015/06/01 10:33:29 MDT;
    2015/06/01 10:33:29 MDT; 2015/06/01 10:36:29 MDT>,
    <job run: Hourly_Target3/autosysR11-02; 2015/06/01 11:27:29 MDT;
    2015/06/01 11:27:29 MDT; 2015/06/01 11:30:29 MDT>]

Example job_runs_for_jobs_by_start_time() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    list = job_runs_for_jobs_by_start_time(jobs=[
      (u'MHDOCE', u'CA7'),
      (u'mkt_price_Paris', u'autosys45')],
      from_date='2015/6/1 10:00:00 MDT',
      to_date='2015/6/1 12:00:00 MDT')

    for l in list:
      print "job: " + l.job()
      print " scheduler: " + l.scheduler()
      print " start time: " + l.start_time()
      print " running time: " + str(l.running_time())
      print " end time: " + str(l.end_time())
      print " term status: " + str(l.term_status())
      print " machine : " + str(l.machine())
      print " run impl: " + str(l.run_impl())
      print " job impl: " + str(l.job_impl())

    print 'end output'

finally:
  logout()

jobs()

Get jobs with name matching a regular expression.

Parameters:

  • pattern (optional) - regex to match against job name

    Default: '.*'

  • includeDeletedJobs (optional) - indicates whether or not deleted jobs should be included in results

    Default: False

Dependencies:

  • Must be logged in

Result:

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

Example jobs() command line usage:

>>> jobs(pattern='e-1-del', includeDeletedJobs=True)
[(u'e-1-del', u'autosysR11-01'), (u'e-1-del', u'autosysR11-02'),
    (u'e-1-del', u'autosys45'), (u'e-1-del', u'ENGAUTOSYS45-01')]

Example jobs() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jbs = jobs(pattern='e-1-del', includeDeletedJobs=True)
    for j in jbs:
    print 'job: ' + j[0] + ', scheduler: ' + j[1]

    print 'end output'

finally:
    logout()

jobstream_jobs_by_command()

Get jobs in the hypothetical jobstream where the command matches a pattern, returning a list of jobs that would be in a jobstream given the parameters passed in.

Parameters:

  • target_job_name - name of the target job that defines the jobstream in which to look for jobs that match a given command pattern

  • 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 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.

  • pattern [optional, but highly encouraged] - regex to match against all the jobs in the jobstream

    Default: '.*'

  • 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

Result:

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

Example jobstream_jobs_by_command() command line usage:

>>> jobstream_jobs_by_command(target_job_name='tsjs1_target',
    scheduler='autosysR11-01')
[(u'tsjs1_NeedsCustomHS', u'autosysR11-01'),
    (u'tsjs1_jobD', u'autosysR11-01'),
    (u'tsjs1_jobB', u'autosysR11-01'),
    (u'tsjs1_jobC', u'autosysR11-01'),
    (u'tsjs1_target', u'autosysR11-01'),
    (u'tsjs1_jobA', u'autosysR11-01')]

>>> jobstream_jobs_by_command(target_job_name='MHDOCE',
    scheduler='CA7', included_trim_points=[
    (u'n-sod-poschk-pl', u'autosysR11-02'),
    (u'n-eod-copyini-bat', u'ENGAUTOSYS45-01')],
    excluded_trim_points=[(u'DE3834_jobB', u'CLI - API - cm03'),
    (u'Failure_test_next', u'autosysR11-01')],
    pattern='LDJOB21', sched_id='001',
    auto_trim_options=AutoTrimOptions(1.8, 0.3, True, True))

Example jobstream_jobs_by_command() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jjbc = jobstream_jobs_by_command(target_job_name='e-som-totwrth-bat',
    scheduler='autosys45')

    for j in jjbc:
    print 'job: ' + j[0] + ', ' + 'scheduler: ' + j[1]

    print 'end output'

finally:
    logout()

jobstream_jobs_by_condition()

Get jobs in the hypothetical jobstream where the condition matches a pattern, returning a list of jobs that would be in a jobstream given the parameters passed in.

Parameters:

  • target_job_name - name of the target job that defines the jobstream in which to look for jobs that match a given condition pattern

  • 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 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.

  • pattern[optional, but highly encouraged] - regex to match against all the jobs in the jobstream

    Default: '.*'

  • 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

Result:

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

Example jobstream_jobs_by_condition() command line usage:

>>> jobstream_jobs_by_condition(target_job_name='tsjs1_target',
    scheduler='autosysR11-01')
[(u'tsjs1_jobD', u'autosysR11-01'),
    (u'tsjs1_jobB', u'autosysR11-01'),
    (u'tsjs1_jobC', u'autosysR11-01'),
    (u'tsjs1_target', u'autosysR11-01')]

>>> jobstream_jobs_by_condition(target_job_name='MHDOCE',
    scheduler='CA7', included_trim_points=[
    (u'n-sod-poschk-pl', u'autosysR11-02'),
    (u'n-eod-copyini-bat', u'ENGAUTOSYS45-01')],
    excluded_trim_points=[(u'DE3834_jobB', u'CLI - API - cm03'),
    (u'Failure_test_next', u'autosysR11-01')],
    pattern='LDJOB21', sched_id='001',
    auto_trim_options=AutoTrimOptions(1.8, 0.3, True, True))

Example jobstream_jobs_by_condition() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jjbc = jobstream_jobs_by_condition(target_job_name='e-som-totwrth-bat',
    scheduler='autosys45')

    for j in jjbc:
    print 'job: ' + j[0] + ', ' + 'scheduler: ' + j[1]

    print 'end output'

finally:
    logout()

jobstream_jobs_by_name()

Get jobs in the hypothetical jobstream where the name matches a pattern, returning a list of jobs that would be in a jobstream given the parameters passed in.

Note: The result does not indicate which scheduler each job is defined in, which could be confusing if the stream involves cross-instance dependencies.

Parameters:

  • target_job_name - name of the target job that defines the jobstream in which to look for jobs that match a given name pattern

  • 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 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.

  • pattern[optional, but highly encouraged] - regex to match against all the jobs in the jobstream

    Default: '.*'

  • 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

Result:

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

Example jobstream_jobs_by_name() command line usage:

>>> jobstream_jobs_by_name(target_job_name='tsjs1_target',
    scheduler='autosysR11-01')
[(u'tsjs1_NeedsCustomHS', u'autosysR11-01'),
    (u'tsjs1_jobD', u'autosysR11-01'),
    (u'tsjs1_jobB', u'autosysR11-01'),
    (u'tsjs1_jobC', u'autosysR11-01'),
    (u'tsjs1_target', u'autosysR11-01'),
    (u'tsjs1_jobA', u'autosysR11-01')]

>>> jobstream_jobs_by_name(target_job_name='MHDOCE',
    scheduler='CA7', included_trim_points=[
    (u'n-sod-poschk-pl', u'autosysR11-02'),
    (u'n-eod-copyini-bat', u'ENGAUTOSYS45-01')],
    excluded_trim_points=[(u'DE3834_jobB', u'CLI - API - cm03'),
    (u'Failure_test_next', u'autosysR11-01')],
    pattern='LDJOB21', sched_id='001',
    auto_trim_options=AutoTrimOptions(1.8, 0.3, True, True))

Example jobstream_jobs_by_name() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jjbn = jobstream_jobs_by_name(target_job_name='e-som-totwrth-bat',
    scheduler='autosys45')

    for j in jjbn:
      print 'job: ' + j[0] + ', ' + 'scheduler: ' + j[1]

    print 'end output'

finally:
    logout()

jobstream_jobs_with_no_run_frequency()

Get jobs in the hypothetical jobstream where the job has no system calculated run frequency, returning a list of jobs that would be in a jobstream given the parameters passed in.

Parameters:

  • target_job_name - name of the target job that defines the jobstream in which to look for jobs that have hard start times

  • 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 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

Result:

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

Example jobstream_jobs_with_no_run_frequency() command line usage:

>>> jobstream_jobs_with_no_run_frequency(target_job_name='k-end-som-ns-pl',
    scheduler='autosys45', 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')])
[(u'k-dly-vlu-4-sh', u'autosys45'), (u'k-dly-vlu-2-sh', u'autosys45'),
    (u'k-dly-vlu-1-sh', u'autosys45'), (u'k-box', u'autosys45'),
    (u'k-som-box', u'autosys45'), (u'k-dly-vlu-3-sh', u'autosys45'),
    (u'k-dly-vlu-5-sh', u'autosys45'), (u'k-dly-vlu-6-sh', u'autosys45')]

>>> jobstream_jobs_with_no_run_frequency(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_jobs_with_no_run_frequency() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jjwst = jobstream_jobs_with_no_run_frequency(
      target_job_name='e-som-totwrth-bat', scheduler='autosys45')

    for j in jjwst:
      print 'job: ' + j[0] + ', ' + 'scheduler: ' + j[1]

    print 'end output'

finally:
    logout()

jobstream_jobs_with_start_times()

Get jobs in the hypothetical jobstream where the job has hard start times, returning a list of jobs that would be in a jobstream given the parameters passed in.

Parameters:

  • target_job_name - name of the target job that defines the jobstream in which to look for jobs that have hard start times

  • 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 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

Result:

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

Example jobstream_jobs_with_start_times() command line usage:

>>> jobstream_jobs_with_start_times(target_job_name='k-end-som-ns-pl',
    scheduler='autosys45', 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')])
[(u'k-dly-vlu-4-sh', u'autosys45'), (u'k-dly-vlu-2-sh', u'autosys45'),
    (u'k-dly-vlu-1-sh', u'autosys45'), (u'k-box', u'autosys45'),
    (u'k-som-box', u'autosys45'), (u'k-dly-vlu-3-sh', u'autosys45'),
    (u'k-dly-vlu-5-sh', u'autosys45'), (u'k-dly-vlu-6-sh', u'autosys45')]

>>> jobstream_jobs_with_start_times(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_jobs_with_start_times() script usage:

import sys
from jaws import *

login()
print 'begin output'
try:
    jjwst = jobstream_jobs_with_start_times(
      target_job_name='e-som-totwrth-bat', scheduler='autosys45')

    for j in jjwst:
      print 'job: ' + j[0] + ', ' + 'scheduler: ' + j[1]

    print 'end output'

finally:
    logout()

jobstream_repetitive_jobs()

Get jobs in the hypothetical jobstream which run much more or less often than the target job, returning a list of jobs that would be in a jobstream given the parameters passed in.

A repetitive job is one that ran more than twice as often as the target job over the last month. An infrequent job ran less than half as often. The number of days of data to consider, as well as the threshold frequency values, can be adjusted in the Configuration Tool.

By default, only repetitive jobs are returned.

Parameters:

  • target_job_name - name of the target job that defines the jobstream in which to look for repetitive and/or infrequent 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 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 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.

  • includeRepetitive (optional) - if True, then repetitive jobs are returned - repetitive jobs run twice as often as jobstream target jobs

    Default: True

  • includeInfrequent (optional) - if True, then infrequent jobs are returned - infrequent jobs run half as often as jobstream target jobs

    Default: False

  • branchTopsOnly (optional) - if True, the result is filtered to include the smallest set of jobs which, if excluded, would result in the removal of all repetitive jobs from the stream

    Default: True

  • 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:

  • Dictionary mapping tuples (job name, scheduler name) to a measure of the relative frequency of each job, as compared to the target job. For example, the result { ('job1', 'Scheduler1'): 7.0 } means that job1 ran 7 times as often as the target job, and no other job ran more than twice as often as the target job.

  • The keys of this dictionary can be used as the excluded_jobs argument to add_jobstream() or update_filter_jobs(), for example.

    More information:

Example jobstream_repetitive_jobs() command line usage:

>>> jobstream_repetitive_jobs(target_job_name='e-mrn-dst-run',
    scheduler='autosys45', 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')],
    includeRepetitive=True, includeInfrequent=True,
    branchTopsOnly=True)
{(u'e-rates-fw', u'autosys45'): 2.0278598979766502}

>>> jobstream_repetitive_jobs(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_repetitive_jobs() script usage:

import sys
from jaws import *

login()
print 'begin'
try:
    repetitive = jobstream_repetitive_jobs(
      target_job_name='e-mrn-dst-run', scheduler='autosys45')

    update_filter_jobs(job_stream_name='a-box',
    excluded_trim_points=repetitive)

    print 'end'

finally:
    logout()