edu.isi.pegasus.planner.classes

## Class AggregatedJob

- java.lang.Object
- - edu.isi.pegasus.planner.classes.Data
  - - edu.isi.pegasus.planner.classes.Job
    - - edu.isi.pegasus.planner.classes.AggregatedJob

All Implemented Interfaces:
  Graph, GraphNodeContent, java.lang.Cloneable

    public class AggregatedJob
    extends Job
    implements Graph

This class holds all the specifics of an aggregated job. An aggregated job or a clustered job is a job, that contains a collection of smaller jobs. An aggregated job during execution may explode into n smaller job executions. At present it does not store information about the dependencies between the jobs.

Version:
  $Revision$
Author:
  Karan Vahi

### Field Summary

Fields
`private Graph` `mGraphImplementor` Handle to the Graph implementor.
`private boolean` `mHasBeenRenderedToExecutableForm` Boolean indicating whether a job has been fully rendered to an executable job or not i.e the aggregated job has been mapped to the aggregator and the constituent jobs have been gridstarted or not.
`private JobAggregator` `mJobAggregator` Handle to the JobAggregator that created this job.

### Fields inherited from class edu.isi.pegasus.planner.classes.Job

`CHMOD_JOB, CLEANUP_JOB, COMPUTE_JOB, condorUniverse, condorVariables, CREATE_DIR_JOB, DAG_JOB, dagmanVariables, DAX_JOB, dvName, dvNamespace, dvVersion, envVariables, executable, executionPool, globusRSL, globusScheduler, hints, inputFiles, INTER_POOL_JOB, jobClass, jobID, jobName, level, logicalId, logicalName, namespace, outputFiles, REPLICA_REG_JOB, STAGE_IN_JOB, STAGE_IN_WORKER_PACKAGE_JOB, STAGE_OUT_JOB, stdErr, stdIn, stdOut, strargs, UNASSIGNED_JOB, vdsNS, version`

### Fields inherited from class edu.isi.pegasus.planner.classes.Data

`mLogger, mLogMsg`

### Fields inherited from interface edu.isi.pegasus.planner.partitioner.graph.Graph

`VERSION`

### Constructor Summary

Constructors
Constructor and Description
`AggregatedJob()` The default constructor.
`AggregatedJob(int num)` The overloaded constructor.
`AggregatedJob(Job job, int num)` The overloaded constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `add(Job job)` Adds a job to the aggregated job.
`void` `addEdge(GraphNode parent, GraphNode child)` Adds an edge between two already existing nodes in the graph.
`void` `addEdge(java.lang.String parent, java.lang.String child)` Adds an edge between two already existing nodes in the graph.
`void` `addEdges(java.lang.String child, java.util.List parents)` A convenience method that allows for bulk addition of edges between already existing nodes in the graph.
`void` `addNode(GraphNode node)` Adds a node to the Graph.
`void` `addRoot(GraphNode root)` Adds a single root node to the Graph.
`java.util.Iterator` `bottomUpIterator()` Returns an iterator that traverses the graph bottom up from the leaves.
`java.lang.Object` `clone()` Returns a new copy of the Object.
`java.util.Iterator<Job>` `constituentJobsIterator()` Returns an iterator to the constituent jobs of the AggregatedJob.
`Job` `getConstituentJob(int index)` Returns a job from a particular position in the list of constituent jobs
`java.lang.String` `getDAXID()` Clustered jobs never originate in the DAX.
`JobAggregator` `getJobAggregator()` Returns the JobAggregator that created this aggregated job.
`java.util.List<GraphNode>` `getLeaves()` Returns the leaf nodes of the Graph.
`GraphNode` `getNode(java.lang.String identifier)` Returns the node matching the id passed.
`java.util.List<GraphNode>` `getRoots()` Returns the root nodes of the Graph.
`boolean` `isEmpty()` Returns a boolean if there are no nodes in the graph.
`java.util.Iterator<GraphNode>` `iterator()` Returns an iterator that traverses through the graph using a graph traversal algorithm.
`java.util.Iterator<GraphNode>` `nodeIterator()` Returns an iterator for the nodes in the Graph.
`int` `numberOfConsitutentJobs()` Returns the number of constituent jobs.
`boolean` `remove(java.lang.String identifier)` Removes a node from the Graph.
`boolean` `renderedToExecutableForm()` Returns a boolean indicating whether a job has been rendered to an executable form or not
`void` `resetEdges()` Resets all the dependencies in the Graph, while preserving the nodes.
`void` `setJobAggregator(JobAggregator aggregator)` Sets the JobAggregator that created this aggregated job.
`void` `setRenderedToExecutableForm(boolean value)` Returns a boolean indicating whether a job has been rendered to an executable form or not
`int` `size()` Returns the number of nodes in the graph.
`java.util.Iterator<GraphNode>` `topologicalSortIterator()` Returns an iterator for the graph that traverses in topological sort order.
`java.lang.String` `toString()` Returns a textual description of the object.

### Methods inherited from class edu.isi.pegasus.planner.classes.Job

`addCredentialType, addCredentialType, addInputFile, addNotification, addNotifications, addNotifications, addOutputFile, addProfile, computeRuntime, equals, getArguments, getCompleteDVName, getCompleteTCName, getCredentialTypes, getDirectory, getDOTColor, getDVName, getDVNamespace, getDVVersion, getGridGatewayJobType, getID, getInputFiles, getJobManager, getJobType, getJobTypeDescription, getJobTypeDescription, getLevel, getLogicalID, getName, getNotifications, getNotifications, getOutputFiles, getPreScriptArguments, getPreScriptPath, getRemoteExecutable, getRuntime, getSiteHandle, getStagedExecutableBaseName, getStagedExecutableBaseName, getStagingSiteHandle, getStdErr, getStdIn, getStdOut, getSubmissionCredential, getTXName, getTXNamespace, getTXVersion, getUniverse, getVDSSuperNode, isMPIJob, mergeProfiles, requiresCredentials, resetCredentialTypes, resetNotifications, resetProfiles, runInWorkDirectory, setArguments, setDerivation, setDirectory, setDVName, setDVNamespace, setDVVersion, setExecutableStagingForJob, setInputFiles, setJobManager, setJobType, setLevel, setLogicalID, setName, setOutputFiles, setPreScript, setPreScript, setRemoteExecutable, setRuntime, setRuntime, setSiteHandle, setStagingSiteHandle, setStdErr, setStdIn, setStdOut, setSubmissionCredential, setTransformation, setTXName, setTXNamespace, setTXVersion, setTypeRecursive, setUniverse, setVDSSuperNode, toDOT, toDOT, typeInRange, typeRecursive, updateProfiles, updateProfiles, updateProfiles, updateProfiles, userExecutablesStagedForJob`

### Methods inherited from class edu.isi.pegasus.planner.classes.Data

`setToString, vectorToString`

### Methods inherited from class java.lang.Object

`finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Field Detail

#### mHasBeenRenderedToExecutableForm

    private boolean mHasBeenRenderedToExecutableForm

Boolean indicating whether a job has been fully rendered to an executable job or not i.e the aggregated job has been mapped to the aggregator and the constituent jobs have been gridstarted or not.

#### mJobAggregator

    private JobAggregator mJobAggregator

Handle to the JobAggregator that created this job.

#### mGraphImplementor

    private Graph mGraphImplementor

Handle to the Graph implementor.

### Constructor Detail

#### AggregatedJob

    public AggregatedJob()

The default constructor.

#### AggregatedJob

    public AggregatedJob(int num)

The overloaded constructor.

Parameters:
  `num` - the number of constituent jobs

#### AggregatedJob

    public AggregatedJob(Job job,
                         int num)

The overloaded constructor.

Parameters:
  `job` - the job whose shallow copy is created, and is the main job.
  `num` - the number of constituent jobs.

### Method Detail

#### renderedToExecutableForm

    public boolean renderedToExecutableForm()

Returns a boolean indicating whether a job has been rendered to an executable form or not

Returns:
  boolean

#### setRenderedToExecutableForm

    public void setRenderedToExecutableForm(boolean value)

Returns a boolean indicating whether a job has been rendered to an executable form or not

Parameters:
  `value` - boolean to set to.

#### setJobAggregator

    public void setJobAggregator(JobAggregator aggregator)

Sets the JobAggregator that created this aggregated job. Useful for rendering the job to an executable form later on.

Parameters:
  `aggregator` - handle to the JobAggregator used for aggregating the job

#### getJobAggregator

    public JobAggregator getJobAggregator()

Returns the JobAggregator that created this aggregated job. Useful for rendering the job to an executable form later on.

Returns:
  JobAggregator

#### add

    public void add(Job job)

Adds a job to the aggregated job.

Parameters:
  `job` - the job to be added.

#### getDAXID

    public java.lang.String getDAXID()

Clustered jobs never originate in the DAX. Always return null.

Overrides:
  `getDAXID` in class `Job`
Returns:
  null

#### clone

    public java.lang.Object clone()

Returns a new copy of the Object. The constituent jobs are also cloned.

Overrides:
  `clone` in class `Job`
Returns:
  Object

#### constituentJobsIterator

    public java.util.Iterator<Job> constituentJobsIterator()

Returns an iterator to the constituent jobs of the AggregatedJob.

Returns:
  Iterator

#### getConstituentJob

    public Job getConstituentJob(int index)

Returns a job from a particular position in the list of constituent jobs

Parameters:
  `index` - the index to retrieve from
Returns:
  a constituent job.

#### numberOfConsitutentJobs

    public int numberOfConsitutentJobs()

Returns the number of constituent jobs.

Returns:
  Iterator

#### toString

    public java.lang.String toString()

Returns a textual description of the object.

Overrides:
  `toString` in class `Job`
Returns:
  textual description of the job.

#### addNode

    public void addNode(GraphNode node)

Adds a node to the Graph. It overwrites an already existing node with the same ID.

Specified by:
  `addNode` in interface `Graph`
Parameters:
  `node` - the node to be added to the Graph.

#### addEdge

    public void addEdge(java.lang.String parent,
                        java.lang.String child)

Adds an edge between two already existing nodes in the graph.

Specified by:
  `addEdge` in interface `Graph`
Parameters:
  `parent` - the parent node ID.
  `child` - the child node ID.

#### addEdge

    public void addEdge(GraphNode parent,
                        GraphNode child)

Adds an edge between two already existing nodes in the graph.

Specified by:
  `addEdge` in interface `Graph`
Parameters:
  `parent` - the parent node .
  `child` - the child node .

#### addEdges

    public void addEdges(java.lang.String child,
                         java.util.List parents)

A convenience method that allows for bulk addition of edges between already existing nodes in the graph.

Specified by:
  `addEdges` in interface `Graph`
Parameters:
  `child` - the child node ID
  `parents` - list of parent identifiers as `String`.

#### getNode

    public GraphNode getNode(java.lang.String identifier)

Returns the node matching the id passed.

Specified by:
  `getNode` in interface `Graph`
Parameters:
  `identifier` - the id of the node.
Returns:
  the node matching the ID else null.

#### addRoot

    public void addRoot(GraphNode root)

Adds a single root node to the Graph. All the exisitng roots of the Graph become children of the root.

Specified by:
  `addRoot` in interface `Graph`
Parameters:
  `root` - the `GraphNode` to be added as a root.
Throws:
  `java.lang.RuntimeException` - if a node with the same id already exists.

#### remove

    public boolean remove(java.lang.String identifier)

Removes a node from the Graph.

Specified by:
  `remove` in interface `Graph`
Parameters:
  `identifier` - the id of the node to be removed.
Returns:
  boolean indicating whether the node was removed or not.

#### resetEdges

    public void resetEdges()

Resets all the dependencies in the Graph, while preserving the nodes. The resulting Graph is a graph of independent nodes.

Specified by:
  `resetEdges` in interface `Graph`

#### nodeIterator

    public java.util.Iterator<GraphNode> nodeIterator()

Returns an iterator for the nodes in the Graph. These iterators are fail safe.

Specified by:
  `nodeIterator` in interface `Graph`
Returns:
  Iterator

#### iterator

    public java.util.Iterator<GraphNode> iterator()

Returns an iterator that traverses through the graph using a graph traversal algorithm.

Specified by:
  `iterator` in interface `Graph`
Returns:
  Iterator through the nodes of the graph.

#### bottomUpIterator

    public java.util.Iterator bottomUpIterator()

Returns an iterator that traverses the graph bottom up from the leaves. At any one time, only one iterator can iterate through the graph.

Specified by:
  `bottomUpIterator` in interface `Graph`
Returns:
  Iterator through the nodes of the graph.

#### topologicalSortIterator

    public java.util.Iterator<GraphNode> topologicalSortIterator()

Returns an iterator for the graph that traverses in topological sort order.

Specified by:
  `topologicalSortIterator` in interface `Graph`
Returns:
  Iterator through the nodes of the graph.

#### size

    public int size()

Returns the number of nodes in the graph.

Specified by:
  `size` in interface `Graph`

#### getRoots

    public java.util.List<GraphNode> getRoots()

Returns the root nodes of the Graph.

Specified by:
  `getRoots` in interface `Graph`
Returns:
  a list containing `GraphNode` corressponding to the root nodes.

#### getLeaves

    public java.util.List<GraphNode> getLeaves()

Returns the leaf nodes of the Graph.

Specified by:
  `getLeaves` in interface `Graph`
Returns:
  a list containing `GraphNode` corressponding to the leaf nodes.

#### isEmpty

    public boolean isEmpty()

Returns a boolean if there are no nodes in the graph.

Specified by:
  `isEmpty` in interface `Graph`
Returns:
  boolean