@InterfaceAudience.Public @InterfaceStability.Unstable public final class PlacementConstraints extends Object
PlacementConstraint
).Modifier and Type | Class and Description |
---|---|
static class |
PlacementConstraints.PlacementTargets
Class with static methods for constructing target expressions to be used in
placement constraints.
|
Modifier and Type | Field and Description |
---|---|
static String |
NODE |
static String |
NODE_PARTITION |
static String |
RACK |
Modifier and Type | Method and Description |
---|---|
static PlacementConstraint.And |
and(PlacementConstraint.AbstractConstraint... children)
A conjunction of constraints.
|
static PlacementConstraint |
build(PlacementConstraint.AbstractConstraint constraintExpr)
Creates a
PlacementConstraint given a constraint expression. |
static PlacementConstraint.AbstractConstraint |
cardinality(String scope,
int minCardinality,
int maxCardinality,
String... allocationTags)
Creates a constraint that restricts the number of allocations within a
given scope (e.g., node or rack).
|
static PlacementConstraint.AbstractConstraint |
cardinality(String scope,
String namespace,
int minCardinality,
int maxCardinality,
String... allocationTags)
Similar to
cardinality(String, int, int, String...) , but let you
attach a namespace to the given allocation tags. |
static PlacementConstraint.DelayedOr |
delayedOr(PlacementConstraint.TimedPlacementConstraint... children)
Creates a composite constraint that includes a list of timed placement
constraints.
|
static PlacementConstraint.AbstractConstraint |
maxCardinality(String scope,
int maxCardinality,
String... allocationTags)
Similar to
cardinality(String, int, int, String...) , but
determines only the maximum cardinality (the minimum cardinality is 0). |
static PlacementConstraint.AbstractConstraint |
maxCardinality(String scope,
String tagNamespace,
int maxCardinality,
String... allocationTags)
Similar to
maxCardinality(String, int, String...) , but let you
specify a namespace for the tags, see supported namespaces in
AllocationTagNamespaceType . |
static PlacementConstraint.AbstractConstraint |
minCardinality(String scope,
int minCardinality,
String... allocationTags)
Similar to
cardinality(String, int, int, String...) , but
determines only the minimum cardinality (the maximum cardinality is
unbound). |
static PlacementConstraint.AbstractConstraint |
minCardinality(String scope,
String namespace,
int minCardinality,
String... allocationTags)
Similar to
minCardinality(String, int, String...) , but let you
attach a namespace to the allocation tags. |
static PlacementConstraint.Or |
or(PlacementConstraint.AbstractConstraint... children)
A disjunction of constraints.
|
static PlacementConstraint.AbstractConstraint |
targetCardinality(String scope,
int minCardinality,
int maxCardinality,
PlacementConstraint.TargetExpression... targetExpressions)
This constraint generalizes the cardinality and target constraints.
|
static PlacementConstraint.AbstractConstraint |
targetIn(String scope,
PlacementConstraint.TargetExpression... targetExpressions)
Creates a constraint that requires allocations to be placed on nodes that
satisfy all target expressions within the given scope (e.g., node or rack).
|
static PlacementConstraint.AbstractConstraint |
targetNodeAttribute(String scope,
NodeAttributeOpCode opCode,
PlacementConstraint.TargetExpression... targetExpressions)
Creates a constraint that requires allocations to be placed on nodes that
belong to a scope (e.g., node or rack) that satisfy any of the
target expressions based on node attribute op code.
|
static PlacementConstraint.AbstractConstraint |
targetNotIn(String scope,
PlacementConstraint.TargetExpression... targetExpressions)
Creates a constraint that requires allocations to be placed on nodes that
belong to a scope (e.g., node or rack) that does not satisfy any of the
target expressions.
|
static PlacementConstraint.TimedPlacementConstraint |
timedClockConstraint(PlacementConstraint.AbstractConstraint constraint,
long delay,
TimeUnit timeUnit)
Creates a placement constraint that has to be satisfied within a time
window.
|
static PlacementConstraint.TimedPlacementConstraint |
timedOpportunitiesConstraint(PlacementConstraint.AbstractConstraint constraint,
long delay)
Creates a placement constraint that has to be satisfied within a number of
placement opportunities (invocations of the scheduler).
|
public static final String NODE
public static final String RACK
public static final String NODE_PARTITION
public static PlacementConstraint.AbstractConstraint targetIn(String scope, PlacementConstraint.TargetExpression... targetExpressions)
targetIn(RACK, allocationTag("hbase-m"))
, allows
allocations on nodes that belong to a rack that has at least one tag with
value "hbase-m".scope
- the scope within which the target expressions should be
satisfiedtargetExpressions
- the expressions that need to be satisfied within
the scopepublic static PlacementConstraint.AbstractConstraint targetNotIn(String scope, PlacementConstraint.TargetExpression... targetExpressions)
scope
- the scope within which the target expressions should not be
truetargetExpressions
- the expressions that need to not be true within
the scopepublic static PlacementConstraint.AbstractConstraint targetNodeAttribute(String scope, NodeAttributeOpCode opCode, PlacementConstraint.TargetExpression... targetExpressions)
scope
- the scope within which the target expressions should not be
trueopCode
- Node Attribute code which could be equals, not equals.targetExpressions
- the expressions that need to not be true within
the scopepublic static PlacementConstraint.AbstractConstraint cardinality(String scope, int minCardinality, int maxCardinality, String... allocationTags)
cardinality(NODE, 3, 10, "zk")
is satisfied on nodes
where there are no less than 3 allocations with tag "zk" and no more than
10.scope
- the scope of the constraintminCardinality
- determines the minimum number of allocations within
the scopemaxCardinality
- determines the maximum number of allocations within
the scopeallocationTags
- the constraint targets allocations with these tagspublic static PlacementConstraint.AbstractConstraint cardinality(String scope, String namespace, int minCardinality, int maxCardinality, String... allocationTags)
cardinality(String, int, int, String...)
, but let you
attach a namespace to the given allocation tags.scope
- the scope of the constraintnamespace
- the namespace of the allocation tagsminCardinality
- determines the minimum number of allocations within
the scopemaxCardinality
- determines the maximum number of allocations within
the scopeallocationTags
- allocation tagspublic static PlacementConstraint.AbstractConstraint minCardinality(String scope, int minCardinality, String... allocationTags)
cardinality(String, int, int, String...)
, but
determines only the minimum cardinality (the maximum cardinality is
unbound).scope
- the scope of the constraintminCardinality
- determines the minimum number of allocations within
the scopeallocationTags
- the constraint targets allocations with these tagspublic static PlacementConstraint.AbstractConstraint minCardinality(String scope, String namespace, int minCardinality, String... allocationTags)
minCardinality(String, int, String...)
, but let you
attach a namespace to the allocation tags.scope
- the scope of the constraintnamespace
- the namespace of these tagsminCardinality
- determines the minimum number of allocations within
the scopeallocationTags
- the constraint targets allocations with these tagspublic static PlacementConstraint.AbstractConstraint maxCardinality(String scope, int maxCardinality, String... allocationTags)
cardinality(String, int, int, String...)
, but
determines only the maximum cardinality (the minimum cardinality is 0).scope
- the scope of the constraintmaxCardinality
- determines the maximum number of allocations within
the scopeallocationTags
- the constraint targets allocations with these tagspublic static PlacementConstraint.AbstractConstraint maxCardinality(String scope, String tagNamespace, int maxCardinality, String... allocationTags)
maxCardinality(String, int, String...)
, but let you
specify a namespace for the tags, see supported namespaces in
AllocationTagNamespaceType
.scope
- the scope of the constrainttagNamespace
- the namespace of these tagsmaxCardinality
- determines the maximum number of allocations within
the scopeallocationTags
- allocation tagspublic static PlacementConstraint.AbstractConstraint targetCardinality(String scope, int minCardinality, int maxCardinality, PlacementConstraint.TargetExpression... targetExpressions)
targetCardinality(RACK, 2, 10, allocationTag("zk"))
,
requires an allocation to be placed within a rack that has at least 2 and
at most 10 other allocations with tag "zk".scope
- the scope of the constraintminCardinality
- the minimum number of times the target expressions
have to be satisfied with the given scopemaxCardinality
- the maximum number of times the target expressions
have to be satisfied with the given scopetargetExpressions
- the target expressionspublic static PlacementConstraint.And and(PlacementConstraint.AbstractConstraint... children)
children
- the children constraints that should all be satisfiedpublic static PlacementConstraint.Or or(PlacementConstraint.AbstractConstraint... children)
children
- the children constraints, one of which should be satisfiedpublic static PlacementConstraint.DelayedOr delayedOr(PlacementConstraint.TimedPlacementConstraint... children)
children
- the timed children constraintspublic static PlacementConstraint.TimedPlacementConstraint timedClockConstraint(PlacementConstraint.AbstractConstraint constraint, long delay, TimeUnit timeUnit)
constraint
- the placement constraintdelay
- the length of the time window within which the constraint has
to be satisfiedtimeUnit
- the unit of time of the time windowpublic static PlacementConstraint.TimedPlacementConstraint timedOpportunitiesConstraint(PlacementConstraint.AbstractConstraint constraint, long delay)
constraint
- the placement constraintdelay
- the number of scheduling opportunities within which the
constraint has to be satisfiedpublic static PlacementConstraint build(PlacementConstraint.AbstractConstraint constraintExpr)
PlacementConstraint
given a constraint expression.constraintExpr
- the constraint expressionCopyright © 2008–2021 Apache Software Foundation. All rights reserved.