edu.isi.pegasus.planner.refiner

## Class NodeCollapser

- java.lang.Object
- - edu.isi.pegasus.planner.refiner.Engine
  - - edu.isi.pegasus.planner.refiner.NodeCollapser

    public class NodeCollapser
    extends Engine

This collapses the nodes of the same logical name scheduled on the same pool into fewer fat nodes. The idea behind this is to collapse jobs that take a few seconds to run into a larger job, and hence reducing time because of lesser delays due to lesser number of Condor Globus interactions. Note that the merging of the edges for the jobs being collapsed at present, is not the best implementation. Once the graph structure is correct , it would be modified.

Version:
  $Revision$
Author:
  Karan Vahi vahi@isi.edu, Mei-Hui Su mei@isi.edu

### Field Summary

Fields
`private PegasusBag` `mBag` The bag of initialization objects.
`private java.lang.String` `mDirectory` The directory, where the stdin file of the fat jobs are created.
`private java.util.Map` `mGraph` The internal map that contains the adjacency list representation of the Graph referred to by the workflow.
`protected LogManager` `mLogger` The handle to the logger object.

### Fields inherited from class edu.isi.pegasus.planner.refiner.Engine

`mLogMsg, mOutputPool, mPoolFile, mPOptions, mProps, mRLIUrl, mSiteStore, mTCFile, mTCHandle, mTCMode, REGISTRATION_UNIVERSE, TRANSFER_UNIVERSE`

### Constructor Summary

Constructors
Constructor and Description
`NodeCollapser(PegasusBag bag)` The overloaded constructor.

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`ADag` `cluster(ADag dag)` Clusters the jobs in the workflow.
`ADag` `cluster(ADag dag, java.lang.String type)` Clusters the jobs in the workflow.
`protected java.util.Map` `edgeList2Graph(ADag dag, java.util.Map nameIDMap)` Returns an adjacency list representation of the graph referred to by the list of edges.
`protected java.util.Map` `edgeList2Graph(java.util.Collection<PCRelation> relations, java.util.Map nameIDMap)` Deprecated. as part of PM-747
`void` `setDirectory(java.lang.String directory)` Sets the directory where the stdin files are to be generated.

### Methods inherited from class edu.isi.pegasus.planner.refiner.Engine

`addVector, appendArrayList, complainForHeadNodeURLPrefix, complainForHeadNodeURLPrefix, loadProperties, printVector, stringInList, stringInPegVector, stringInVector, vectorToString`

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

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### mLogger

    protected LogManager mLogger

The handle to the logger object.

#### mDirectory

    private java.lang.String mDirectory

The directory, where the stdin file of the fat jobs are created. It should be the submit file directory that the user mentions at runtime.

#### mGraph

    private java.util.Map mGraph

The internal map that contains the adjacency list representation of the Graph referred to by the workflow. This is temporary till the main ADag data structure is corrected.

#### mBag

    private PegasusBag mBag

The bag of initialization objects.

### Constructor Detail

#### NodeCollapser

    public NodeCollapser(PegasusBag bag)

The overloaded constructor.

Parameters:
  `bag` - the bag of initialization objects.

### Method Detail

#### setDirectory

    public void setDirectory(java.lang.String directory)

Sets the directory where the stdin files are to be generated.

Parameters:
  `directory` - the path to the directory to which it needs to be set.

#### cluster

    public ADag cluster(ADag dag)
                 throws ClustererException

Clusters the jobs in the workflow. It applies a series of clustering actions on the graph, as specified by the user at runtime. For each clustering action, the graph is first partitioned, and then sent to the appropriate clustering module for clustering.

Parameters:
  `dag` - the scheduled dag that has to be clustered.
Returns:
  ADag containing the collapsed scheduled workflow.
Throws:
  `ClustererException` - in case of error while clustering

#### cluster

    public ADag cluster(ADag dag,
                        java.lang.String type)
                 throws ClustererException

Clusters the jobs in the workflow. The graph is first partitioned, and then sent to the appropriate clustering module for clustering.

Parameters:
  `dag` - the scheduled dag that has to be clustered.
  `type` - the type of clustering to do.
Returns:
  ADag containing the collapsed scheduled workflow.
Throws:
  `ClustererException` - in case of error while clustering

#### edgeList2Graph

    protected java.util.Map edgeList2Graph(ADag dag,
                                           java.util.Map nameIDMap)

Returns an adjacency list representation of the graph referred to by the list of edges. The map contains adjacency list with key as a child and value as the list of parents.

Parameters:
  `dag` - the workflow
  `nameIDMap` - map with the key as the jobname and value as the logical id
Returns:
  Map.

#### edgeList2Graph

    protected java.util.Map edgeList2Graph(java.util.Collection<PCRelation> relations,
                                           java.util.Map nameIDMap)

Deprecated. as part of PM-747
Returns an adjacency list representation of the graph referred to by the list of edges. The map contains adjacency list with key as a child and value as the list of parents.

Parameters:
  `relations` - collection of `PCRelation` objects that does the conversion.
  `nameIDMap` - map with the key as the jobname and value as the logical id
Returns:
  Map.