aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject git commit: Make executor overhead configurable via CLI.
Date Wed, 29 Oct 2014 21:59:38 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master 978998ac2 -> 6b30cf72f


Make executor overhead configurable via CLI.

Bugs closed: AURORA-830

Reviewed at https://reviews.apache.org/r/27309/


Project: http://git-wip-us.apache.org/repos/asf/incubator-aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-aurora/commit/6b30cf72
Tree: http://git-wip-us.apache.org/repos/asf/incubator-aurora/tree/6b30cf72
Diff: http://git-wip-us.apache.org/repos/asf/incubator-aurora/diff/6b30cf72

Branch: refs/heads/master
Commit: 6b30cf72f7e7fb0bebf51417e999a1d4fadc3c9f
Parents: 978998a
Author: Zameer Manji <zmanji@twopensource.com>
Authored: Wed Oct 29 14:56:43 2014 -0700
Committer: Bill Farner <wfarner@apache.org>
Committed: Wed Oct 29 14:56:43 2014 -0700

----------------------------------------------------------------------
 .../aurora/scheduler/MesosTaskFactory.java      |  6 ++++--
 .../apache/aurora/scheduler/ResourceSlot.java   | 22 ++++++++++++++------
 .../scheduler/MesosTaskFactoryImplTest.java     |  7 ++++---
 3 files changed, 24 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6b30cf72/src/main/java/org/apache/aurora/scheduler/MesosTaskFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/MesosTaskFactory.java b/src/main/java/org/apache/aurora/scheduler/MesosTaskFactory.java
index 1d974b1..ad07bca 100644
--- a/src/main/java/org/apache/aurora/scheduler/MesosTaskFactory.java
+++ b/src/main/java/org/apache/aurora/scheduler/MesosTaskFactory.java
@@ -142,9 +142,11 @@ public interface MesosTaskFactory {
           .setExecutorId(getExecutorId(task.getTaskId()))
           .setName(EXECUTOR_NAME)
           .setSource(getInstanceSourceName(config, task.getInstanceId()))
-          .addResources(Resources.makeMesosResource(Resources.CPUS, ResourceSlot.EXECUTOR_CPUS))
           .addResources(
-              Resources.makeMesosResource(Resources.RAM_MB, ResourceSlot.EXECUTOR_RAM.as(Data.MB)))
+              Resources.makeMesosResource(Resources.CPUS, ResourceSlot.EXECUTOR_CPUS.get()))
+          .addResources(Resources.makeMesosResource(
+              Resources.RAM_MB,
+              ResourceSlot.EXECUTOR_RAM.get().as(Data.MB)))
           .build();
       return taskBuilder
           .setExecutor(executor)

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6b30cf72/src/main/java/org/apache/aurora/scheduler/ResourceSlot.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/ResourceSlot.java b/src/main/java/org/apache/aurora/scheduler/ResourceSlot.java
index ed60447..46832d5 100644
--- a/src/main/java/org/apache/aurora/scheduler/ResourceSlot.java
+++ b/src/main/java/org/apache/aurora/scheduler/ResourceSlot.java
@@ -19,6 +19,8 @@ import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Function;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Ordering;
+import com.twitter.common.args.Arg;
+import com.twitter.common.args.CmdLine;
 import com.twitter.common.quantity.Amount;
 import com.twitter.common.quantity.Data;
 
