public class AgentRule extends java.lang.Object implements PlacementRule
Modifier and Type | Method and Description |
---|---|
static PlacementRule |
avoid(java.util.Collection<java.lang.String> agentIds)
Requires that a task NOT be placed on any of the provided agents.
|
static PlacementRule |
avoid(java.lang.String... agentIds)
Requires that a task NOT be placed on any of the provided agents.
|
static PlacementRule |
avoid(java.lang.String agentId)
Requires that a task NOT be placed on the provided agent.
|
boolean |
equals(java.lang.Object o)
Must be explicitly implemented by all PlacementRules.
|
EvaluationOutcome |
filter(Offer offer,
PodInstance podInstance,
java.util.Collection<TaskInfo> tasks)
Returns whether the provided
Offer , combined with the accompanying
TaskInfo s, passes or fails this placement constraint. |
java.util.Collection<PlacementField> |
getPlacementFields()
Returns the
PlacementField s to which this rule applies. |
int |
hashCode() |
static PlacementRule |
require(java.util.Collection<java.lang.String> agentIds)
Requires that a task be placed on one of the provided agents.
|
static PlacementRule |
require(java.lang.String... agentIds)
Requires that a task be placed on one of the provided agents.
|
static PlacementRule |
require(java.lang.String agentId)
Requires that a task be placed on the provided agent.
|
java.lang.String |
toString() |
public static PlacementRule require(java.lang.String agentId)
agentId
- mesos ID of the agent to requirepublic static PlacementRule require(java.util.Collection<java.lang.String> agentIds)
agentIds
- mesos ID of the agents to requirepublic static PlacementRule require(java.lang.String... agentIds)
agentIds
- mesos ID of the agents to requirepublic static PlacementRule avoid(java.lang.String agentId)
agentId
- mesos ID of the agent to avoidpublic static PlacementRule avoid(java.util.Collection<java.lang.String> agentIds)
agentIds
- mesos ID of the agents to avoidpublic static PlacementRule avoid(java.lang.String... agentIds)
agentIds
- mesos ID of the agents to avoidpublic EvaluationOutcome filter(Offer offer, PodInstance podInstance, java.util.Collection<TaskInfo> tasks)
PlacementRule
Offer
, combined with the accompanying
TaskInfo
s, passes or fails this placement constraint.filter
in interface PlacementRule
offer
- the offer to be examinedtasks
- the currently deployed tasks in the system, possibly including a duplicate
of the task being launched as represented in the offerRequirement. Use
PlacementUtils.areEquivalent(TaskInfo, PodInstance)
to detect
duplicatesEvaluationOutcome
object describing whether the placement succeeded or failed and whypublic java.util.Collection<PlacementField> getPlacementFields()
PlacementRule
PlacementField
s to which this rule applies.getPlacementFields
in interface PlacementRule
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
PlacementRule
equals
in interface PlacementRule
equals
in class java.lang.Object
TaskUtils.areDifferent(
com.mesosphere.sdk.specification.TaskSpec,
com.mesosphere.sdk.specification.TaskSpec)
public int hashCode()
hashCode
in class java.lang.Object