You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by nw...@apache.org on 2019/02/03 06:10:08 UTC

[incubator-heron] branch master updated: Add packing related configs (#3185)

This is an automated email from the ASF dual-hosted git repository.

nwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/master by this push:
     new b3a215e  Add packing related configs (#3185)
b3a215e is described below

commit b3a215e3e1d7bf526033e3c8befdbf3c8777b645
Author: Xiaoyao Qian <qi...@illinois.edu>
AuthorDate: Sat Feb 2 22:10:01 2019 -0800

    Add packing related configs (#3185)
---
 .../api/src/java/org/apache/heron/api/Config.java  | 31 ++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/heron/api/src/java/org/apache/heron/api/Config.java b/heron/api/src/java/org/apache/heron/api/Config.java
index 3ee4b47..7319537 100644
--- a/heron/api/src/java/org/apache/heron/api/Config.java
+++ b/heron/api/src/java/org/apache/heron/api/Config.java
@@ -181,8 +181,12 @@ public class Config extends HashMap<String, Object> {
    */
   public static final String TOPOLOGY_CONTAINER_MAX_DISK_HINT = "topology.container.max.disk.hint";
   /**
-   * Hint for max amount of disk per container to be reserved for this topology.
-   * In bytes.
+   * Max number of instances per container for this topology.
+   */
+  public static final String TOPOLOGY_CONTAINER_MAX_NUM_INSTANCES
+      = "topology.container.max.instances";
+  /**
+   * Percent of resource to pad each container.
    */
   public static final String TOPOLOGY_CONTAINER_PADDING_PERCENTAGE
       = "topology.container.padding.percentage";
@@ -192,6 +196,11 @@ public class Config extends HashMap<String, Object> {
    */
   public static final String TOPOLOGY_CONTAINER_RAM_PADDING = "topology.container.ram.padding";
   /**
+   * Amount of CPU to pad each container.
+   * In decimal form of percent of CPU shares.
+   */
+  public static final String TOPOLOGY_CONTAINER_CPU_PADDING = "topology.container.cpu.padding";
+  /**
    * Per component RAM requirement.  The format of this flag is something like
    * spout0:0.2,spout1:0.2,bolt1:0.5.
    */
@@ -335,8 +344,10 @@ public class Config extends HashMap<String, Object> {
     apiVars.add(TOPOLOGY_CONTAINER_MAX_CPU_HINT);
     apiVars.add(TOPOLOGY_CONTAINER_MAX_DISK_HINT);
     apiVars.add(TOPOLOGY_CONTAINER_MAX_RAM_HINT);
+    apiVars.add(TOPOLOGY_CONTAINER_MAX_NUM_INSTANCES);
     apiVars.add(TOPOLOGY_CONTAINER_PADDING_PERCENTAGE);
     apiVars.add(TOPOLOGY_CONTAINER_RAM_PADDING);
+    apiVars.add(TOPOLOGY_CONTAINER_CPU_PADDING);
     apiVars.add(TOPOLOGY_COMPONENT_CPUMAP);
     apiVars.add(TOPOLOGY_COMPONENT_RAMMAP);
     apiVars.add(TOPOLOGY_COMPONENT_DISKMAP);
@@ -487,6 +498,14 @@ public class Config extends HashMap<String, Object> {
     conf.put(Config.TOPOLOGY_CONTAINER_RAM_PADDING, Long.toString(nbytes.asBytes()));
   }
 
+  public static void setContainerCpuPadding(Map<String, Object> conf, double ncpus) {
+    conf.put(Config.TOPOLOGY_CONTAINER_CPU_PADDING, Double.toString(ncpus));
+  }
+
+  public static void setMaxNumInstancesPerContainer(Map<String, Object> conf, int n) {
+    conf.put(Config.TOPOLOGY_CONTAINER_MAX_NUM_INSTANCES, Integer.toString(n));
+  }
+
   public static void setComponentCpuMap(Map<String, Object> conf, String cpuMap) {
     conf.put(Config.TOPOLOGY_COMPONENT_CPUMAP, cpuMap);
   }
@@ -748,6 +767,14 @@ public class Config extends HashMap<String, Object> {
     setContainerRamPadding(this, nbytes);
   }
 
+  public void setContainerCpuPadding(double ncpus) {
+    setContainerCpuPadding(this, ncpus);
+  }
+
+  public void setTopologyContainerMaxNumInstances(int n) {
+    setMaxNumInstancesPerContainer(this, n);
+  }
+
   public void setComponentCpuMap(String cpuMap) {
     setComponentCpuMap(this, cpuMap);
   }