|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorca.shirako.core.Policy
orca.shirako.core.BrokerPolicy
orca.policy.core.BrokerBasePolicyPlugin
orca.policy.core.BrokerSimplePolicyPlugin
orca.policy.core.BrokerPriorityPolicyPlugin
orca.policy.core.BrokerWorstFitPolicyPlugin
public class BrokerWorstFitPolicyPlugin
The AgentWorstFitPolicyPlugin performs a worst fit allocation
algorithm over an inventory of machines. It gives priority to extending
reservations. It also gives priority based on preset priorities of request
types.
| Field Summary | |
|---|---|
protected int |
allocated
Used to count how many requests have been successfully allocated |
static int |
Dimensions
|
protected int |
failed
Used to count how many requests have failed |
protected LogicalInventory |
inventory
Holds a set of logical machines it has from tickets - it represents the agent's holdings |
static java.lang.String |
PropertyForceNewId
Used for testing to force an id switch |
static java.lang.String |
PropertyIDList
Properties appended to each donated reservation to indicate the ids used for nodes provided by this reservation |
static java.lang.String |
PropertyIDs
Saves list of machine ids for recovery |
| Fields inherited from class orca.policy.core.BrokerPriorityPolicyPlugin |
|---|
PropertyRequestTypeCount, PropertyRequestTypeName, PropertyRequestTypePriority, requestTypePriorities |
| Fields inherited from class orca.policy.core.BrokerSimplePolicyPlugin |
|---|
ADVANCE_TIME, CALL_INTERVAL, CLOCK_SKEW, lastAllocation, ready, REQUEST_TYPE |
| Fields inherited from class orca.policy.core.BrokerBasePolicyPlugin |
|---|
calendar, PropertyDiscoverTypes, PropertyTypeCount, PropertyTypeDescriptionPrefix, PropertyTypeNamePrefix, requireApproval |
| Fields inherited from class orca.shirako.core.BrokerPolicy |
|---|
recoverer |
| Fields inherited from class orca.shirako.core.Policy |
|---|
actor, clock, guid, logger, PropertyGuid |
| Constructor Summary | |
|---|---|
BrokerWorstFitPolicyPlugin()
|
|
| Method Summary | |
|---|---|
void |
allocate(long cycle)
Allows additional configuration of priority between multiple types of requests as specified in REQUEST_TYPE. |
void |
allocate(ReservationSet requests,
long startCycle)
Allocate requests. |
protected boolean |
canResize(BrokerReservation r,
long[] available)
Determine if this request can be resized. |
protected long |
checkRequestEndTime(long[] maxResources,
long start,
long end,
BrokerReservation r)
Determine if the new growth affects the endtime of the request - would only affect the endtime |
void |
configure(java.util.Properties p)
Do any configuration items that should occur |
protected ResourceTable |
constructTable(long start,
long end)
Constructs a table of available resources for the given interval |
void |
donate(ReservationClient r)
Convert incoming ticket information into the agent's machine representation and add it to its logical inventory. |
protected void |
extendTicket(BrokerReservation r,
ResourceTable table,
long start,
long end)
Extend a ticket. |
AllotmentTable |
findAllotment(ResourceEntry request,
ResourceTable table,
int unitsNeeded,
AllotmentTable allotment,
int minIndex,
BrokerReservation r,
int extendedUnits)
Recursively determines the machines and number of units per machine that will be allocated to a request |
void |
finish(long cycle)
Clean inventory Informs the mapper that all processing for the specified cycle is complete. |
protected java.util.Vector<ID> |
getIdentifiers(java.util.Properties p)
Obtains the identifiers from a properties list |
protected java.util.ArrayList<ID> |
getIDList(ReservationClient r)
|
protected java.util.ArrayList<ID> |
getIDList(java.lang.String str)
|
protected java.lang.String |
getIDString(java.util.ArrayList<ID> list)
|
LogicalInventory |
getLogicalInventory()
|
MachineState |
getLogicalMachine(ID machineId)
|
protected long[] |
getMax(ResourceSet set)
Obtains the upper bound on resource dimensions |
protected long[] |
getMin(ResourceSet set)
Obtains the lower bound on resource dimensions |
protected long[] |
getShares(ResourceSet set)
Returns the current resource shares held by this resource set |
protected long[] |
growResources(AllotmentTable allotment,
ResourceEntry minRequest,
long[] maxRequest,
BrokerReservation r)
Determines how far we can grow the minimum request, but not exceed the maximum request |
protected void |
issueTicket(BrokerReservation r,
AllotmentTable allotment,
long[] maxResources,
long start,
long end)
Reserves the allotment being allocated to the ticket from the agent's inventory and creates the ticket to be given to the request. |
protected AllotmentTable |
rebuildAllotment(ResourceTable machines,
java.util.Vector<ID> ids,
long start,
long end)
Rebuilds the allotment table for the reservation represented by the given ids |
protected void |
release(BrokerReservation r)
Release resources associated with a client reservation. |
protected void |
releaseNotApproved(BrokerReservation r)
Release the resources for a reservation that is not approved. |
protected void |
releaseResources(ResourceSet set,
Term t)
Releases the resources assigned to this reservation |
protected void |
removeIds(java.util.Vector<ID> ids,
int count)
Removes count identifiers from the specified list |
void |
reset(java.util.Properties p)
De-serializes the object from the given properties list. |
void |
revisit(ResourceReservation reservation)
Informs the mapper about a reservation. |
java.util.Properties |
save()
Serializes the object into a properties list. |
void |
save(java.util.Properties p)
Serializes the object into the given properties list. |
protected void |
storeIDList(ReservationClient r,
java.util.ArrayList<ID> list)
|
protected boolean |
ticket(BrokerReservation r,
ResourceTable table,
long start,
long end)
Issue a new ticket to a request. This is the first request for a ticket We try to satisfy the request for the lower bound of requested resources per dimension. |
| Methods inherited from class orca.policy.core.BrokerPriorityPolicyPlugin |
|---|
addRequestType |
| Methods inherited from class orca.policy.core.BrokerSimplePolicyPlugin |
|---|
allocateExtending, allocateNewBids, bind, calculateAvailable, createSourceHashtable, extend, extractTicket, formulateBids, getAllocation, getApprovedTerm, getNextAllocation, getRenew, getStartForAllocation, prepare, processRenewing, query, satisfyAllocation, switchSource, verifyWantedResources |
| Methods inherited from class orca.policy.core.BrokerBasePolicyPlugin |
|---|
addForApproval, addForApprovalCalendar, addToCalendar, approve, checkPending, close, closed, count, getClosing, getForApproval, initialize, notApprove, release, remove, removeForApproval, revisitClient, revisitServer |
| Methods inherited from class orca.shirako.core.BrokerPolicy |
|---|
demand, getHoldings, getHoldings, getRedeeming, prepareExtend, prepareReserve, reset, revisit, ticketSatisfies, updateTicketComplete |
| Methods inherited from class orca.shirako.core.Policy |
|---|
error, extend, getGuid, internalError, logError, logWarn, setActor, setLogger |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface orca.shirako.api.IPolicy |
|---|
extend, getGuid, setActor, setLogger |
| Methods inherited from interface orca.shirako.api.IPolicy |
|---|
extend, getGuid, setActor, setLogger |
| Field Detail |
|---|
public static final java.lang.String PropertyIDList
public static java.lang.String PropertyForceNewId
public static java.lang.String PropertyIDs
public static int Dimensions
protected LogicalInventory inventory
protected int failed
protected int allocated
| Constructor Detail |
|---|
public BrokerWorstFitPolicyPlugin()
| Method Detail |
|---|
public void donate(ReservationClient r)
throws java.lang.Exception
Note: This method will be invoked only for resources not directly requested by the policy. For example, exported resources claimed manually by an administrator. The policy is itself responsible to "donate" resources to its inventory when resources it requests become available.
donate in interface IServerPolicydonate in class BrokerBasePolicyPluginjava.lang.Exception
public void allocate(long cycle)
throws java.lang.Exception
REQUEST_TYPE. For example,
requests for "master" nodes may be given priority over "worker" requests.
min(requested,available) until we run out. It gives
priority to extending requests compared to new requests. Assumes that
there is only 1 source reservation per type. Makes the assumption that we
allocate resources sequentially in time, so there are never less
resources available in the future.
allocate in interface IServerPolicyallocate in class BrokerPriorityPolicyPlugincycle - the cycle for this allocation
java.lang.Exception
protected java.util.Vector<ID> getIdentifiers(java.util.Properties p)
throws java.lang.Exception
p - the properties
java.lang.Exception
protected void removeIds(java.util.Vector<ID> ids,
int count)
throws java.lang.Exception
count identifiers from the specified list
ids - set of idscount - number of ids to remove
java.lang.Exception
protected ResourceTable constructTable(long start,
long end)
start - start of the requested ticketend - end of the requested ticket
protected AllotmentTable rebuildAllotment(ResourceTable machines,
java.util.Vector<ID> ids,
long start,
long end)
machines - set of the machinesids - the ids of machines from which to rebuild allotment tablestart - start of the requested ticketend - end of the requested ticket
protected long[] getMax(ResourceSet set)
throws java.lang.Exception
set - contains the properties
java.lang.Exception
protected long[] getMin(ResourceSet set)
throws java.lang.Exception
set - contains the properties
java.lang.Exception
protected long[] getShares(ResourceSet set)
throws java.lang.Exception
set - resource set
java.lang.Exception
protected void issueTicket(BrokerReservation r,
AllotmentTable allotment,
long[] maxResources,
long start,
long end)
throws java.lang.Exception
r - requestallotment - what is being given to the requestmaxResources - resources being allocated to the ticketstart - when the ticket will startend - when the ticket will end
java.lang.Exception
protected boolean canResize(BrokerReservation r,
long[] available)
throws java.lang.Exception
r - requestavailable - the resources that are available for this request
true if the all the minimum resources requested by
the request is less than what's available; false
otherwise.
java.lang.Exception
protected void extendTicket(BrokerReservation r,
ResourceTable table,
long start,
long end)
throws java.lang.Exception
r - the requesttable - the available machines from the logical inventorystart - requested restartend - requested end
java.lang.Exception
protected boolean ticket(BrokerReservation r,
ResourceTable table,
long start,
long end)
throws java.lang.Exception
r - the requesttable - the available machines from the logical inventorystart - requested startend - requested end
java.lang.Exception
protected long[] growResources(AllotmentTable allotment,
ResourceEntry minRequest,
long[] maxRequest,
BrokerReservation r)
allotment - the current allotmentminRequest - the minimum requestmaxRequest - the maximum a request may grow tor - the request
protected long checkRequestEndTime(long[] maxResources,
long start,
long end,
BrokerReservation r)
throws java.lang.Exception
maxResources - current resource vector for the requeststart - when the lease will beginend - when the lease will endr - the request
java.lang.Exception
public void allocate(ReservationSet requests,
long startCycle)
throws java.lang.Exception
requests -
java.lang.Exception
public AllotmentTable findAllotment(ResourceEntry request,
ResourceTable table,
int unitsNeeded,
AllotmentTable allotment,
int minIndex,
BrokerReservation r,
int extendedUnits)
throws java.lang.Exception
request - the request's resourcestable - the resources from the logical inventory available for this
requestunitsNeeded - number of units needed to successfully satisfy this
requestallotment - what has been allocated to this requestminIndex - how far the search should continuer - the requestextendedUnits - additional units that have already been extended -
only for extendTicket
java.lang.Exceptionpublic void finish(long cycle)
Note: The cycle number parameter is redundant and is passed for
convenience. The policy can always obtain the cycle number by calling
IActor.getCurrentCycle().
finish in interface IPolicyfinish in class BrokerBasePolicyPlugincycle - the cycle number that has just passedprotected void release(BrokerReservation r)
BrokerBasePolicyPlugin
release in class BrokerBasePolicyPluginr - client reservationprotected void releaseNotApproved(BrokerReservation r)
BrokerBasePolicyPlugin
releaseNotApproved in class BrokerBasePolicyPlugin
protected void releaseResources(ResourceSet set,
Term t)
r -
public void configure(java.util.Properties p)
throws java.lang.Exception
configure in class BrokerPriorityPolicyPluginp - properties
java.lang.Exception
public java.util.Properties save()
throws java.lang.Exception
ISerialize
save in interface ISerializesave in class Policyjava.lang.Exception
public void save(java.util.Properties p)
throws java.lang.Exception
ISerialize
save in interface ISerializesave in class Policyp - properties list to serialize the object into
java.lang.Exception
protected void storeIDList(ReservationClient r,
java.util.ArrayList<ID> list)
protected java.lang.String getIDString(java.util.ArrayList<ID> list)
protected java.util.ArrayList<ID> getIDList(ReservationClient r)
protected java.util.ArrayList<ID> getIDList(java.lang.String str)
public void reset(java.util.Properties p)
throws java.lang.Exception
ISerialize
reset in interface ISerializereset in class Policyp - properties list containing the serialized version of
the object
java.lang.Exception
public void revisit(ResourceReservation reservation)
throws java.lang.Exception
IPolicy
revisit in interface IPolicyrevisit in class BrokerBasePolicyPluginjava.lang.Exceptionpublic LogicalInventory getLogicalInventory()
public MachineState getLogicalMachine(ID machineId)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||