Class ExecutionTimeBalancer

java.lang.Object
org.apache.tools.ant.ProjectComponent
com.carrotsearch.ant.tasks.junit4.balancers.ExecutionTimeBalancer
All Implemented Interfaces:
SuiteBalancer, Cloneable

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

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
     

    Nested classes/interfaces inherited from interface com.carrotsearch.ant.tasks.junit4.SuiteBalancer

    SuiteBalancer.Assignment
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private JUnit4
    Owning task (logging).
    private List<org.apache.tools.ant.types.ResourceCollection>
    All included execution time dumps.
    private boolean
     

    Fields inherited from class org.apache.tools.ant.ProjectComponent

    description, location, project
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(org.apache.tools.ant.types.ResourceCollection rc)
    Adds a resource collection with execution hints.
    assign(Collection<String> suiteNames, int slaves, long seed)
    Assign based on execution time history.
    void
    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 Details

    • resources

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

      private JUnit4 owner
      Owning task (logging).
    • verbose

      private boolean verbose
      See Also:
  • Constructor Details

    • ExecutionTimeBalancer

      public ExecutionTimeBalancer()
  • Method Details

    • 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 List<SuiteBalancer.Assignment> assign(Collection<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).
    • setOwner

      public void setOwner(JUnit4 owner)
      Description copied from interface: SuiteBalancer
      Sets the owner task (for logging mostly).
      Specified by:
      setOwner in interface SuiteBalancer