@@ -31,6 +33,7 @@ import static org.apache.mesos.Protos.Offer;
  * Resource containing class that is aware of executor overhead.
  */
 public final class ResourceSlot {
+  // TODO(zmanji): Remove this class and overhead in 0.8.0 (AURORA-906)
 
   private final Resources resources;
 
@@ -38,22 +41,28 @@ public final class ResourceSlot {
    * CPU allocated for each executor.
    */
   @VisibleForTesting
-  static final double EXECUTOR_CPUS = 0.25;
+  @CmdLine(name = "thermos_executor_cpu",
+      help = "The number of CPU cores to allocate for each instance of the executor.")
+  public static final Arg<Double> EXECUTOR_CPUS = Arg.create(0.25);
 
   /**
    * RAM required for the executor.  Executors in the wild have been observed using 48-54MB
RSS,
    * setting to 128MB to be extra vigilant initially.
    */
   @VisibleForTesting
-  static final Amount<Long, Data> EXECUTOR_RAM = Amount.of(128L, Data.MB);
+  @CmdLine(name = "thermos_executor_ram",
+      help = "The amount of RAM to allocate for each instance of the executor.")
+  public static final Arg<Amount<Integer, Data>> EXECUTOR_RAM =
+  Arg.create(Amount.of(128, Data.MB));
 
   private ResourceSlot(Resources r) {
     this.resources = r;
   }
 
   public static ResourceSlot from(ITaskConfig task) {
-    double totalCPU = task.getNumCpus() + EXECUTOR_CPUS;
-    Amount<Long, Data> totalRAM = Amount.of(task.getRamMb() + EXECUTOR_RAM.as(Data.MB),
Data.MB);
+    double totalCPU = task.getNumCpus() + EXECUTOR_CPUS.get();
+    Amount<Long, Data> totalRAM =
+        Amount.of(task.getRamMb() + EXECUTOR_RAM.get().as(Data.MB), Data.MB);
     Amount<Long, Data> disk = Amount.of(task.getDiskMb(), Data.MB);
     return new ResourceSlot(
         new Resources(totalCPU, totalRAM, disk, task.getRequestedPorts().size()));
@@ -84,8 +93,9 @@ public final class ResourceSlot {
                                   Amount<Long, Data> ram,
                                   Amount<Long, Data> disk,
                                   int ports) {
-    double totalCPU = cpu + EXECUTOR_CPUS;
-    Amount<Long, Data> totalRAM = Amount.of(ram.as(Data.MB) + EXECUTOR_RAM.as(Data.MB),
Data.MB);
+    double totalCPU = cpu + EXECUTOR_CPUS.get();
+    Amount<Long, Data> totalRAM =
+        Amount.of(ram.as(Data.MB) + EXECUTOR_RAM.get().as(Data.MB), Data.MB);
 
     return new ResourceSlot(new Resources(totalCPU, totalRAM, disk, ports));
   }

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/6b30cf72/src/test/java/org/apache/aurora/scheduler/MesosTaskFactoryImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/MesosTaskFactoryImplTest.java b/src/test/java/org/apache/aurora/scheduler/MesosTaskFactoryImplTest.java
index 2e72e96..aa026cf 100644
--- a/src/test/java/org/apache/aurora/scheduler/MesosTaskFactoryImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/MesosTaskFactoryImplTest.java
@@ -64,9 +64,10 @@ public class MesosTaskFactoryImplTest {
       .setExecutorId(MesosTaskFactoryImpl.getExecutorId(TASK.getTaskId()))
       .setName(MesosTaskFactoryImpl.EXECUTOR_NAME)
       .setSource(MesosTaskFactoryImpl.getInstanceSourceName(TASK.getTask(), TASK.getInstanceId()))
-      .addResources(Resources.makeMesosResource(Resources.CPUS, ResourceSlot.EXECUTOR_CPUS))
-      .addResources(
-          Resources.makeMesosResource(Resources.RAM_MB, ResourceSlot.EXECUTOR_RAM.as(Data.MB)))
+      .addResources(Resources.makeMesosResource(Resources.CPUS, ResourceSlot.EXECUTOR_CPUS.get()))
+      .addResources(Resources.makeMesosResource(
+          Resources.RAM_MB,
+          ResourceSlot.EXECUTOR_RAM.get().as(Data.MB)))
       .setCommand(CommandInfo.newBuilder()
           .setValue("./executor.sh")
           .addUris(URI.newBuilder().setValue(EXECUTOR_PATH).setExecutable(true)))


Mime
View raw message