com.novell.zos.jdl
Class RunJobSpec

java.lang.Object
  extended by com.novell.zos.jdl.RunJobSpec

public class RunJobSpec
extends java.lang.Object

Defines the attributes for starting a child job or a stand-alone job.

An instance of this class is passed to self.runJob().

Example of using RunJobSpec for starting a child job with a custom instance name and supplying a job argument

      spec = RunJobSpec()
      spec.setJobName("quickie")
      spec.setInstanceName("quickie child")
      spec.setJobArgs( { "numJoblets" : 5 } )
      self.runJob(spec)
 

Example of using RunJobSpec with a resource Constraint. The constraint only chooses resources that belong to a specific resource group:

      c = ContainsConstraint()
      c.setFact("resource.groups")
      c.setValue("webserver-group")

      spec = RunJobSpec()
      spec.setJobName("myChildJob")
      spec.setConstraint(c)
      self.runJob(spec)
 
Example of starting a stand-alone job. The new Job will not be a child job of the current job.
      spec = RunJobSpec()
      spec.setJobName("quickie")
      spec.setInstanceName("quickie stand-alone")
      spec.setJobArgs( { "numJoblets" : 5 } )
      spec.setStandAlone(True)
      self.runJob(spec)
 


Constructor Summary
RunJobSpec()
          Construct a default RunJobSpec.
 
Method Summary
 void setConstraint(Constraint constraint)
          Set an additional constraint to use for the new job instance.
 void setInstanceName(java.lang.String instanceName)
          Define a job instance name.
 void setJobArgs(org.python.core.PyDictionary arguments)
          Define the job arguments to supply to the child job.
 void setJobName(java.lang.String jobName)
          Define the deployed job name of the child job to run.
 void setJobTracing(boolean tracing)
          Enable or disable job and joblet tracing (for debug purposes).
 void setPolicy(java.lang.String policy)
          Set an additional policy of constraints to use for the new job instance.
 void setPolicyName(java.lang.String policyName)
          Set an additional previously deployed policy of constraints to use for the new job instance.
 void setPriority(int priority)
          Set a priority for this job using supplied integer constant.
 void setPriority(java.lang.String priority)
          Set a priority for this job using supplied string.
 void setStandAlone(boolean standAlone)
          Indicates that the new job will not be a child job but a new stand alone job.
 void setStartTime(long time)
          Set the start time for this job based on number of milliseconds since epoch.
 void setStartTime(java.lang.String time)
          Set the start time for this job using a supplied date/time string.
 void setWaitForCompletion(boolean waitForCompletion)
          Indicates that the runjob() invocation waits until the child job has completed running.
 void setWaitForRunning(boolean waitForRunning)
          Indicates that the runjob() invocation waits until the child job has transitioned to the Running state.
 void setWaitForStarting(boolean waitForStarting)
          Indicates that the runjob() invocation waits until the child job has transitioned to the Starting state.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RunJobSpec

public RunJobSpec()
Construct a default RunJobSpec.

Method Detail

setJobArgs

public void setJobArgs(org.python.core.PyDictionary arguments)
Define the job arguments to supply to the child job. These are any facts defined in policy for the jobargs namespace. If job arguments are required by the job then the arguments are required. This function is not use if no job arguments are defined for the job to run.

Parameters:
arguments - Dictionary of job argument name and value pairs

setJobTracing

public void setJobTracing(boolean tracing)
Enable or disable job and joblet tracing (for debug purposes).

Parameters:
tracing - true to enable tracing, false to use job default

setJobName

public void setJobName(java.lang.String jobName)
Define the deployed job name of the child job to run. Required.

Parameters:
jobName - Deployed job name of child job to run

setInstanceName

public void setInstanceName(java.lang.String instanceName)
Define a job instance name. The default is to use the deployed job name as the instance name. Optional.

Parameters:
instanceName - Job instance name

setPriority

public void setPriority(java.lang.String priority)
Set a priority for this job using supplied string. Default is the user's priority. Optional.

Parameters:
priority - Priority to set in the user's band

setPriority

public void setPriority(int priority)
Set a priority for this job using supplied integer constant. Default is the user's priority. Optional.

Parameters:
priority - Priority to set in the user's band

setStartTime

public void setStartTime(long time)
Set the start time for this job based on number of milliseconds since epoch. Optional.

Parameters:
time - Milliseconds since epoch

setStartTime

public void setStartTime(java.lang.String time)
Set the start time for this job using a supplied date/time string.

Examples:

      "2/15/07"
      "2/15/07 5 PM"
      "8 AM"
 
Optional.

Parameters:
time - date/time string to start the job

setPolicy

public void setPolicy(java.lang.String policy)
Set an additional policy of constraints to use for the new job instance. Optional

Parameters:
policy - Policy text

setPolicyName

public void setPolicyName(java.lang.String policyName)
Set an additional previously deployed policy of constraints to use for the new job instance. The policy must already exist. Optional.

Parameters:
policyName - Name of an already deployed policy

setConstraint

public void setConstraint(Constraint constraint)
Set an additional constraint to use for the new job instance. Optional.

Parameters:
constraint - Constraint instance

setStandAlone

public void setStandAlone(boolean standAlone)
Indicates that the new job will not be a child job but a new stand alone job. The default is new jobs are child jobs of the initiating job.

Parameters:
standAlone - true to create a new stand alone job, false (default) to create a child job

setWaitForStarting

public void setWaitForStarting(boolean waitForStarting)
Indicates that the runjob() invocation waits until the child job has transitioned to the Starting state.

A Job instance will not transition to Starting if it is Queued.

Parameters:
waitForStarting - true to wait, false (the default) to not wait

setWaitForRunning

public void setWaitForRunning(boolean waitForRunning)
Indicates that the runjob() invocation waits until the child job has transitioned to the Running state.

While a job instance is still in the Starting state, it will queue any events. The Starting state is best viewed as the job instance is still in construction.

Parameters:
waitForRunning - true to wait, false (the default) to not wait

setWaitForCompletion

public void setWaitForCompletion(boolean waitForCompletion)
Indicates that the runjob() invocation waits until the child job has completed running. This includes failures and cancellation.

Example of starting a job and waiting for the job to end.

    spec = RunJobSpec()
    spec.setJobName("quickie")
    spec.setInstanceName("quickie child")
    spec.setJobArgs( { "numJoblets" : 5 } )
    spec.setWaitForCompletion(True)
    childJob = self.runJob(spec)
    if childJob.getFact("jobinstance.state") == Job.COMPLETED_STATE:
        print "Child job ran successfully"
    else:
        print "Child job did not run succesfully"
 

Parameters:
waitForCompletion - true to wait, false (the default) to not wait


Copyright (c) 2011 Novell, Inc. All rights reserved.