Class 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 Summary

      Fields 
      Modifier and Type Field Description
      private static java.lang.String mDescription
      A short description of the replica selector.
      private java.util.Set mGlobalIgnoredSites
      The Set of ignored sites, that are ignored for selecting replicas for all sites.
      private java.util.Set mGlobalPreferredSites
      The set of preferred sites, that are preferred stagein sites for all sites.
      private java.util.Map mIgnoredSitesMap
      A Map indexed by site handles, that contains a set of site handles.
      private java.util.Map mPreferredSitesMap
      A Map indexed by site handles, that contains a set of site handles.
      private static java.lang.String PROPERTY_IGNORE_SUFFIX
      The property suffix for determining the ignored sites for a site x.
      private static java.lang.String PROPERTY_PREFER_SUFFIX
      The property suffix for determining the preferred sites for a site x.
      private static java.lang.String PROPERTY_PREFIX
      The property prefix for all properties used by this selector.
    • Constructor Summary

      Constructors 
      Constructor Description
      Restricted​(edu.isi.pegasus.planner.common.PegasusProperties properties)
      The overloaded constructor, that is called by load method.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String description()
      Returns a short description of the replica selector.
      protected java.lang.String getProperty​(java.lang.String site, java.lang.String suffix)
      Returns the name of the property, for a particular site X.
      private java.util.Set getSitesSet​(java.lang.String value)
      Returns a set of third party sites.
      protected boolean globallyIgnored​(java.lang.String site)
      Returns a boolean indicating whether a site is to be ignored as a replica source for all compute sites.
      protected boolean globallyPreferred​(java.lang.String site)
      Returns a boolean indicating whether a site is a preferred replica source for all compute sites.
      protected boolean ignore​(java.lang.String source, java.lang.String destination)
      Returns a boolean indicating whether a source site is to be ignored for staging to a destination site
      private void populateSiteMaps​(java.lang.String site)
      Builds up the set of preferred and ignored sites for a site.
      protected boolean prefer​(java.lang.String source, java.lang.String destination)
      Returns a boolean indicating whether a source site is to be preffered for staging to a destination site
      edu.isi.pegasus.planner.catalog.replica.ReplicaCatalogEntry selectReplica​(edu.isi.pegasus.planner.classes.ReplicaLocation rl, java.lang.String preferredSite, boolean allowLocalFileURLs)
      This chooses a location amongst all the locations returned by the replica location service.
      • 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
        A short description of the replica selector.
        See Also:
        Constant Field Values
      • PROPERTY_PREFIX

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

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

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

        private java.util.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 java.util.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 java.util.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 java.util.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 Detail

      • 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 Detail

      • selectReplica

        public edu.isi.pegasus.planner.catalog.replica.ReplicaCatalogEntry selectReplica​(edu.isi.pegasus.planner.classes.ReplicaLocation rl,
                                                                                         java.lang.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 java.lang.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​(java.lang.String source,
                                 java.lang.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​(java.lang.String source,
                                 java.lang.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​(java.lang.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​(java.lang.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 java.lang.String getProperty​(java.lang.String site,
                                               java.lang.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​(java.lang.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 java.util.Set getSitesSet​(java.lang.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.