public class CalculatedStatus extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CalculatedStatus.StatusType
|
| Modifier and Type | Field and Description |
|---|---|
static CalculatedStatus |
ABORTED
A status which represents an ABORTED state at -1%
|
static CalculatedStatus |
COMPLETED
A status which represents a COMPLETED state at 100%
|
static CalculatedStatus |
PENDING
A status which represents a PENDING state at 0%
|
| Modifier and Type | Method and Description |
|---|---|
static HostRoleStatus |
calculateStageStatus(List<HostRoleCommand> hostRoleCommands,
Map<HostRoleStatus,Integer> counters,
Map<Role,Float> successFactors,
boolean skippable) |
static Map<HostRoleStatus,Integer> |
calculateStatusCounts(Collection<HostRoleStatus> hostRoleStatuses)
Returns counts of tasks that are in various states.
|
static Map<CalculatedStatus.StatusType,Map<HostRoleStatus,Integer>> |
calculateStatusCountsForStage(Collection<TaskStatusListener.ActiveStage> stages)
Returns map for counts of stages that are in various states.
|
static Map<HostRoleStatus,Integer> |
calculateStatusCountsForTasks(Collection<HostRoleCommand> hostRoleCommands)
Returns counts of tasks that are in various states.
|
static Map<HostRoleStatus,Integer> |
calculateStatusCountsForTasks(Collection<HostRoleCommand> hostRoleCommands,
StageEntityPK stage)
Returns counts of tasks that are in various states.
|
static HostRoleStatus |
calculateSummaryDisplayStatus(Map<HostRoleStatus,Integer> counters,
int total,
boolean skippable)
Calculate an overall display status based on the given status counts.
|
static HostRoleStatus |
calculateSummaryStatus(Map<HostRoleStatus,Integer> counters,
int total,
boolean skippable)
Calculate overall status of a stage or upgrade based on the given status counts.
|
static HostRoleStatus |
calculateSummaryStatusFromPartialSet(Map<HostRoleStatus,Integer> counters,
boolean skippable) |
protected static HostRoleStatus |
calculateSummaryStatusOfUpgrade(Map<HostRoleStatus,Integer> counters,
int total)
Calculate overall status of an upgrade.
|
static Map<HostRoleStatus,Integer> |
calculateTaskEntityStatusCounts(Collection<HostRoleCommandEntity> tasks)
Returns counts of task entities that are in various states.
|
static Map<HostRoleStatus,Integer> |
calculateTaskStatusCounts(Map<Long,HostRoleCommandStatusSummaryDTO> stageDto,
Set<Long> stageIds)
Return counts of task statuses.
|
protected static Boolean |
didStageFailed(List<HostRoleCommand> hostRoleCommands,
Set<Role> roles,
Map<Role,Float> successFactors) |
HostRoleStatus |
getDisplayStatus()
Get the calculated display status.
|
protected static List<HostRoleCommand> |
getFailedHostRoleCommands(List<HostRoleCommand> hostRoleCommands) |
protected static List<HostRoleCommand> |
getHostRoleCommandsOfRole(List<HostRoleCommand> hostRoleCommands,
Role role) |
static HostRoleStatus |
getOverallDisplayStatusForRequest(Collection<HostRoleStatus> hostRoleStatuses)
Calculate overall display status from collection of statuses
|
static HostRoleStatus |
getOverallStatusForRequest(Collection<HostRoleStatus> hostRoleStatuses)
Calculate overall status from collection of statuses
|
double |
getPercent()
Get the calculated percent complete.
|
protected static Set<Role> |
getRolesOfAbortedTasks(List<HostRoleCommand> hostRoleCommands)
Get all
Role any of whose tasks is in HostRoleStatus.ABORTED |
protected static Set<Role> |
getRolesOfFailedTasks(List<HostRoleCommand> hostRoleCommands)
Get all
Role any of whose tasks is in HostRoleStatus.FAILED |
protected static Set<Role> |
getRolesOfTasks(List<HostRoleCommand> hostRoleCommands,
HostRoleStatus status)
Get all
Role any of whose tasks are in given status |
protected static Set<Role> |
getRolesOfTimedOutTasks(List<HostRoleCommand> hostRoleCommands)
Get all
Role any of whose tasks is in HostRoleStatus.TIMEDOUT |
HostRoleStatus |
getStatus()
Get the calculated status.
|
static CalculatedStatus |
statusFromRequest(HostRoleCommandDAO s_hostRoleCommandDAO,
TopologyManager topologyManager,
Long requestId)
Calculates the status for specified request by id.
|
static CalculatedStatus |
statusFromStageEntities(Collection<StageEntity> stages)
Factory method to create a calculated status.
|
static CalculatedStatus |
statusFromStages(Collection<Stage> stages)
Factory method to create a calculated status.
|
static CalculatedStatus |
statusFromStageSummary(Map<Long,HostRoleCommandStatusSummaryDTO> stageDto,
Set<Long> stageIds)
Calculates the overall status of an upgrade.
|
static CalculatedStatus |
statusFromTaskEntities(Collection<HostRoleCommandEntity> tasks,
boolean skippable)
Factory method to create a calculated status.
|
public static final CalculatedStatus COMPLETED
public static final CalculatedStatus PENDING
public static final CalculatedStatus ABORTED
public HostRoleStatus getStatus()
public HostRoleStatus getDisplayStatus()
public double getPercent()
public static CalculatedStatus statusFromTaskEntities(Collection<HostRoleCommandEntity> tasks, boolean skippable)
tasks - the collection of task entitiesskippable - true if a single failed status should NOT result in an overall failed statuspublic static CalculatedStatus statusFromStageEntities(Collection<StageEntity> stages)
stages - the collection of stage entitiespublic static CalculatedStatus statusFromStages(Collection<Stage> stages)
stages - the collection of stagespublic static Map<HostRoleStatus,Integer> calculateStatusCounts(Collection<HostRoleStatus> hostRoleStatuses)
hostRoleStatuses - the collection of taskspublic static Map<HostRoleStatus,Integer> calculateStatusCountsForTasks(Collection<HostRoleCommand> hostRoleCommands)
hostRoleCommands - collection of beans HostRoleCommandpublic static Map<CalculatedStatus.StatusType,Map<HostRoleStatus,Integer>> calculateStatusCountsForStage(Collection<TaskStatusListener.ActiveStage> stages)
stages - collection of beans TaskStatusListener.ActiveStagepublic static Map<HostRoleStatus,Integer> calculateStatusCountsForTasks(Collection<HostRoleCommand> hostRoleCommands, StageEntityPK stage)
hostRoleCommands - collection of beans HostRoleCommandpublic static Map<HostRoleStatus,Integer> calculateTaskEntityStatusCounts(Collection<HostRoleCommandEntity> tasks)
tasks - the collection of task entitiespublic static Map<HostRoleStatus,Integer> calculateTaskStatusCounts(Map<Long,HostRoleCommandStatusSummaryDTO> stageDto, Set<Long> stageIds)
stageDto - the map of stage-to-summary value objectsstageIds - the stage ids to consider from the value objectspublic static CalculatedStatus statusFromRequest(HostRoleCommandDAO s_hostRoleCommandDAO, TopologyManager topologyManager, Long requestId)
s_hostRoleCommandDAO - is used to retrieve the map of stage-to-summary value objectstopologyManager - topology managerrequestId - the request idpublic static CalculatedStatus statusFromStageSummary(Map<Long,HostRoleCommandStatusSummaryDTO> stageDto, Set<Long> stageIds)
HostRoleStatus.COMPLETED is returned.stageDto - the map of stage-to-summary value objectsstageIds - the stage ids to consider from the value objectspublic static HostRoleStatus calculateSummaryStatus(Map<HostRoleStatus,Integer> counters, int total, boolean skippable)
counters - counts of resources that are in various statestotal - total number of resources in request. NOTE, completed tasks may be counted twice.skippable - true if a single failed status should NOT result in an overall failed status returnpublic static HostRoleStatus calculateSummaryStatusFromPartialSet(Map<HostRoleStatus,Integer> counters, boolean skippable)
counters - counts of resources that are in various statesskippable - {Boolean} TRUE if failure of any of the task should not fail the stageHostRoleStatuspublic static HostRoleStatus calculateStageStatus(List<HostRoleCommand> hostRoleCommands, Map<HostRoleStatus,Integer> counters, Map<Role,Float> successFactors, boolean skippable)
hostRoleCommands - list of HostRoleCommand for a stagecounters - counts of resources that are in various statessuccessFactors - Map of roles to their successfactor for a stageskippable - {Boolean} TRUE if failure of any of the task should not fail the stageHostRoleStatus based on success factorprotected static Set<Role> getRolesOfFailedTasks(List<HostRoleCommand> hostRoleCommands)
Role any of whose tasks is in HostRoleStatus.FAILEDhostRoleCommands - list of HostRoleCommandRoleprotected static Set<Role> getRolesOfTimedOutTasks(List<HostRoleCommand> hostRoleCommands)
Role any of whose tasks is in HostRoleStatus.TIMEDOUThostRoleCommands - list of HostRoleCommandRoleprotected static Set<Role> getRolesOfAbortedTasks(List<HostRoleCommand> hostRoleCommands)
Role any of whose tasks is in HostRoleStatus.ABORTEDhostRoleCommands - list of HostRoleCommandRoleprotected static Set<Role> getRolesOfTasks(List<HostRoleCommand> hostRoleCommands, HostRoleStatus status)
Role any of whose tasks are in given statushostRoleCommands - list of HostRoleCommandstatus - HostRoleStatusRoleprotected static Boolean didStageFailed(List<HostRoleCommand> hostRoleCommands, Set<Role> roles, Map<Role,Float> successFactors)
hostRoleCommands - list of HostRoleCommand for a stageroles - set of roles to be checked for meeting success criteriasuccessFactors - map of role to it's success factorTRUE if stage failed due to hostRoleCommands of any role not meeting success criteriaprotected static List<HostRoleCommand> getHostRoleCommandsOfRole(List<HostRoleCommand> hostRoleCommands, Role role)
hostRoleCommands - list of HostRoleCommandrole - RoleHostRoleCommand that belongs to Roleprotected static List<HostRoleCommand> getFailedHostRoleCommands(List<HostRoleCommand> hostRoleCommands)
hostRoleCommands - list of HostRoleCommandHostRoleCommand with failed statuspublic static HostRoleStatus getOverallStatusForRequest(Collection<HostRoleStatus> hostRoleStatuses)
hostRoleStatuses - list of all stage's HostRoleStatuspublic static HostRoleStatus getOverallDisplayStatusForRequest(Collection<HostRoleStatus> hostRoleStatuses)
hostRoleStatuses - list of all stage's HostRoleStatusprotected static HostRoleStatus calculateSummaryStatusOfUpgrade(Map<HostRoleStatus,Integer> counters, int total)
counters - counts of resources that are in various statestotal - total number of resources in requestpublic static HostRoleStatus calculateSummaryDisplayStatus(Map<HostRoleStatus,Integer> counters, int total, boolean skippable)
counters - counts of resources that are in various statestotal - total number of resources in requestskippable - true if a single failed status should NOT result in an overall failed status returnCopyright © 2022 Apache Software Foundation. All rights reserved.