All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.hadoop.yarn.api.records.ContainerLaunchContext Maven / Gradle / Ivy

There is a newer version: 3.4.0
Show newest version
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package org.apache.hadoop.yarn.api.records;

import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;

import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.server.api.ApplicationInitializationContext;
import org.apache.hadoop.yarn.server.api.AuxiliaryService;
import org.apache.hadoop.yarn.util.Records;

/**
 * 

ContainerLaunchContext represents all of the information * needed by the NodeManager to launch a container.

* *

It includes details such as: *

    *
  • {@link ContainerId} of the container.
  • *
  • {@link Resource} allocated to the container.
  • *
  • User to whom the container is allocated.
  • *
  • Security tokens (if security is enabled).
  • *
  • * {@link LocalResource} necessary for running the container such * as binaries, jar, shared-objects, side-files etc. *
  • *
  • Optional, application-specific binary service data.
  • *
  • Environment variables for the launched process.
  • *
  • Command to launch the container.
  • *
*

* * @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest) */ @Public @Stable public abstract class ContainerLaunchContext { @Public @Stable public static ContainerLaunchContext newInstance( Map localResources, Map environment, List commands, Map serviceData, ByteBuffer tokens, Map acls) { ContainerLaunchContext container = Records.newRecord(ContainerLaunchContext.class); container.setLocalResources(localResources); container.setEnvironment(environment); container.setCommands(commands); container.setServiceData(serviceData); container.setTokens(tokens); container.setApplicationACLs(acls); return container; } /** * Get all the tokens needed by this container. It may include file-system * tokens, ApplicationMaster related tokens if this container is an * ApplicationMaster or framework level tokens needed by this container to * communicate to various services in a secure manner. * * @return tokens needed by this container. */ @Public @Stable public abstract ByteBuffer getTokens(); /** * Set security tokens needed by this container. * @param tokens security tokens */ @Public @Stable public abstract void setTokens(ByteBuffer tokens); /** * Get LocalResource required by the container. * @return all LocalResource required by the container */ @Public @Stable public abstract Map getLocalResources(); /** * Set LocalResource required by the container. All pre-existing * Map entries are cleared before adding the new Map * @param localResources LocalResource required by the container */ @Public @Stable public abstract void setLocalResources(Map localResources); /** *

* Get application-specific binary service data. This is a map keyed * by the name of each {@link AuxiliaryService} that is configured on a * NodeManager and value correspond to the application specific data targeted * for the keyed {@link AuxiliaryService}. *

* *

* This will be used to initialize this application on the specific * {@link AuxiliaryService} running on the NodeManager by calling * {@link AuxiliaryService#initializeApplication(ApplicationInitializationContext)} *

* * @return application-specific binary service data */ @Public @Stable public abstract Map getServiceData(); /** *

* Set application-specific binary service data. This is a map keyed * by the name of each {@link AuxiliaryService} that is configured on a * NodeManager and value correspond to the application specific data targeted * for the keyed {@link AuxiliaryService}. All pre-existing Map entries are * preserved. *

* * @param serviceData * application-specific binary service data */ @Public @Stable public abstract void setServiceData(Map serviceData); /** * Get environment variables for the container. * @return environment variables for the container */ @Public @Stable public abstract Map getEnvironment(); /** * Add environment variables for the container. All pre-existing Map * entries are cleared before adding the new Map * @param environment environment variables for the container */ @Public @Stable public abstract void setEnvironment(Map environment); /** * Get the list of commands for launching the container. * @return the list of commands for launching the container */ @Public @Stable public abstract List getCommands(); /** * Add the list of commands for launching the container. All * pre-existing List entries are cleared before adding the new List * @param commands the list of commands for launching the container */ @Public @Stable public abstract void setCommands(List commands); /** * Get the ApplicationACLs for the application. * @return all the ApplicationACLs */ @Public @Stable public abstract Map getApplicationACLs(); /** * Set the ApplicationACLs for the application. All pre-existing * Map entries are cleared before adding the new Map * @param acls ApplicationACLs for the application */ @Public @Stable public abstract void setApplicationACLs(Map acls); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy