edu.isi.pegasus.planner.selector.site

## Class Group

- java.lang.Object
- - edu.isi.pegasus.planner.selector.site.Abstract
  - - edu.isi.pegasus.planner.selector.site.Group

All Implemented Interfaces:
  SiteSelector

    public class Group
    extends Abstract

A site selector than ends up doing grouping jobs together on the basis of an identifier specifed in the dax for the jobs, and schedules them on to the same site. Currently, the identifier is key `group` in the pegasus profile namespace. All the jobs that do not have a group associated with them are put in one default group and end up being scheduled on the same pool. A limitation of this site selector is that it does not check whether all the jobs can be scheduled on a particular pool or not. It just checks whether the first job can be or not. The reason for that is after the grouping the the selector just hands the first job in each group to the other site selectors that work on jobs. Currently, it hands it to the Random Site Selector. In the DAX, a job tagged with groups will look as follows

     <job id="ID000001" namespace="pegasus" name="preprocess" version="1.0" level="3">
        <profile namespace="pegasus" key="group">group-1</profile>
        <argument>-a top -T 6  -i <filename file="f.a"/>  -o <filename file="f.b"/> </argument>
        <uses file="f.a" link="input" register="false" transfer="true" type="data"/>
        <uses file="f.b" link="output" register="true" transfer="true" type="data"/>
     </job>

Version:
  $Revision$
Author:
  Karan Vahi, Gaurang Mehta, Mei-Hui Su

### Field Summary

Fields
`private static java.lang.String` `mDefaultGroup` The name of the group into which jobs are grouped if no group is specified in the dax.
`private static java.lang.String` `mDescription` The description of the site selector.
`private java.util.Map` `mGroupMap` The map containing the the jobs grouped by the key group.
`private AbstractPerJob` `mSelector` The handle to the internal site selector that is used to schedule jobs amongst the groups.

### Fields inherited from class edu.isi.pegasus.planner.selector.site.Abstract

`mBag, mLogger, mProps, mSiteStore, mTCMapper`

### Fields inherited from interface edu.isi.pegasus.planner.selector.SiteSelector

`SITE_NOT_FOUND, VERSION`

### Constructor Summary

Constructors
Constructor and Description
`Group()` The default constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.lang.String` `description()` Returns the description of the site selector.
`void` `initialize(PegasusBag bag)` Initializes the site selector.
`private void` `insert(Job job)` Inserts the job into the group map.
`void` `mapWorkflow(ADag workflow, java.util.List sites)` The call out to map a list of jobs on to the execution pools.

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

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

### Field Detail

#### mDescription

    private static final java.lang.String mDescription

The description of the site selector.

See Also:
  Constant Field Values

#### mDefaultGroup

    private static final java.lang.String mDefaultGroup

The name of the group into which jobs are grouped if no group is specified in the dax.

See Also:
  Constant Field Values

#### mGroupMap

    private java.util.Map mGroupMap

The map containing the the jobs grouped by the key group.

#### mSelector

    private AbstractPerJob mSelector

The handle to the internal site selector that is used to schedule jobs amongst the groups.

### Constructor Detail

#### Group

    public Group()

The default constructor.

### Method Detail

#### initialize

    public void initialize(PegasusBag bag)

Initializes the site selector.

Specified by:
  `initialize` in interface `SiteSelector`
Overrides:
  `initialize` in class `Abstract`
Parameters:
  `bag` - the bag of objects that is useful for initialization.

#### description

    public java.lang.String description()

Returns the description of the site selector.

Returns:
  description.

#### mapWorkflow

    public void mapWorkflow(ADag workflow,
                            java.util.List sites)

The call out to map a list of jobs on to the execution pools. A default implementation is provided that internally calls mapJob2ExecPool(Job, String,String,String) to map each of the jobs sequentially to an execution site. The reason for this method is to support site selectors that make their decision on a group of jobs i.e use backtracking to reach a good decision. The implementation that calls out to an executable using Runtime does not implement this method, but relies on the default implementation defined here.

Parameters:
  `workflow` - the workflow that needs to be scheduled.
  `sites` - the list of `String` objects representing the execution pools that can be used.

#### insert

    private void insert(Job job)

Inserts the job into the group map.

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