hudson.plugins.slave_squatter.squatters
Class CronSquatter

java.lang.Object
  extended by hudson.model.AbstractDescribableImpl<SlaveSquatter>
      extended by hudson.plugins.slave_squatter.SlaveSquatter
          extended by hudson.plugins.slave_squatter.squatters.CronSquatter
All Implemented Interfaces:
hudson.model.Describable<SlaveSquatter>

public class CronSquatter
extends SlaveSquatter

Reserves a slave with a cron-like syntax that specifies the start of the reservation, duration, and the size of the reservation.

Author:
Kohsuke Kawaguchi

Nested Class Summary
static class CronSquatter.DescriptorImpl
           
static class CronSquatter.Entry
           
 
Field Summary
 String format
           
 
Constructor Summary
CronSquatter(String format)
           
 
Method Summary
 int sizeOfReservation(hudson.model.Computer computer, long timestamp)
          Returns the number of executors that should be reserved at the specified time.
 long timeOfNextChange(hudson.model.Computer computer, long timestamp)
          Given the timestamp, return the nearest future timestamp (including itself --- the ceil semantics) when the size of the reservation changes.
 
Methods inherited from class hudson.model.AbstractDescribableImpl
getDescriptor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

format

public final String format
Constructor Detail

CronSquatter

@DataBoundConstructor
public CronSquatter(String format)
Method Detail

sizeOfReservation

public int sizeOfReservation(hudson.model.Computer computer,
                             long timestamp)
Description copied from class: SlaveSquatter
Returns the number of executors that should be reserved at the specified time.

The timestamp is the same format as Date.getTime(). The precision is 1 minute, and thus the caller should set the second and millisecond portion to 00.000.

Specified by:
sizeOfReservation in class SlaveSquatter
Parameters:
computer - Computer for which the reservation is computed.

timeOfNextChange

public long timeOfNextChange(hudson.model.Computer computer,
                             long timestamp)
Description copied from class: SlaveSquatter
Given the timestamp, return the nearest future timestamp (including itself --- the ceil semantics) when the size of the reservation changes.

Jenkins uses this information to figure out the scheduling that takes the future capacity change into account.

Specified by:
timeOfNextChange in class SlaveSquatter


Copyright © 2004-2011. All Rights Reserved.