|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ace.moab.api.node.PriorityFunction
public class PriorityFunction
Represents a priority function within moab. Each node can be configured to have a function that explains it's priority used when moab assigns jobs to nodes. This function is simply a list of coefficients and numerical node attributes that are added together.
For example, a priority function could be:
10 * AMEM + -1 * CPROCS
. This function would take the node's
available memory, multiply it by 10, then subtract the number of configured
processors. The resulting value would be a double.
The priority function is only useful when moab has been configured with a
NODEALLOCATIONPOLICY
set to PRIORITY
within moab's
configuration file. This priority has nothing to do with a Job's priority, as
that is calculated and used elsewhere for scheduling jobs, not which nodes
the job should run on.
Constructor Summary | |
---|---|
PriorityFunction()
Empty constructor. |
|
PriorityFunction(MoabNode owner)
Owner constructor. |
|
PriorityFunction(PriorityFunction other,
MoabNode owner)
Copy constructor. |
Method Summary | |
---|---|
void |
addExpression(FunctionExpression expr)
Add an expression to the function. |
void |
addExpression(PriorityComponent attribute,
double value)
Add an expression to the function. |
int |
compareTo(PriorityFunction o)
|
double |
evaluate()
Calculates the value of the function based on the current values of the owner node. |
java.lang.Double |
evaluateForNode(MoabNode node)
Calculates the value of the function based on the current values of the given node. |
java.util.Set<FunctionExpression> |
getExpressions()
Gets the list of FunctionExpressions that make up this Priority function. |
MoabNode |
getOwner()
Get the owner node of this function. |
void |
parseFunctionString(java.lang.String funcString)
Sets the function's expressions attributes based on the input string. |
void |
removeExpression(FunctionExpression expr)
Removes an expression from the list of expressions that make up this Priority Function. |
void |
setOwner(MoabNode owner)
Set the owner node of this function. |
java.lang.String |
toMoabString()
Get a string representation of the priority function in a format that Moab can parse. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PriorityFunction()
Empty constructor. Creates a new priority function that by default is empty (has no expressions). Attempting to create a priority function that belongs to an owner, it is better to use the constructor that accepts a MoabNode for the owner.
Sets the owner MoabNode to null
.
public PriorityFunction(MoabNode owner)
Owner constructor. Creates a new priority function that by default is empty (has no expressions). A PriorityFunction object should have an owner of type MoabNode. This owner is the node whose priority is determined using this function.
owner
- The MoabNode that contains this priority function.public PriorityFunction(PriorityFunction other, MoabNode owner)
Copy constructor. Creates a priority function based on the other priority function. This is useful when the default node has a set priority function but this node's priority function is not set. The priority function for this node can then be created using this priority function and a new owner can be set for it.
other
- the PriorityFunction that will be copied.owner
- the new owner of the priority function.Method Detail |
---|
public void addExpression(FunctionExpression expr)
expr
- the FunctionExpression to add to the function.public void addExpression(PriorityComponent attribute, double value)
attribute
- A priority component used as the attribute of the
FunctionExpression.value
- the value to be assigned as a factor to the FunctionExpressionpublic int compareTo(PriorityFunction o)
compareTo
in interface java.lang.Comparable<PriorityFunction>
public double evaluate()
owner
is null, this method will throw an
error.
public java.lang.Double evaluateForNode(MoabNode node)
node
is null, this method will throw an
error.
node
- the MoabNode that will be used to calculate the value of the
function expression
public java.util.Set<FunctionExpression> getExpressions()
public MoabNode getOwner()
null
.
public void removeExpression(FunctionExpression expr)
expr
- the expression to be removed from the list of expressions that
make up this Priority Function.public java.lang.String toMoabString()
public void parseFunctionString(java.lang.String funcString) throws java.text.ParseException
funcString
- String representing a node's priority function.
java.text.ParseException
- if the parsing fails, this error is thrown.public void setOwner(MoabNode owner)
null
.
owner
- the owner of the function.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |