Class Restricted

java.lang.Object
edu.isi.pegasus.planner.selector.replica.Default
edu.isi.pegasus.planner.selector.replica.Restricted
All Implemented Interfaces:
ReplicaSelector

public class Restricted extends Default
A replica selector, that allows the user to specify good sites and bad sites for staging in data to a compute site.

A good site for a compute site X, is a preferred site from which replicas should be staged to site X. If there are more than one good sites having a particular replica, then a random siteis selected amongst these preferred sites.

A bad site for a compute site X, is a site from which replica's should not be staged. The reason of not accessing replica from a bad site can vary from the link being down, to the user not having permissions on that site's data.

The good | bad sites are specified by the properties pegasus.selector.replica.*.prefer.stagein.sites| pegasus.selector.replica.*.ignore.stagein.sites, where the * in the property name denotes the name of the compute site. A * in the property key is taken to mean all sites.

The pegasus.selector.replica.*.prefer.stagein.sites property takes precedence over pegasus.selector.replica.*.ignore.stagein.sites property i.e. if for a site X, a site Y is specified both in the ignored and the preferred set, then site Y is taken to mean as only a preferred site for a site X.

In order to use the replica selector implemented by this class,

        - the property pegasus.selector.replica.selector must be set to value Restricted.
 
Version:
$Revision$
Author:
Karan Vahi, Gaurang Mehta
  • Field Details

    • mDescription

      private static final String mDescription
      A short description of the replica selector.
      See Also:
    • PROPERTY_PREFIX

      private static final String PROPERTY_PREFIX
      The property prefix for all properties used by this selector.
      See Also:
    • PROPERTY_PREFER_SUFFIX

      private static final String PROPERTY_PREFER_SUFFIX
      The property suffix for determining the preferred sites for a site x.
      See Also:
    • PROPERTY_IGNORE_SUFFIX

      private static final String PROPERTY_IGNORE_SUFFIX
      The property suffix for determining the ignored sites for a site x.
      See Also:
    • mPreferredSitesMap

      private Map mPreferredSitesMap
      A Map indexed by site handles, that contains a set of site handles. The sites in the set are the sites from which to prefer data transfers to the site referred to by key of the map.
    • mGlobalPreferredSites

      private Set mGlobalPreferredSites
      The set of preferred sites, that are preferred stagein sites for all sites. Referred to by "pegasus.selector.replica.*.prefer.sites" property.
    • mIgnoredSitesMap

      private Map mIgnoredSitesMap
      A Map indexed by site handles, that contains a set of site handles. The sites in the set are the sites from which to ignore data transfers to the site referred to by key of the map.
    • mGlobalIgnoredSites

      private Set mGlobalIgnoredSites
      The Set of ignored sites, that are ignored for selecting replicas for all sites. Referred to by "pegasus.selector.replica.*.default.sites" property.
  • Constructor Details

    • Restricted

      public Restricted(edu.isi.pegasus.planner.common.PegasusProperties properties)
      The overloaded constructor, that is called by load method.
      Parameters:
      properties - the PegasusProperties object containing all the properties required by Pegasus.
  • Method Details

    • selectReplica

      public edu.isi.pegasus.planner.catalog.replica.ReplicaCatalogEntry selectReplica(edu.isi.pegasus.planner.classes.ReplicaLocation rl, String preferredSite, boolean allowLocalFileURLs)
      This chooses a location amongst all the locations returned by the replica location service. If a location is found with re attribute same as the preference pool, it is taken. Else a random location is selected and returned. If more than one location for the lfn is found at the preference pool, then also a random location amongst the ones at the preference pool is selected.
      Specified by:
      selectReplica in interface ReplicaSelector
      Overrides:
      selectReplica in class Default
      Parameters:
      rl - the ReplicaLocation object containing all the pfn's associated with that LFN.
      preferredSite - the preffered site for picking up the replicas.
      allowLocalFileURLs - indicates whether Replica Selector can select a replica on the local site / submit host.
      Returns:
      ReplicaCatalogEntry corresponding to the location selected.
      See Also:
      • ReplicaLocation
    • description

      public String description()
      Returns a short description of the replica selector.
      Specified by:
      description in interface ReplicaSelector
      Overrides:
      description in class Default
      Returns:
      string corresponding to the description.
    • prefer

      protected boolean prefer(String source, String destination)
      Returns a boolean indicating whether a source site is to be preffered for staging to a destination site
      Parameters:
      source - the source site.
      destination - the destination site.
      Returns:
      true if source is a preferred site for staging to destination, else false.
    • ignore

      protected boolean ignore(String source, String destination)
      Returns a boolean indicating whether a source site is to be ignored for staging to a destination site
      Parameters:
      source - the source site.
      destination - the destination site.
      Returns:
      true if source is tp be ignored while staging to destination, else false.
    • globallyPreferred

      protected boolean globallyPreferred(String site)
      Returns a boolean indicating whether a site is a preferred replica source for all compute sites.
      Parameters:
      site - the site to test for.
      Returns:
      boolean.
    • globallyIgnored

      protected boolean globallyIgnored(String site)
      Returns a boolean indicating whether a site is to be ignored as a replica source for all compute sites.
      Parameters:
      site - the site to test for.
      Returns:
      boolean.
    • getProperty

      protected String getProperty(String site, String suffix)
      Returns the name of the property, for a particular site X. The value of the property contains a comma separated list of site handles that are to be ignored|preferred while selecting replicas to stage to the site X.
      Parameters:
      site - the site X.
      suffix - the property suffix to be applied.
      Returns:
      the name of the property.
    • populateSiteMaps

      private void populateSiteMaps(String site)
      Builds up the set of preferred and ignored sites for a site.
      Parameters:
      site - the site for which to identify the preferred and ignored sites.
    • getSitesSet

      private Set getSitesSet(String value)
      Returns a set of third party sites. An empty set is returned if value is null.
      Parameters:
      value - the comma separated list in the properties file.
      Returns:
      Set containing the names of the pools.