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

org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest 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.protocolrecords;

import java.util.List;

import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
import org.apache.hadoop.yarn.api.records.ContainerResourceIncreaseRequest;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.util.Records;

/**
 * 

The core request sent by the ApplicationMaster to the * ResourceManager to obtain resources in the cluster.

* *

The request includes: *

    *
  • A response id to track duplicate responses.
  • *
  • Progress information.
  • *
  • * A list of {@link ResourceRequest} to inform the * ResourceManager about the application's * resource requirements. *
  • *
  • * A list of unused {@link Container} which are being returned. *
  • *
*

* * @see ApplicationMasterProtocol#allocate(AllocateRequest) */ @Public @Stable public abstract class AllocateRequest { @Public @Stable public static AllocateRequest newInstance(int responseID, float appProgress, List resourceAsk, List containersToBeReleased, ResourceBlacklistRequest resourceBlacklistRequest) { return newInstance(responseID, appProgress, resourceAsk, containersToBeReleased, resourceBlacklistRequest, null); } @Public @Stable public static AllocateRequest newInstance(int responseID, float appProgress, List resourceAsk, List containersToBeReleased, ResourceBlacklistRequest resourceBlacklistRequest, List increaseRequests) { AllocateRequest allocateRequest = Records.newRecord(AllocateRequest.class); allocateRequest.setResponseId(responseID); allocateRequest.setProgress(appProgress); allocateRequest.setAskList(resourceAsk); allocateRequest.setReleaseList(containersToBeReleased); allocateRequest.setResourceBlacklistRequest(resourceBlacklistRequest); allocateRequest.setIncreaseRequests(increaseRequests); return allocateRequest; } /** * Get the response id used to track duplicate responses. * @return response id */ @Public @Stable public abstract int getResponseId(); /** * Set the response id used to track duplicate responses. * @param id response id */ @Public @Stable public abstract void setResponseId(int id); /** * Get the current progress of application. * @return current progress of application */ @Public @Stable public abstract float getProgress(); /** * Set the current progress of application * @param progress current progress of application */ @Public @Stable public abstract void setProgress(float progress); /** * Get the list of ResourceRequest to update the * ResourceManager about the application's resource requirements. * @return the list of ResourceRequest * @see ResourceRequest */ @Public @Stable public abstract List getAskList(); /** * Set list of ResourceRequest to update the * ResourceManager about the application's resource requirements. * @param resourceRequests list of ResourceRequest to update the * ResourceManager about the application's * resource requirements * @see ResourceRequest */ @Public @Stable public abstract void setAskList(List resourceRequests); /** * Get the list of ContainerId of containers being * released by the ApplicationMaster. * @return list of ContainerId of containers being * released by the ApplicationMaster */ @Public @Stable public abstract List getReleaseList(); /** * Set the list of ContainerId of containers being * released by the ApplicationMaster * @param releaseContainers list of ContainerId of * containers being released by the * ApplicationMaster */ @Public @Stable public abstract void setReleaseList(List releaseContainers); /** * Get the ResourceBlacklistRequest being sent by the * ApplicationMaster. * @return the ResourceBlacklistRequest being sent by the * ApplicationMaster * @see ResourceBlacklistRequest */ @Public @Stable public abstract ResourceBlacklistRequest getResourceBlacklistRequest(); /** * Set the ResourceBlacklistRequest to inform the * ResourceManager about the blacklist additions and removals * per the ApplicationMaster. * * @param resourceBlacklistRequest the ResourceBlacklistRequest * to inform the ResourceManager about * the blacklist additions and removals * per the ApplicationMaster * @see ResourceBlacklistRequest */ @Public @Stable public abstract void setResourceBlacklistRequest( ResourceBlacklistRequest resourceBlacklistRequest); /** * Get the ContainerResourceIncreaseRequest being sent by the * ApplicationMaster */ @Public @Stable public abstract List getIncreaseRequests(); /** * Set the ContainerResourceIncreaseRequest to inform the * ResourceManager about some container's resources need to be * increased */ @Public @Stable public abstract void setIncreaseRequests( List increaseRequests); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy