public class DefaultBlacklistStrategy extends Object implements IBlacklistStrategy
The default strategy used for blacklisting hosts.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BLACKLIST_SCHEDULER_RESUME_TIME |
static int |
DEFAULT_BLACKLIST_SCHEDULER_TOLERANCE_COUNT |
Constructor and Description |
---|
DefaultBlacklistStrategy() |
Modifier and Type | Method and Description |
---|---|
protected Map<String,Set<String>> |
createHostToSupervisorMap(List<String> blacklistedNodeIds,
Cluster cluster) |
Set<String> |
getBlacklist(List<Map<String,Set<Integer>>> supervisorsWithFailures,
List<Map<String,Integer>> sendAssignmentFailureCount,
Cluster cluster,
Topologies topologies)
Get blacklist by blacklist strategy.
|
void |
prepare(Map<String,Object> conf) |
protected Set<String> |
releaseBlacklistWhenNeeded(Cluster cluster,
List<String> blacklistedNodeIds)
Decide when/if to release blacklisted hosts.
|
void |
resumeFromBlacklist()
resume supervisors form blacklist.
|
public static final int DEFAULT_BLACKLIST_SCHEDULER_RESUME_TIME
public static final int DEFAULT_BLACKLIST_SCHEDULER_TOLERANCE_COUNT
public void prepare(Map<String,Object> conf)
prepare
in interface IBlacklistStrategy
public Set<String> getBlacklist(List<Map<String,Set<Integer>>> supervisorsWithFailures, List<Map<String,Integer>> sendAssignmentFailureCount, Cluster cluster, Topologies topologies)
IBlacklistStrategy
Get blacklist by blacklist strategy.
getBlacklist
in interface IBlacklistStrategy
supervisorsWithFailures
- bad supervisors buffered in sliding windowsendAssignmentFailureCount
- supervisors with failed assignment calls in sliding windowcluster
- the cluster these topologies are running in. cluster
contains everything user need to develop a new scheduling logic. e.g. supervisors information, available slots, current assignments for all the topologies etc. User can set the new assignment for topologies using cluster.setAssignmentById()`topologies
- all the topologies in the cluster, some of them need schedule. Topologies object here only contain static information about topologies. Information like assignments, slots are all in the cluster
object.public void resumeFromBlacklist()
IBlacklistStrategy
resume supervisors form blacklist. Blacklist is just a temporary list for supervisors, or there will be less and less available resources. This will be called every time before getBlacklist() and schedule.
resumeFromBlacklist
in interface IBlacklistStrategy
protected Set<String> releaseBlacklistWhenNeeded(Cluster cluster, List<String> blacklistedNodeIds)
Decide when/if to release blacklisted hosts.
cluster
- the current state of the cluster.blacklistedNodeIds
- the current set of blacklisted node ids sorted by earliestCopyright © 2020 The Apache Software Foundation. All rights reserved.