Class ExecutionTimeBalancer

  • All Implemented Interfaces:
    SuiteBalancer, java.lang.Cloneable

    public class ExecutionTimeBalancer
    extends org.apache.tools.ant.ProjectComponent
    implements SuiteBalancer
    A test suite balancer based on past execution times saved using ExecutionTimesReport.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private JUnit4 owner
      Owning task (logging).
      private java.util.List<org.apache.tools.ant.types.ResourceCollection> resources
      All included execution time dumps.
      private boolean verbose  
      • Fields inherited from class org.apache.tools.ant.ProjectComponent

        description, location, project
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(org.apache.tools.ant.types.ResourceCollection rc)
      Adds a resource collection with execution hints.
      java.util.List<SuiteBalancer.Assignment> assign​(java.util.Collection<java.lang.String> suiteNames, int slaves, long seed)
      Assign based on execution time history.
      void setOwner​(JUnit4 owner)
      Sets the owner task (for logging mostly).
      void setVerbose​(boolean verbose)
      Be verbose about estimated times etc.
      • Methods inherited from class org.apache.tools.ant.ProjectComponent

        clone, getDescription, getLocation, getProject, log, log, setDescription, setLocation, setProject
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • resources

        private java.util.List<org.apache.tools.ant.types.ResourceCollection> resources
        All included execution time dumps.
      • owner

        private JUnit4 owner
        Owning task (logging).
    • Constructor Detail

      • ExecutionTimeBalancer

        public ExecutionTimeBalancer()
    • Method Detail

      • setVerbose

        public void setVerbose​(boolean verbose)
        Be verbose about estimated times etc.
      • add

        public void add​(org.apache.tools.ant.types.ResourceCollection rc)
        Adds a resource collection with execution hints.
      • assign

        public java.util.List<SuiteBalancer.Assignment> assign​(java.util.Collection<java.lang.String> suiteNames,
                                                               int slaves,
                                                               long seed)
        Assign based on execution time history. The algorithm is a greedy heuristic assigning the longest remaining test to the slave with the shortest-completion time so far. This is not optimal but fast and provides a decent average assignment.
        Specified by:
        assign in interface SuiteBalancer
        Returns:
        Returns an ordered list with assignments. Any suite name not present in the keys of the returned map will be assigned by following balancers (or randomly).