Class ExecutionTimeBalancer
- java.lang.Object
-
- org.apache.tools.ant.ProjectComponent
-
- com.carrotsearch.ant.tasks.junit4.balancers.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 usingExecutionTimesReport
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
ExecutionTimeBalancer.SlaveLoad
-
Nested classes/interfaces inherited from interface com.carrotsearch.ant.tasks.junit4.SuiteBalancer
SuiteBalancer.Assignment
-
-
Constructor Summary
Constructors Constructor Description ExecutionTimeBalancer()
-
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.
-
-
-
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).
-
verbose
private boolean verbose
- See Also:
setVerbose(boolean)
-
-
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 interfaceSuiteBalancer
- 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 interfaceSuiteBalancer
-
-