myriad-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smare...@apache.org
Subject [3/8] incubator-myriad git commit: Rebase
Date Wed, 28 Oct 2015 23:49:22 GMT
Rebase


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

Branch: refs/heads/master
Commit: ce2b9f08e1620024d00f244c24b06fccb3f673bb
Parents: e532d08
Author: Paul Read <pdread101@gmail.com>
Authored: Mon Aug 17 10:45:40 2015 -0400
Committer: Santosh Marella <marella@gmail.com>
Committed: Wed Oct 28 14:08:29 2015 -0700

----------------------------------------------------------------------
 .../myriad/scheduler/MyriadDriverManager.java   | 31 +++++++++++++++++++-
 .../myriad/scheduler/MyriadOperations.java      | 19 +++++++++++-
 2 files changed, 48 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/ce2b9f08/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriverManager.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriverManager.java
b/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriverManager.java
index 44d7e06..f5ff5da 100644
--- a/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriverManager.java
+++ b/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriverManager.java
@@ -58,7 +58,36 @@ public class MyriadDriverManager {
     return this.driverStatus;
   }
 
-  public Status stopDriver() {
+
+  /**
+   * Stop driver, executor, and tasks if false, otherwise just the driver.
+   *
+   * @return driver status
+   */
+  public Status stopDriver(boolean failover) {
+    this.driverLock.lock();
+    try {
+      if (isRunning()) {
+        if (failover) {
+          LOGGER.info("Stopping driver ...");
+        } else {
+          LOGGER.info("Stopping driver and terminating tasks...");
+        }
+        this.driverStatus = this.driver.stop(failover);
+        LOGGER.info("Stopped driver with status: {}", this.driverStatus);
+      }
+    } finally {
+      this.driverLock.unlock();
+    }
+    return driverStatus;
+  }
+
+  /**
+   * Aborting driver without stopping tasks.
+   *
+   * @return driver status
+   */
+  public Status abortDriver() {
     this.driverLock.lock();
     try {
       if (isRunning()) {

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/ce2b9f08/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadOperations.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadOperations.java
b/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadOperations.java
index 6b0de6d..11d1c82 100644
--- a/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadOperations.java
+++ b/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadOperations.java
@@ -18,6 +18,7 @@
  */
 package org.apache.myriad.scheduler;
 
+import org.apache.mesos.Protos.Status;
 import org.apache.myriad.configuration.MyriadBadConfigurationException;
 import org.apache.myriad.configuration.ServiceConfiguration;
 import org.apache.myriad.configuration.MyriadConfiguration;
@@ -48,12 +49,14 @@ public class MyriadOperations {
 
   private MyriadConfiguration cfg;
   private NodeScaleDownPolicy nodeScaleDownPolicy;
+  private MyriadDriverManager driverManager;
 
   @Inject
-  public MyriadOperations(MyriadConfiguration cfg, SchedulerState schedulerState, NodeScaleDownPolicy
nodeScaleDownPolicy) {
+  public MyriadOperations(MyriadConfiguration cfg, SchedulerState schedulerState, NodeScaleDownPolicy
nodeScaleDownPolicy, MyriadDriverManager driverManager) {
     this.cfg = cfg;
     this.schedulerState = schedulerState;
     this.nodeScaleDownPolicy = nodeScaleDownPolicy;
+    this.driverManager = driverManager;
   }
 
   public void flexUpCluster(ServiceResourceProfile serviceResourceProfile, int instances,
Constraint constraint) {
@@ -233,4 +236,18 @@ public class MyriadOperations {
     return this.schedulerState.getActiveTaskIds(taskPrefix).size() + this.schedulerState.getStagingTaskIds(taskPrefix).size()
+ this.schedulerState.getPendingTaskIds(taskPrefix).size();
   }
 
+  /**
+   * Shutdown framework means the Mesos driver is stopped taking down the executors and associated
tasks
+   */
+  public void shutdownFramework() {
+    Status driverStatus = driverManager.getDriverStatus();
+
+    if (Status.DRIVER_RUNNING != driverStatus) {
+      LOGGER.warn("Driver is not running. Status: " + driverStatus);
+    } else {
+      // Stop the driver, tasks, and executor.
+      driverStatus = driverManager.stopDriver(false);
+      LOGGER.info("shutdown....driver status " + driverStatus);
+    }
+  }
 }


Mime
View raw message