com.carrotsearch.ant.tasks.junit4.balancers
Class ExecutionTimeBalancer

java.lang.Object
  extended by org.apache.tools.ant.ProjectComponent
      extended by 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/interfaces inherited from interface com.carrotsearch.ant.tasks.junit4.SuiteBalancer
SuiteBalancer.Assignment
 
Field Summary
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
description, location, project
 
Constructor Summary
ExecutionTimeBalancer()
           
 
Method Summary
 void add(org.apache.tools.ant.types.ResourceCollection rc)
          Adds a resource collection with execution hints.
 List<SuiteBalancer.Assignment> assign(Collection<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
 

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


Copyright © 2011-2012 Carrot Search s.c.. All Rights Reserved.