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

org.springframework.yarn.config.annotation.configurers.MasterContainerAllocatorConfigurer Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2014-2016 the original author or authors.
 *
 * Licensed 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.springframework.yarn.config.annotation.configurers;

import org.springframework.data.hadoop.config.common.annotation.AnnotationConfigurerBuilder;
import org.springframework.yarn.am.allocate.ContainerAllocator;
import org.springframework.yarn.config.annotation.builders.YarnAppmasterConfigurer;
import org.springframework.yarn.config.annotation.configurers.DefaultMasterContainerAllocatorConfigurer.DefaultMasterContainerAllocatorCollectionConfigurer;

/**
 * {@link AnnotationConfigurerBuilder} for configuring {@link ContainerAllocator}.
 *
 * 
* Typically configuration is shown below. *
*
 * @Configuration
 * @EnableYarn(enable=Enable.APPMASTER)
 * static class Config extends SpringYarnConfigurerAdapter {
 *
 *   @Override
 *   public void configure(YarnAppmasterConfigure master) throws Exception {
 *     master
 *       .withContainerAllocator();
 *   }
 *
 * }
 * 
* * @author Janne Valkealahti * */ public interface MasterContainerAllocatorConfigurer extends AnnotationConfigurerBuilder { /** * Specify a container priority for {@link ContainerAllocator}. * *
*
JavaConfig: *
*
	 *
	 * public void configure(YarnAppmasterConfigure master) throws Exception {
	 *   master
	 *     .withContainerAllocator()
	 *       .priority(0);
	 * }
	 * 
* *
XML: *
*
	 * <yarn:master>
	 *   <yarn:container-allocator priority="0"/>
	 * </yarn:master>
	 * 
* * @param priority the priority * @return {@link MasterContainerAllocatorConfigurer} for chaining */ MasterContainerAllocatorConfigurer priority(Integer priority); /** * Specify a container label expression for {@link ContainerAllocator}. * *
*
JavaConfig: *
*
	 *
	 * public void configure(YarnAppmasterConfigure master) throws Exception {
	 *   master
	 *     .withContainerAllocator()
	 *       .labelExpression("expression");
	 * }
	 * 
* * @param labelExpression the label expression * @return {@link MasterContainerAllocatorConfigurer} for chaining */ MasterContainerAllocatorConfigurer labelExpression(String labelExpression); /** * Specify a container virtual cores for {@link ContainerAllocator}. * *
*
JavaConfig: *
*
	 *
	 * public void configure(YarnAppmasterConfigure master) throws Exception {
	 *   master
	 *     .withContainerAllocator()
	 *       .virtualCores(1);
	 * }
	 * 
* *
XML: *
*
	 * <yarn:master>
	 *   <yarn:container-allocator virtualcores="1"/>
	 * </yarn:master>
	 * 
* * @param virtualCores the virtual cores * @return {@link MasterContainerAllocatorConfigurer} for chaining */ MasterContainerAllocatorConfigurer virtualCores(Integer virtualCores); /** * Specify a container memory for {@link ContainerAllocator}. * The memory argument is given as MegaBytes if * value is a plain number. Shortcuts like 1G and * 500M can be used which translates to 1024 * and 500 respectively. *

* This method is equivalent to {@code #memory(int)} so that * argument can be given as a {@code String}. *

* NOTE: be careful not to use a too low settings like * 1000K or 1000B because those are rounded * down to full MBs and thus becomes a zero. Also too * high values may make resource allocation to behave badly. * *
*
JavaConfig: *
*

	 *
	 * public void configure(YarnAppmasterConfigure master) throws Exception {
	 *   master
	 *     .withContainerAllocator()
	 *       .memory("1G");
	 * }
	 * 
* *
XML: *
*
	 * <yarn:master>
	 *   <yarn:container-allocator memory="1024"/>
	 * </yarn:master>
	 * 
* * @param memory the memory * @return {@link MasterContainerAllocatorConfigurer} for chaining */ MasterContainerAllocatorConfigurer memory(String memory); /** * Specify a container memory for {@link ContainerAllocator}. * *
*
JavaConfig: *
*
	 *
	 * public void configure(YarnAppmasterConfigure master) throws Exception {
	 *   master
	 *     .withContainerAllocator()
	 *       .memory(1024);
	 * }
	 * 
* *
XML: *
*
	 * <yarn:master>
	 *   <yarn:container-allocator memory="1024"/>
	 * </yarn:master>
	 * 
* * @param memory the memory * @return {@link MasterContainerAllocatorConfigurer} for chaining * @see #memory(String) */ MasterContainerAllocatorConfigurer memory(int memory); /** * Specify a locality relaxing for {@link ContainerAllocator}. Setting * this flag true means that resource requests will * not use locality relaxing. Default for this flag is false. * *
*
JavaConfig: *
*
	 *
	 * public void configure(YarnAppmasterConfigure master) throws Exception {
	 *   master
	 *     .withContainerAllocator()
	 *       .locality(false);
	 * }
	 * 
* *
XML: *
*
	 * <yarn:master>
	 *   <yarn:container-allocator locality="false"/>
	 * </yarn:master>
	 * 
* * @param locality the locality flag for resource relaxing * @return {@link MasterContainerAllocatorConfigurer} for chaining */ MasterContainerAllocatorConfigurer locality(boolean locality); /** * Specify a collection of container allocator attributes. Applies a new * {@link DefaultMasterContainerAllocatorCollectionConfigurer} into a current configurer. * *
*
JavaConfig: *
*
	 *
	 * public void configure(YarnAppmasterConfigure master) throws Exception {
	 *   master
	 *     .withContainerAllocator()
	 *       .withCollection("id")
	 *         .priority(0);
	 * }
	 * 
* * @param id the id * @return {@link MasterContainerAllocatorCollectionConfigurer} for chaining */ MasterContainerAllocatorCollectionConfigurer withCollection(String id); /** * {@code MasterContainerAllocatorCollectionConfigurer} is an interface * for {@code DefaultMasterContainerAllocatorCollectionConfigurer} which is * used to configure {@link MasterContainerAllocatorConfigurer} parameters * as an identified collection. */ public interface MasterContainerAllocatorCollectionConfigurer { /** * Specify a container priority for {@link ContainerAllocator}. * * @param priority the priority * @return {@link MasterContainerAllocatorCollectionConfigurer} for chaining * @see MasterContainerAllocatorConfigurer#priority(Integer) */ MasterContainerAllocatorCollectionConfigurer priority(Integer priority); /** * Specify a container label expression for {@link ContainerAllocator}. * * @param labelExpression the label expression * @return {@link MasterContainerAllocatorCollectionConfigurer} for chaining * @see MasterContainerAllocatorConfigurer#labelExpression(String) */ MasterContainerAllocatorCollectionConfigurer labelExpression(String labelExpression); /** * Specify a container virtual cores for {@link ContainerAllocator}. * * @param virtualCores the virtual cores * @return {@link MasterContainerAllocatorCollectionConfigurer} for chaining * @see MasterContainerAllocatorConfigurer#virtualCores(Integer) */ MasterContainerAllocatorCollectionConfigurer virtualCores(Integer virtualCores); /** * Specify a container memory for {@link ContainerAllocator}. * * @param memory the memory * @return {@link MasterContainerAllocatorCollectionConfigurer} for chaining * @see MasterContainerAllocatorConfigurer#memory(String) */ MasterContainerAllocatorCollectionConfigurer memory(String memory); /** * Specify a container memory for {@link ContainerAllocator}. * * @param memory the memory * @return {@link MasterContainerAllocatorCollectionConfigurer} for chaining * @see MasterContainerAllocatorConfigurer#memory(String) */ MasterContainerAllocatorCollectionConfigurer memory(int memory); /** * Specify a locality relaxing for {@link ContainerAllocator}. * * @param locality the locality flag for resource relaxing * @return {@link MasterContainerAllocatorCollectionConfigurer} for chaining * @see MasterContainerAllocatorConfigurer#locality(boolean) */ MasterContainerAllocatorCollectionConfigurer locality(boolean locality); /** * Returns a parent {@link MasterContainerAllocatorConfigurer} configurer. * * @return {@link MasterContainerAllocatorConfigurer} for chaining */ MasterContainerAllocatorConfigurer and(); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy