edu.isi.pegasus.planner.catalog.site.impl
Class OSGMM

java.lang.Object
  extended by edu.isi.pegasus.planner.catalog.site.impl.OSGMM
All Implemented Interfaces:
Catalog, SiteCatalog

public class OSGMM
extends Object
implements SiteCatalog

The OSGMM implementation of the Site Catalog interface. This implementation also has a method to generate the SRM property mappings to be used by Pegasus. The following pegasus properties are created for the sites that have the SRM information available.

 pegasus.transfer.srm.[sitename].service.url
 pegasus.transfer.srm.[sitename].service.mountpoint
 

Version:
$Revision: 2932 $
Author:
Karan Vahi

Nested Class Summary
private  class OSGMM.ListCallback
          An inner class, that implements the StreamGobblerCallback to store all the lines in a List
 
Field Summary
static String DEFAULT_CONDOR_COLLECTOR
          The default condor collector to query to for non LIGO VO's
static String DEFAULT_CONDOR_COLLECTOR_PROPERTY_KEY
          The property key without the pegasus prefix'es to get the condor collector host.
static String DEFAULT_GRID
          The default Grid to retreive the sites for.
static String DEFAULT_GRID_PROPERTY_KEY
          The property key without the pegasus prefix'es to get the grid.
static String DEFAULT_LIGO_CONDOR_COLLECTOR
          The default condor collector to query to for LIGO VO
static boolean DEFAULT_RETRIEVE_VALIDATED_SITES
          The default VO to use to query the condor collector.
static String DEFAULT_RETRIEVE_VALIDATED_SITES_PROPERTY_KEY
          The property key without the pegasus prefix'es to get the VO.
static String DEFAULT_VO
          The default VO to use to query the condor collector.
static String DEFAULT_VO_PROPERTY_KEY
          The property key without the pegasus prefix'es to get the VO.
static String ENGAGE_VO
          The name of the ENGAGE VO
static String LIGO_VO
          The name of the LIGO VO
private  String mCollectorHost
          The collector host to query to.
(package private)  List<String> mCondorStatusError
          The List storing the stderr of condor-status.
(package private)  List<String> mCondorStatusOutput
          The List storing the output of condor-status.
private  String mGrid
          The grid to which the user belongs to.
private  LogManager mLogger
          The handle to the log manager.
private  SiteStore mSiteStore
          The SiteStore object where information about the sites is stored.
private  String mVO
          The VO to which the user belongs to.
static String PEGASUS_PROPERTY_PREFIX
          The pegasus property prefix.
 
Fields inherited from interface edu.isi.pegasus.planner.catalog.SiteCatalog
c_prefix, VERSION
 
Fields inherited from interface edu.isi.pegasus.planner.catalog.Catalog
DB_ALL_PREFIX
 
Constructor Summary
OSGMM()
          The default constructor.
 
Method Summary
 void close()
          Closes the connection.
 boolean connect(Properties props)
          Issues the condor status command, and stores the results retrieved back into a List.
private static SiteInfo convertToSiteInfo(edu.clemson.SiteCatalogGenerator.Site s)
          An adapter method that converts the Site object to the SiteInfo object corresponding to the site catalog schema version 2.
private  String createPropertyKey(String site, String suffix)
          Creates the property key
 Properties generateSRMProperties()
          Generates SRM properties that can be used by Pegasus to do SRM URL substitution for the case where all the data is accessible on the worker nodes locally.
 Properties generateSRMProperties(String line)
          Generates SRM properties that can be used by Pegasus to do SRM URL substitution for the case where all the data is accessible on the worker nodes locally for a particular site.
 int insert(SiteCatalogEntry entry)
          Inserts a new mapping into the Site catalog.
 boolean isClosed()
          Returns if the connection is closed or not.
 Set<String> list()
          Lists the site handles for all the sites in the Site Catalog.
 int load(List<String> sites)
          Loads up the Site Catalog implementation with the sites whose site handles are specified.
 SiteCatalogEntry lookup(String handle)
          Retrieves the SiteCatalogEntry for a site.
 int remove(String handle)
          Removes a site catalog entry matching the the handle.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CONDOR_COLLECTOR_PROPERTY_KEY

public static final String DEFAULT_CONDOR_COLLECTOR_PROPERTY_KEY
The property key without the pegasus prefix'es to get the condor collector host.

See Also:
Constant Field Values

PEGASUS_PROPERTY_PREFIX

public static final String PEGASUS_PROPERTY_PREFIX
The pegasus property prefix.

See Also:
Constant Field Values

ENGAGE_VO

public static final String ENGAGE_VO
The name of the ENGAGE VO

See Also:
Constant Field Values

DEFAULT_CONDOR_COLLECTOR

public static final String DEFAULT_CONDOR_COLLECTOR
The default condor collector to query to for non LIGO VO's

See Also:
Constant Field Values

LIGO_VO

public static final String LIGO_VO
The name of the LIGO VO

See Also:
Constant Field Values

DEFAULT_LIGO_CONDOR_COLLECTOR

public static final String DEFAULT_LIGO_CONDOR_COLLECTOR
The default condor collector to query to for LIGO VO

See Also:
Constant Field Values

DEFAULT_VO_PROPERTY_KEY

public static final String DEFAULT_VO_PROPERTY_KEY
The property key without the pegasus prefix'es to get the VO.

See Also:
Constant Field Values

DEFAULT_VO

public static final String DEFAULT_VO
The default VO to use to query the condor collector.

See Also:
Constant Field Values

DEFAULT_GRID_PROPERTY_KEY

public static final String DEFAULT_GRID_PROPERTY_KEY
The property key without the pegasus prefix'es to get the grid.

See Also:
Constant Field Values

DEFAULT_GRID

public static final String DEFAULT_GRID
The default Grid to retreive the sites for.

See Also:
Constant Field Values

DEFAULT_RETRIEVE_VALIDATED_SITES_PROPERTY_KEY

public static final String DEFAULT_RETRIEVE_VALIDATED_SITES_PROPERTY_KEY
The property key without the pegasus prefix'es to get the VO.

See Also:
Constant Field Values

DEFAULT_RETRIEVE_VALIDATED_SITES

public static final boolean DEFAULT_RETRIEVE_VALIDATED_SITES
The default VO to use to query the condor collector.

See Also:
Constant Field Values

mCondorStatusOutput

List<String> mCondorStatusOutput
The List storing the output of condor-status.


mCondorStatusError

List<String> mCondorStatusError
The List storing the stderr of condor-status.


mSiteStore

private SiteStore mSiteStore
The SiteStore object where information about the sites is stored.


mLogger

private LogManager mLogger
The handle to the log manager.


mVO

private String mVO
The VO to which the user belongs to.


mCollectorHost

private String mCollectorHost
The collector host to query to.


mGrid

private String mGrid
The grid to which the user belongs to.

Constructor Detail

OSGMM

public OSGMM()
The default constructor.

Method Detail

convertToSiteInfo

private static SiteInfo convertToSiteInfo(edu.clemson.SiteCatalogGenerator.Site s)
                                   throws Exception
An adapter method that converts the Site object to the SiteInfo object corresponding to the site catalog schema version 2.

Parameters:
s - the Site object to convert.
Returns:
the coverted SiteInfo object
Throws:
Exception

insert

public int insert(SiteCatalogEntry entry)
           throws SiteCatalogException
Description copied from interface: SiteCatalog
Inserts a new mapping into the Site catalog.

Specified by:
insert in interface SiteCatalog
Parameters:
entry - the SiteCatalogEntry object that describes a site.
Returns:
number of insertions, should always be 1. On failure, throw an exception, don't use zero.
Throws:
SiteCatalogException - in case of error.

list

public Set<String> list()
                 throws SiteCatalogException
Description copied from interface: SiteCatalog
Lists the site handles for all the sites in the Site Catalog.

Specified by:
list in interface SiteCatalog
Returns:
A set of site handles.
Throws:
SiteCatalogException - in case of error.

load

public int load(List<String> sites)
         throws SiteCatalogException
Loads up the Site Catalog implementation with the sites whose site handles are specified. This is a convenience method, that can allow the backend implementations to maintain soft state if required. If the implementation chooses not to implement this, just do an empty implementation. The site handle * is a special handle designating all sites are to be loaded.

Specified by:
load in interface SiteCatalog
Parameters:
sites - the list of sites to be loaded.
Returns:
the number of sites loaded.
Throws:
SiteCatalogException - in case of error.

lookup

public SiteCatalogEntry lookup(String handle)
                        throws SiteCatalogException
Description copied from interface: SiteCatalog
Retrieves the SiteCatalogEntry for a site.

Specified by:
lookup in interface SiteCatalog
Parameters:
handle - the site handle / identifier.
Returns:
SiteCatalogEntry in case an entry is found , or null if no match is found.
Throws:
SiteCatalogException - in case of error.

remove

public int remove(String handle)
           throws SiteCatalogException
Description copied from interface: SiteCatalog
Removes a site catalog entry matching the the handle.

Specified by:
remove in interface SiteCatalog
Parameters:
handle - the site handle / identifier.
Returns:
the number of removed entries.
Throws:
SiteCatalogException - in case of error.

close

public void close()
Closes the connection. It resets the internal buffers that contain output of the condor_status command.

Specified by:
close in interface Catalog

connect

public boolean connect(Properties props)
                throws SiteCatalogException
Issues the condor status command, and stores the results retrieved back into a List.

Specified by:
connect in interface Catalog
Parameters:
props - is the property table with sufficient settings to to connect to the implementation.
Returns:
true if connected, false if failed to connect.
Throws:
SiteCatalogException

generateSRMProperties

public Properties generateSRMProperties()
Generates SRM properties that can be used by Pegasus to do SRM URL substitution for the case where all the data is accessible on the worker nodes locally.

Returns:
Properties object containing the relevant Properties.

generateSRMProperties

public Properties generateSRMProperties(String line)
Generates SRM properties that can be used by Pegasus to do SRM URL substitution for the case where all the data is accessible on the worker nodes locally for a particular site. The condor status output for a single site site is passed as input. Example condor_status output for a site
 CIT_CMS_T2;srm://cit-se.ultralight.org:8443/srm/v2/server?SFN=/mnt/hadoop/osg;/mnt/hadoop/osg;/mnt/hadoop/osg;/mnt/hadoop,/mnt/hadoop;
 
The properties created have the following keys
 pegasus.transfer.srm.[sitename].service.url
 pegasus.transfer.srm.[sitename].service.mountpoint
 
where [sitename] is replaced by the name of the site.

Parameters:
line - the line from condor_status output for a site.
Returns:
Properties object containing the relevant Properties.

createPropertyKey

private String createPropertyKey(String site,
                                 String suffix)
Creates the property key

Parameters:
site - the name of site
suffix - the suffix to be added to site.
Returns:
the property key.

isClosed

public boolean isClosed()
Returns if the connection is closed or not.

Specified by:
isClosed in interface Catalog
Returns:
boolean indicating connection is closed.
See Also:
Catalog.close()


Copyright © 2011 The University of Southern California. All Rights Reserved.