Search in sources :

Example 1 with ResourceSet

use of org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceSet in project hadoop by apache.

the class ContainerManagerImpl method reInitializeContainer.

/**
   * ReInitialize a container using a new Launch Context. If the
   * retryFailureContext is not provided, The container is
   * terminated on Failure.
   *
   * NOTE: Auto-Commit is true by default. This also means that the rollback
   *       context is purged as soon as the command to start the new process
   *       is sent. (The Container moves to RUNNING state)
   *
   * @param containerId Container Id.
   * @param autoCommit Auto Commit flag.
   * @param reInitLaunchContext Target Launch Context.
   * @throws YarnException Yarn Exception.
   */
public void reInitializeContainer(ContainerId containerId, ContainerLaunchContext reInitLaunchContext, boolean autoCommit) throws YarnException {
    Container container = preReInitializeOrLocalizeCheck(containerId, ReInitOp.RE_INIT);
    ResourceSet resourceSet = new ResourceSet();
    try {
        if (reInitLaunchContext != null) {
            resourceSet.addResources(reInitLaunchContext.getLocalResources());
        }
        dispatcher.getEventHandler().handle(new ContainerReInitEvent(containerId, reInitLaunchContext, resourceSet, autoCommit));
        container.setIsReInitializing(true);
    } catch (URISyntaxException e) {
        LOG.info("Error when parsing local resource URI for upgrade of" + "Container [" + containerId + "]", e);
        throw new YarnException(e);
    }
}
Also used : Container(org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container) ContainerReInitEvent(org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerReInitEvent) ResourceSet(org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceSet) URISyntaxException(java.net.URISyntaxException) YarnException(org.apache.hadoop.yarn.exceptions.YarnException)

Aggregations

URISyntaxException (java.net.URISyntaxException)1 YarnException (org.apache.hadoop.yarn.exceptions.YarnException)1 Container (org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container)1 ContainerReInitEvent (org.apache.hadoop.yarn.server.nodemanager.containermanager.container.ContainerReInitEvent)1 ResourceSet (org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.ResourceSet)1