Interface ContainerManagementProtocol
The protocol between an ApplicationMaster and a
NodeManager to start/stop and increase resource of containers
and to get status of running containers.
If security is enabled the NodeManager verifies that the
ApplicationMaster has truly been allocated the container
by the ResourceManager and also verifies all interactions such
as stopping the container or obtaining status information for the container.
-
Method Summary
Modifier and TypeMethodDescriptioncommitLastReInitialization(ContainerId containerId) Commit the Last ReInitialization if possible.The API used by theApplicationMasterto request for current statuses ofContainers from theNodeManager.API to request for the localization statuses of requested containers from the Node Manager.Deprecated.localize(ResourceLocalizationRequest request) Localize resources required by the container.ReInitialize the Container with a new Launch Context.restartContainer(ContainerId containerId) Restart the container.rollbackLastReInitialization(ContainerId containerId) Rollback the Last ReInitialization if possible.signalToContainer(SignalContainerRequest request) startContainers(StartContainersRequest request) TheApplicationMasterprovides a list ofStartContainerRequests to aNodeManagerto startContainers allocated to it using this interface.stopContainers(StopContainersRequest request) TheApplicationMasterrequests aNodeManagerto stop a list ofContainers allocated to it using this interface.updateContainer(ContainerUpdateRequest request) The API used by theApplicationMasterto request for resource update of running containers on theNodeManager.
-
Method Details
-
startContainers
@Public @Stable StartContainersResponse startContainers(StartContainersRequest request) throws YarnException, IOException The
ApplicationMasterprovides a list ofStartContainerRequests to aNodeManagerto startContainers allocated to it using this interface.The
ApplicationMasterhas to provide details such as allocated resource capability, security tokens (if enabled), command to be executed to start the container, environment for the process, necessary binaries/jar/shared-objects etc. via theContainerLaunchContextin theStartContainerRequest.The
NodeManagersends a response viaStartContainersResponsewhich includes a list ofContainers of successfully launchedContainers, a containerId-to-exception map for each failedStartContainerRequestin which the exception indicates errors from per container and a allServicesMetaData map between the names of auxiliary services and their corresponding meta-data. Note: None-container-specific exceptions will still be thrown by the API method itself.The
ApplicationMastercan usegetContainerStatuses(GetContainerStatusesRequest)to get updated statuses of the to-be-launched or launched containers.- Parameters:
request- request to start a list of containers- Returns:
- response including conatinerIds of all successfully launched containers, a containerId-to-exception map for failed requests and a allServicesMetaData map.
- Throws:
YarnException- exceptions from yarn servers.IOException- io error occur.
-
stopContainers
@Public @Stable StopContainersResponse stopContainers(StopContainersRequest request) throws YarnException, IOException The
ApplicationMasterrequests aNodeManagerto stop a list ofContainers allocated to it using this interface.The
ApplicationMastersends aStopContainersRequestwhich includes theContainerIds of the containers to be stopped.The
NodeManagersends a response viaStopContainersResponsewhich includes a list ofContainerIds of successfully stopped containers, a containerId-to-exception map for each failed request in which the exception indicates errors from per container. Note: None-container-specific exceptions will still be thrown by the API method itself.ApplicationMastercan usegetContainerStatuses(GetContainerStatusesRequest)to get updated statuses of the containers.- Parameters:
request- request to stop a list of containers- Returns:
- response which includes a list of containerIds of successfully stopped containers, a containerId-to-exception map for failed requests.
- Throws:
YarnException- exceptions from yarn servers.IOException- io error occur.
-
getContainerStatuses
@Public @Stable GetContainerStatusesResponse getContainerStatuses(GetContainerStatusesRequest request) throws YarnException, IOException The API used by the
ApplicationMasterto request for current statuses ofContainers from theNodeManager.The
ApplicationMastersends aGetContainerStatusesRequestwhich includes theContainerIds of all containers whose statuses are needed.The
NodeManagerresponds withGetContainerStatusesResponsewhich includes a list ofContainerStatusof the successfully queried containers and a containerId-to-exception map for each failed request in which the exception indicates errors from per container. Note: None-container-specific exceptions will still be thrown by the API method itself.- Parameters:
request- request to getContainerStatuses of containers with the specifiedContainerIds- Returns:
- response containing the list of
ContainerStatusof the successfully queried containers and a containerId-to-exception map for failed requests. - Throws:
YarnException- exceptions from yarn servers.IOException- io error occur.
-
increaseContainersResource
@Public @Unstable @Deprecated IncreaseContainersResourceResponse increaseContainersResource(IncreaseContainersResourceRequest request) throws YarnException, IOException Deprecated.The API used by the
ApplicationMasterto request for resource increase of running containers on theNodeManager.- Parameters:
request- request to increase resource of a list of containers- Returns:
- response which includes a list of containerIds of containers whose resource has been successfully increased and a containerId-to-exception map for failed requests.
- Throws:
YarnException- exceptions from yarn servers.IOException- io error occur.
-
updateContainer
@Public @Unstable ContainerUpdateResponse updateContainer(ContainerUpdateRequest request) throws YarnException, IOException The API used by the
ApplicationMasterto request for resource update of running containers on theNodeManager.- Parameters:
request- request to update resource of a list of containers- Returns:
- response which includes a list of containerIds of containers whose resource has been successfully updated and a containerId-to-exception map for failed requests.
- Throws:
YarnException- Exception specific to YARNIOException- IOException thrown from NodeManager
-
signalToContainer
SignalContainerResponse signalToContainer(SignalContainerRequest request) throws YarnException, IOException - Throws:
YarnExceptionIOException
-
localize
@Public @Unstable ResourceLocalizationResponse localize(ResourceLocalizationRequest request) throws YarnException, IOException Localize resources required by the container. Currently, this API only works for running containers.- Parameters:
request- Specify the resources to be localized.- Returns:
- Response that the localize request is accepted.
- Throws:
YarnException- Exception specific to YARNIOException- IOException thrown from the RPC layer.
-
reInitializeContainer
@Public @Unstable ReInitializeContainerResponse reInitializeContainer(ReInitializeContainerRequest request) throws YarnException, IOException ReInitialize the Container with a new Launch Context.- Parameters:
request- Specify the new ContainerLaunchContext.- Returns:
- Response that the ReInitialize request is accepted.
- Throws:
YarnException- Exception specific to YARN.IOException- IOException thrown from the RPC layer.
-
restartContainer
@Public @Unstable RestartContainerResponse restartContainer(ContainerId containerId) throws YarnException, IOException Restart the container.- Parameters:
containerId- Container Id.- Returns:
- Response that the restart request is accepted.
- Throws:
YarnException- Exception specific to YARN.IOException- IOException thrown from the RPC layer.
-
rollbackLastReInitialization
@Public @Unstable RollbackResponse rollbackLastReInitialization(ContainerId containerId) throws YarnException, IOException Rollback the Last ReInitialization if possible.- Parameters:
containerId- Container Id.- Returns:
- Response that the rollback request is accepted.
- Throws:
YarnException- Exception specific to YARN.IOException- IOException thrown from the RPC layer.
-
commitLastReInitialization
@Public @Unstable CommitResponse commitLastReInitialization(ContainerId containerId) throws YarnException, IOException Commit the Last ReInitialization if possible. Once the reinitialization has been committed, It cannot be rolled back.- Parameters:
containerId- Container Id.- Returns:
- Response that the commit request is accepted.
- Throws:
YarnException- Exception specific to YARN.IOException- IOException thrown from the RPC layer.
-
getLocalizationStatuses
@Public @Unstable GetLocalizationStatusesResponse getLocalizationStatuses(GetLocalizationStatusesRequest request) throws YarnException, IOException API to request for the localization statuses of requested containers from the Node Manager.- Parameters:
request-GetLocalizationStatusesRequestwhich includes the container ids of all the containers whose localization statuses are needed.- Returns:
GetLocalizationStatusesResponsewhich contains the localization statuses of all the requested containers.- Throws:
YarnException- Exception specific to YARN.IOException- IOException thrown from the RPC layer.
-