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

public class Regex extends Default
A replica selector that allows the user to specific regex expressions that can be used to rank various PFN's returned from the Replica Catalog for a particular LFN. This replica selector selects the highest ranked PFN i.e the replica with the lowest rank value.

The regular expressions are assigned different rank, that determine the order in which the expressions are employed. The rank values for the regex can expressed in user properties using the property. pegasus.selector.replica.regex.rank.[value]

The value is an integer value that denotes the rank of an expression with a rank value of 1 being the highest rank.

A thing to note is that before applying any regular expressions on the PFN's, the file URL's that dont match the preferred site are explicitly filtered out.

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

        - the property pegasus.selector.replica.selector must be set to value Regex
 
Version:
$Revision$
Author:
Karan Vahi
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
    A Data class that allows us to compile a regex expression and associate a rank value with it.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final int
    The highest value of rank.
    private static final int
    The lowest rank value
    private static final String
    A short description of the replica selector.
    The Set of regular expressions that orders the regex expressions to use in ascending order.
    private static final String
    The property prefix for all Regex rank property.

    Fields inherited from class edu.isi.pegasus.planner.selector.replica.Default

    mLogger, mProps

    Fields inherited from interface edu.isi.pegasus.planner.selector.ReplicaSelector

    LOCAL_SITE_HANDLE, PRIORITY_KEY, VERSION
  • Constructor Summary

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

    Modifier and Type
    Method
    Description
    Returns a short description of the replica selector.
    getRegexSet(Properties properties)
    Returns a sorted set containing the various Patterns pre-compiled.
    edu.isi.pegasus.planner.classes.ReplicaLocation
    selectAndOrderReplicas(edu.isi.pegasus.planner.classes.ReplicaLocation rl, String preferredSite, boolean allowLocalFileURLs)
    This orders amongst all the valid locations returned by the Replica Mechanism.
    edu.isi.pegasus.planner.catalog.replica.ReplicaCatalogEntry
    selectReplica(edu.isi.pegasus.planner.classes.ReplicaLocation candidates, String preferredSite, boolean allowLocalFileURLs)
    This chooses a location amongst all the locations returned by the replica location service.

    Methods inherited from class edu.isi.pegasus.planner.selector.replica.Default

    removeFileURL, removeFileURL, warnForFileURL

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 Regex rank property.
      See Also:
    • HIGHEST_RANK_VALUE

      private static final int HIGHEST_RANK_VALUE
      The highest value of rank. In terms of integers , the lower the int higher the rank with 1 being the highest value.
      See Also:
    • LOWEST_RANK_VALUE

      private static final int LOWEST_RANK_VALUE
      The lowest rank value
      See Also:
    • mSortedRegexSet

      private SortedSet<Regex.Rank> mSortedRegexSet
      The Set of regular expressions that orders the regex expressions to use in ascending order.
  • Constructor Details

    • Regex

      public Regex(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

    • selectAndOrderReplicas

      public edu.isi.pegasus.planner.classes.ReplicaLocation selectAndOrderReplicas(edu.isi.pegasus.planner.classes.ReplicaLocation rl, String preferredSite, boolean allowLocalFileURLs)
      This orders amongst all the valid locations returned by the Replica Mechanism. The following ordering mechanism is employed

      - based on the ranks specified in the properties file.

      Specified by:
      selectAndOrderReplicas in interface ReplicaSelector
      Overrides:
      selectAndOrderReplicas 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:
      ReplicaLocation corresponding to the replicas selected
    • selectReplica

      public edu.isi.pegasus.planner.catalog.replica.ReplicaCatalogEntry selectReplica(edu.isi.pegasus.planner.classes.ReplicaLocation candidates, 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:
      candidates - 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.
    • getRegexSet

      private SortedSet<Regex.Rank> getRegexSet(Properties properties)
      Returns a sorted set containing the various Patterns pre-compiled. The order in the set determines the order in which the patterns are applied on the PFN's
      Parameters:
      properties - with the key being an integer specifying the rank and value as regex expression to be applied.
      Returns:
      SortedSet of Rank objects