public class ActionDBAccessorImpl extends Object implements ActionDBAccessor
| Constructor and Description |
|---|
ActionDBAccessorImpl(long cacheLimit,
AmbariEventPublisher eventPublisher) |
| Modifier and Type | Method and Description |
|---|---|
void |
abortHostRole(String host,
long requestId,
long stageId,
String role)
Mark the task as to have been aborted
|
void |
abortHostRole(String host,
long requestId,
long stageId,
String role,
String reason)
Mark the task as to have been aborted.
|
Collection<HostRoleCommandEntity> |
abortOperation(long requestId)
Abort all outstanding operations associated with the given request.
|
void |
bulkAbortHostRole(Stage s,
Map<ExecutionCommand,String> commands)
Bulk abort commands
|
void |
bulkHostRoleScheduled(Stage s,
List<ExecutionCommand> commands)
Bulk update scheduled commands
|
void |
endRequest(long requestId) |
void |
endRequestIfCompleted(long requestId) |
List<Stage> |
getAllStages(long requestId)
Get all stages associated with a single request id
|
List<HostRoleCommand> |
getAllTasksByRequestIds(Collection<Long> requestIds)
Given a list of request ids, get all the tasks that belong to these requests
|
int |
getCommandsInProgressCount()
Gets the number of commands in progress.
|
List<Stage> |
getFirstStageInProgressPerRequest()
Returns the next stage which is in-progress for every in-progress request
in the system.
|
long |
getLastPersistedRequestIdWhenInitialized()
Return the last persisted Request ID as seen when the DBAccessor object
was initialized.
|
Request |
getRequest(long requestId)
Get request object by id.
|
Map<Long,String> |
getRequestContext(List<Long> requestIds)
Gets request contexts associated with the list of request id
|
String |
getRequestContext(long requestId)
Gets the request context associated with the request id
|
RequestEntity |
getRequestEntity(long requestId)
Gets the request entity by id.
|
List<Request> |
getRequests(Collection<Long> requestIds)
Gets request objects by ids
|
List<Long> |
getRequestsByStatus(RequestStatus status,
int maxResults,
boolean ascOrder)
Get first or last maxResults requests that are in the specified status
|
List<HostRoleCommand> |
getRequestTasks(long requestId)
Given a request id, get all the tasks that belong to this request
|
Stage |
getStage(String actionId)
Given an action id of the form requestId-stageId, retrieve the Stage
|
List<Stage> |
getStagesInProgressForRequest(Long requestId)
Returns all the pending stages in a request, including queued and not-queued.
|
HostRoleCommand |
getTask(long taskId)
Gets the host role command corresponding to the task id
|
List<HostRoleCommand> |
getTasks(Collection<Long> taskIds)
Given a list of task ids, get all the host role commands
|
List<HostRoleCommand> |
getTasksByHostRoleAndStatus(String hostname,
String role,
HostRoleStatus status)
Get a List of host role commands where the host, role and status are as specified
|
List<HostRoleCommand> |
getTasksByRoleAndStatus(String role,
HostRoleStatus status)
Get a List of host role commands where the role and status are as specified
|
void |
hostRoleScheduled(Stage s,
String hostname,
String roleStr)
Updates scheduled stage.
|
void |
invalidateCommandCacheOnHostRemove(HostsRemovedEvent event)
Invalidate cached HostRoleCommands if a host is deleted.
|
void |
persistActions(Request request)
Persists all tasks for a given request
|
void |
resubmitTasks(List<Long> taskIds)
Resubmits a series of tasks
|
void |
setSourceScheduleForRequest(long requestId,
long scheduleId)
Updates request with link to source schedule
|
void |
startRequest(long requestId) |
void |
timeoutHostRole(String host,
long requestId,
long stageId,
String role)
Mark the task as to have timed out
|
void |
timeoutHostRole(String host,
long requestId,
long stageId,
String role,
boolean skipSupported,
boolean hostUnknownState)
Mark the task as to have timed out
|
void |
updateHostRoleState(String hostname,
long requestId,
long stageId,
String role,
CommandReport report)
For the given host, update all the tasks based on the command report
|
void |
updateHostRoleStates(Collection<CommandReport> reports)
Update tasks according to command reports
|
@Inject
public ActionDBAccessorImpl(long cacheLimit,
AmbariEventPublisher eventPublisher)
public Stage getStage(String actionId)
ActionDBAccessorgetStage in interface ActionDBAccessorpublic List<Stage> getAllStages(long requestId)
ActionDBAccessorgetAllStages in interface ActionDBAccessorpublic RequestEntity getRequestEntity(long requestId)
ActionDBAccessorgetRequestEntity in interface ActionDBAccessorpublic Request getRequest(long requestId)
ActionDBAccessorgetRequest in interface ActionDBAccessorrequestId - the request idpublic Collection<HostRoleCommandEntity> abortOperation(long requestId)
HostRoleStatus.SCHEDULED_STATES to determine which
HostRoleCommand instances to abort.
Returns the list of the aborted operations.abortOperation in interface ActionDBAccessorpublic void timeoutHostRole(String host, long requestId, long stageId, String role)
ActionDBAccessortimeoutHostRole in interface ActionDBAccessorpublic void timeoutHostRole(String host, long requestId, long stageId, String role, boolean skipSupported, boolean hostUnknownState)
ActionDBAccessortimeoutHostRole in interface ActionDBAccessorpublic List<Stage> getStagesInProgressForRequest(Long requestId)
ActionDBAccessor.getCommandsInProgressCount() in
order to determine if there are stages that are in progress before getting
the stages from this method.getStagesInProgressForRequest in interface ActionDBAccessorHostRoleStatus.IN_PROGRESS_STATUSESpublic List<Stage> getFirstStageInProgressPerRequest()
ActionDBAccessor.getCommandsInProgressCount() in order to determine if there
are stages that are in progress before getting the stages from this method.getFirstStageInProgressPerRequest in interface ActionDBAccessorHostRoleStatus.IN_PROGRESS_STATUSESpublic int getCommandsInProgressCount()
getCommandsInProgressCount in interface ActionDBAccessorpublic void persistActions(Request request) throws org.apache.ambari.server.AmbariException
ActionDBAccessorpersistActions in interface ActionDBAccessorrequest - request objectorg.apache.ambari.server.AmbariExceptionpublic void startRequest(long requestId)
startRequest in interface ActionDBAccessorpublic void endRequest(long requestId)
endRequest in interface ActionDBAccessorpublic void endRequestIfCompleted(long requestId)
public void setSourceScheduleForRequest(long requestId,
long scheduleId)
ActionDBAccessorsetSourceScheduleForRequest in interface ActionDBAccessorpublic void updateHostRoleStates(Collection<CommandReport> reports)
ActionDBAccessorupdateHostRoleStates in interface ActionDBAccessorpublic void updateHostRoleState(String hostname, long requestId, long stageId, String role, CommandReport report)
ActionDBAccessorupdateHostRoleState in interface ActionDBAccessorpublic void abortHostRole(String host, long requestId, long stageId, String role)
ActionDBAccessorabortHostRole in interface ActionDBAccessorpublic void abortHostRole(String host, long requestId, long stageId, String role, String reason)
ActionDBAccessorabortHostRole in interface ActionDBAccessorpublic long getLastPersistedRequestIdWhenInitialized()
ActionDBAccessorgetLastPersistedRequestIdWhenInitialized in interface ActionDBAccessorpublic void bulkHostRoleScheduled(Stage s, List<ExecutionCommand> commands)
ActionDBAccessorbulkHostRoleScheduled in interface ActionDBAccessorpublic void bulkAbortHostRole(Stage s, Map<ExecutionCommand,String> commands)
ActionDBAccessorbulkAbortHostRole in interface ActionDBAccessorpublic void hostRoleScheduled(Stage s, String hostname, String roleStr)
ActionDBAccessorhostRoleScheduled in interface ActionDBAccessorpublic List<HostRoleCommand> getRequestTasks(long requestId)
ActionDBAccessorgetRequestTasks in interface ActionDBAccessorpublic List<HostRoleCommand> getAllTasksByRequestIds(Collection<Long> requestIds)
ActionDBAccessorgetAllTasksByRequestIds in interface ActionDBAccessorpublic List<HostRoleCommand> getTasks(Collection<Long> taskIds)
ActionDBAccessorgetTasks in interface ActionDBAccessorpublic List<HostRoleCommand> getTasksByHostRoleAndStatus(String hostname, String role, HostRoleStatus status)
ActionDBAccessorgetTasksByHostRoleAndStatus in interface ActionDBAccessorpublic List<HostRoleCommand> getTasksByRoleAndStatus(String role, HostRoleStatus status)
ActionDBAccessorgetTasksByRoleAndStatus in interface ActionDBAccessorpublic HostRoleCommand getTask(long taskId)
ActionDBAccessorgetTask in interface ActionDBAccessorpublic List<Long> getRequestsByStatus(RequestStatus status, int maxResults, boolean ascOrder)
ActionDBAccessorgetRequestsByStatus in interface ActionDBAccessorstatus - Desired request statusmaxResults - maximal number of returned id'sascOrder - defines sorting order for database query resultpublic Map<Long,String> getRequestContext(List<Long> requestIds)
ActionDBAccessorgetRequestContext in interface ActionDBAccessorpublic String getRequestContext(long requestId)
ActionDBAccessorgetRequestContext in interface ActionDBAccessorpublic List<Request> getRequests(Collection<Long> requestIds)
ActionDBAccessorgetRequests in interface ActionDBAccessorpublic void resubmitTasks(List<Long> taskIds)
ActionDBAccessorresubmitTasks in interface ActionDBAccessorpublic void invalidateCommandCacheOnHostRemove(HostsRemovedEvent event)
event - @HostRemovedEventCopyright © 2022 Apache Software Foundation. All rights reserved.