aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wfar...@apache.org
Subject incubator-aurora git commit: Prevent Aurora from creating tasks with 0 disk.
Date Wed, 03 Dec 2014 01:48:41 GMT
Repository: incubator-aurora
Updated Branches:
  refs/heads/master f9837dae8 -> 8959b4995


Prevent Aurora from creating tasks with 0 disk.

Bugs closed: AURORA-956

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


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

Branch: refs/heads/master
Commit: 8959b4995679c6d009d0fdf7a64e250ec33a3e0f
Parents: f9837da
Author: Zameer Manji <zmanji@twopensource.com>
Authored: Tue Dec 2 17:46:00 2014 -0800
Committer: Bill Farner <wfarner@apache.org>
Committed: Tue Dec 2 17:46:00 2014 -0800

----------------------------------------------------------------------
 .../scheduler/mesos/MesosTaskFactory.java       |  7 ++++---
 .../mesos/MesosTaskFactoryImplTest.java         | 20 +++++++++++++++++---
 2 files changed, 21 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8959b499/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java b/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java
index e0332c0..5bf2830 100644
--- a/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java
+++ b/src/main/java/org/apache/aurora/scheduler/mesos/MesosTaskFactory.java
@@ -93,17 +93,18 @@ public interface MesosTaskFactory {
     static final Resources MIN_THERMOS_RESOURCES = new Resources(
         0.01,
         Amount.of(128L, Data.MB),
-        Amount.of(0L, Data.MB),
+        Amount.of(1L, Data.MB),
         0);
 
     /**
-     * Minimum resources to allocate for a task. Mesos rejects tasks that have no CPU or
no RAM.
+     * Minimum resources to allocate for a task. Mesos rejects tasks that have no CPU, no
RAM, or
+     * no Disk.
      */
     @VisibleForTesting
     static final Resources MIN_TASK_RESOURCES = new Resources(
         0.01,
         Amount.of(1L, Data.MB),
-        Amount.of(0L, Data.MB),
+        Amount.of(1L, Data.MB),
         0);
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-aurora/blob/8959b499/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java
b/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java
index 22fb991..ddcb511 100644
--- a/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java
+++ b/src/test/java/org/apache/aurora/scheduler/mesos/MesosTaskFactoryImplTest.java
@@ -86,19 +86,24 @@ public class MesosTaskFactoryImplTest {
     taskFactory = new MesosTaskFactoryImpl(config);
     TaskInfo task = taskFactory.createFrom(TASK, SLAVE);
     assertEquals(DEFAULT_EXECUTOR, task.getExecutor());
+
     double taskCPU = config.getExecutorOverhead().getNumCpus()
         + TASK.getTask().getNumCpus()
         - MIN_THERMOS_RESOURCES.getNumCpus();
     long taskRamMB = config.getExecutorOverhead().getRam().as(Data.MB)
         + TASK.getTask().getRamMb()
         - MIN_THERMOS_RESOURCES.getRam().as(Data.MB);
+    long taskDiskMB = config.getExecutorOverhead().getDisk().as(Data.MB)
+        + TASK.getTask().getDiskMb()
+        - MIN_THERMOS_RESOURCES.getDisk().as(Data.MB);
 
     assertTrue(taskCPU > 0.0);
     assertTrue(taskRamMB > 0);
+    assertTrue(taskDiskMB > 0);
 
     assertEquals(ImmutableSet.of(
             Resources.makeMesosResource(Resources.CPUS, taskCPU),
-            Resources.makeMesosResource(Resources.DISK_MB, TASK.getTask().getDiskMb()),
+            Resources.makeMesosResource(Resources.DISK_MB, taskDiskMB),
             Resources.makeMesosResource(Resources.RAM_MB, taskRamMB),
             Resources.makeMesosRangeResource(
                 Resources.PORTS,
@@ -121,14 +126,18 @@ public class MesosTaskFactoryImplTest {
     long taskRamMB = config.getExecutorOverhead().getRam().as(Data.MB)
         + TASK.getTask().getRamMb()
         - MIN_THERMOS_RESOURCES.getRam().as(Data.MB);
+    long taskDiskMB = config.getExecutorOverhead().getDisk().as(Data.MB)
+        + TASK.getTask().getDiskMb()
+        - MIN_THERMOS_RESOURCES.getDisk().as(Data.MB);
 
     assertTrue(taskCPU > 0.0);
     assertTrue(taskRamMB > 0);
+    assertTrue(taskDiskMB > 0);
 
     assertEquals(DEFAULT_EXECUTOR, task.getExecutor());
     assertEquals(ImmutableSet.of(
             Resources.makeMesosResource(Resources.CPUS, taskCPU),
-            Resources.makeMesosResource(Resources.DISK_MB, TASK.getTask().getDiskMb()),
+            Resources.makeMesosResource(Resources.DISK_MB, taskDiskMB),
             Resources.makeMesosResource(Resources.RAM_MB, taskRamMB)
         ),
         ImmutableSet.copyOf(task.getResourcesList()));
@@ -147,12 +156,17 @@ public class MesosTaskFactoryImplTest {
         + TASK.getTask().getNumCpus()
         - MIN_THERMOS_RESOURCES.getNumCpus();
 
+    long taskDiskMB = config.getExecutorOverhead().getDisk().as(Data.MB)
+        + TASK.getTask().getDiskMb()
+        - MIN_THERMOS_RESOURCES.getDisk().as(Data.MB);
+
     assertTrue(taskCPU > 0.0);
+    assertTrue(taskDiskMB > 0);
 
     assertEquals(ImmutableSet.of(
       Resources.makeMesosResource(Resources.CPUS, taskCPU),
       Resources.makeMesosResource(Resources.RAM_MB, MIN_TASK_RESOURCES.getRam().as(Data.MB)),
-      Resources.makeMesosResource(Resources.DISK_MB, TASK.getTask().getDiskMb()),
+      Resources.makeMesosResource(Resources.DISK_MB, taskDiskMB),
       Resources.makeMesosRangeResource(
           Resources.PORTS,
           ImmutableSet.copyOf(TASK.getAssignedPorts().values()))


Mime
View raw message