myriad-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smare...@apache.org
Subject [2/8] incubator-myriad git commit: # This is a combination of 2 commits. # The first commit's message is:
Date Wed, 28 Oct 2015 23:49:21 GMT
# This is a combination of 2 commits. # The first commit's message is:

rebase, removed all but one shutdown

# This is the 2nd commit message:

Remove all but one destroy menu option


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

Branch: refs/heads/master
Commit: e532d08d8bb95a00a345fc69cc2480ebdcf2e6be
Parents: a3ef8c7
Author: Paul Read <pdread101@gmail.com>
Authored: Thu Jun 11 08:04:14 2015 -0400
Committer: Santosh Marella <marella@gmail.com>
Committed: Wed Oct 28 14:01:49 2015 -0700

----------------------------------------------------------------------
 config/findbugs/excludeFilter.xml               |    6 +
 .../com/ebay/myriad/common/FrameworkUpdate.java |   51 +
 myriad-executor/build.gradle                    |    1 +
 .../apache/myriad/api/ControllerResource.java   |   99 +
 .../apache/myriad/scheduler/MyriadDriver.java   |    7 +
 .../myriad/webapp/MyriadServletModule.java      |    5 +-
 .../src/main/resources/webapp/js/app.js         |   11 +-
 .../webapp/js/components/HelpComponent.js       |   38 +
 .../webapp/js/components/NavbarComponent.js     |   20 +
 .../js/components/ShutdownFrameworkComponent.js |   83 +
 .../src/main/resources/webapp/package.json      |   19 +-
 .../main/resources/webapp/public/js/myriad.js   | 3020 +++++++++++++++++-
 12 files changed, 3328 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/config/findbugs/excludeFilter.xml
----------------------------------------------------------------------
diff --git a/config/findbugs/excludeFilter.xml b/config/findbugs/excludeFilter.xml
index ba32609..faa5ea6 100644
--- a/config/findbugs/excludeFilter.xml
+++ b/config/findbugs/excludeFilter.xml
@@ -22,4 +22,10 @@
         <Bug code="SnVI"/>
     </Match>
 
+    <!-- RM manager shutdown uses exit(0) which will be flagged if this is not here -->
+    <Match>
+        <Bug pattern="DM_EXIT"/>
+    </Match>
+
+
 </FindBugsFilter>

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-commons/src/main/java/com/ebay/myriad/common/FrameworkUpdate.java
----------------------------------------------------------------------
diff --git a/myriad-commons/src/main/java/com/ebay/myriad/common/FrameworkUpdate.java b/myriad-commons/src/main/java/com/ebay/myriad/common/FrameworkUpdate.java
new file mode 100644
index 0000000..908f02d
--- /dev/null
+++ b/myriad-commons/src/main/java/com/ebay/myriad/common/FrameworkUpdate.java
@@ -0,0 +1,51 @@
+package com.ebay.myriad.common;
+
+import com.google.gson.Gson;
+
+/**
+ * 
+ * Framework update from the scheduler to the executor
+ *
+ */
+public class FrameworkUpdate {
+    /**
+     * Define what kind of this update is.
+     */
+    public static enum Type {Command};
+    
+    /**
+     * Define what kind of operation or command this update is.
+     */
+    public static enum Operation {Shutdown};
+    
+    public FrameworkUpdate() {
+    }
+    
+    public FrameworkUpdate(Type type, Operation operation) {
+        setType(type);
+        setOperation(operation);
+    }
+    
+    public Type getType() {
+        return type;
+    }
+    
+    public void setType(Type type) {
+        this.type = type;
+    }
+    
+    public void setOperation(Operation operation) {
+        this.operation = operation;
+    }
+    
+    public Operation getOperation() {
+        return operation;
+    }
+    
+    public String toString () {
+        return new Gson().toJson(this);
+    }
+    
+    private Type type;
+    private Operation operation;
+}

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-executor/build.gradle
----------------------------------------------------------------------
diff --git a/myriad-executor/build.gradle b/myriad-executor/build.gradle
index 15529c9..3278863 100644
--- a/myriad-executor/build.gradle
+++ b/myriad-executor/build.gradle
@@ -19,6 +19,7 @@
 dependencies {
     compile project(':myriad-commons')
     compile 'org.slf4j:slf4j-log4j12:1.7.7'
+    compile 'org.apache.commons:commons-lang3:3.4'
 
     compile "org.apache.hadoop:hadoop-yarn-api:${hadoopVer}"
     compile "org.apache.hadoop:hadoop-common:${hadoopVer}"

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-scheduler/src/main/java/org/apache/myriad/api/ControllerResource.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/org/apache/myriad/api/ControllerResource.java
b/myriad-scheduler/src/main/java/org/apache/myriad/api/ControllerResource.java
new file mode 100644
index 0000000..c62888c
--- /dev/null
+++ b/myriad-scheduler/src/main/java/org/apache/myriad/api/ControllerResource.java
@@ -0,0 +1,99 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.apache.myriad.api;
+
+import com.codahale.metrics.annotation.Timed;
+import org.apache.myriad.scheduler.MyriadOperations;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.inject.Inject;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+/**
+ * RESTful API to resource manager
+ */
+@Path("/framework")
+public class ControllerResource {
+    private static final Logger LOGGER = LoggerFactory.getLogger(ControllerResource.class);
+
+    private MyriadOperations myriadOperations;
+    
+    @Inject
+    public ControllerResource(MyriadOperations myriadOperations) {
+        this.myriadOperations = myriadOperations;
+    }
+    /**
+     * Shutdown framework means the RM shutdown and the Mesos driver is stopped in failover
mode
+     * so the RM must come back up and re-register, or another RM takes over in HA mode.
+     * 
+     * @return a successful response. 
+     */      
+    @Timed
+    @GET
+    @Path("/shutdown/framework")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response shutdownFramework() {
+        LOGGER.info("shutdown....terminating framework... ");
+         
+        myriadOperations.shutdownFramework();
+        
+        return Response.ok().build();
+    }  
+    
+    /**
+     * Shutdown "manager only" means the RM shutdown and the Mesos driver is stopped in failover
mode
+     * so the RM must come back up and re-register, or another RM takes over in HA mode.
+     * 
+     * @return a successful response. 
+     */   
+    @Timed
+    @GET
+    @Path("/shutdown/managerOnly")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response shutdownResourceManager() {
+        LOGGER.info("shutdown....terminating resource manager only ... ");
+     
+        myriadOperations.shutdownResourceManager();
+   
+        return Response.ok().build();
+    }
+    
+    /**
+     * Shutdown gracefully means the RM, tasks, and executor(s) are stopped but
+     * the RM can be started right back up.
+     * 
+     * @return a successful response. 
+     */
+    @Timed
+    @GET
+    @Path("/shutdown/graceful")
+    @Produces(MediaType.APPLICATION_JSON)
+    public Response shutdownGraceful() {
+        LOGGER.info("shutdown....terminating myraid gracefully ... ");
+        
+        myriadOperations.shutdownGraceful();
+        
+        return Response.ok().build();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriver.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriver.java
b/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriver.java
index 741c6de..b8da0d3 100644
--- a/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriver.java
+++ b/myriad-scheduler/src/main/java/org/apache/myriad/scheduler/MyriadDriver.java
@@ -39,6 +39,13 @@ public class MyriadDriver {
     this.driver = driver;
   }
 
+  public Status stop(boolean failover) {
+    LOGGER.info("Stopping driver");
+    Status status = driver.stop(failover);
+    LOGGER.info("Driver stopped with status: {}", status);
+    return status;      
+  }
+
   public Status start() {
     LOGGER.info("Starting driver");
     Status status = driver.start();

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-scheduler/src/main/java/org/apache/myriad/webapp/MyriadServletModule.java
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/java/org/apache/myriad/webapp/MyriadServletModule.java
b/myriad-scheduler/src/main/java/org/apache/myriad/webapp/MyriadServletModule.java
index e1f09c8..253f710 100644
--- a/myriad-scheduler/src/main/java/org/apache/myriad/webapp/MyriadServletModule.java
+++ b/myriad-scheduler/src/main/java/org/apache/myriad/webapp/MyriadServletModule.java
@@ -18,7 +18,9 @@
  */
 package org.apache.myriad.webapp;
 
+import org.apache.myriad.api.ClustersResource;
 import org.apache.myriad.api.ConfigurationResource;
+import org.apache.myriad.api.ControllerResource;
 import org.apache.myriad.api.SchedulerStateResource;
 import com.google.inject.Scopes;
 import com.google.inject.servlet.ServletModule;
@@ -32,9 +34,10 @@ public class MyriadServletModule extends ServletModule {
 
   @Override
   protected void configureServlets() {
-    bind(org.apache.myriad.api.ClustersResource.class);
+    bind(ClustersResource.class);
     bind(ConfigurationResource.class);
     bind(SchedulerStateResource.class);
+    bind(ControllerResource.class);
 
     bind(GuiceContainer.class);
     bind(JacksonJaxbJsonProvider.class).in(Scopes.SINGLETON);

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-scheduler/src/main/resources/webapp/js/app.js
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/resources/webapp/js/app.js b/myriad-scheduler/src/main/resources/webapp/js/app.js
index 12e3c69..d482ba6 100644
--- a/myriad-scheduler/src/main/resources/webapp/js/app.js
+++ b/myriad-scheduler/src/main/resources/webapp/js/app.js
@@ -4,16 +4,24 @@ var FlexComponent = require('./components/FlexComponent')
 var TasksComponent = require('./components/TasksComponent')
 var ConfigComponent = require('./components/ConfigComponent')
 var AboutComponent = require('./components/AboutComponent')
+var HelpComponent = require('./components/HelpComponent')
+var ShutdownRmOnlyComponent = require('./components/ShutdownRmOnlyComponent')
+var ShutdownFrameworkComponent = require('./components/ShutdownFrameworkComponent')
+var ShutdownGracefulComponent = require('./components/ShutdownGracefulComponent')
 
 var Router = require('react-router')
-  , RouteHandler = Router.RouteHandler
+  , RouteHandler= Router.RouteHandler
   , Route = Router.Route
   , Redirect = Router.Redirect;
 
 var routes = (
   <Route name="myriad" path="/" handler={Myriad} >
+    <Route name="rmDown" path="rmDown" {...this.props} handler={ShutdownRmOnlyComponent}
/> 
+    <Route name="frameworkDown" path="frameworkDown" {...this.props} handler={ShutdownFrameworkComponent}
/> 
+    <Route name="gracefulDown" path="gracefulDown" {...this.props} handler={ShutdownGracefulComponent}
/> 
     <Route name="flex" path="flex" handler={FlexComponent} />
     <Route name="tasks" path="tasks" handler={TasksComponent} />
+    <Route name="help" path="help" handler={HelpComponent} />
     <Route name="config" path="config" handler={ConfigComponent} />
     <Route name="about" path="/" handler={AboutComponent} />
     <Redirect from="myriad" to="about" />
@@ -24,4 +32,3 @@ Router.run(routes, function (Handler) {
   React.render(<Handler/>, document.getElementById("myriad"));
 });
 
-

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-scheduler/src/main/resources/webapp/js/components/HelpComponent.js
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/resources/webapp/js/components/HelpComponent.js b/myriad-scheduler/src/main/resources/webapp/js/components/HelpComponent.js
new file mode 100644
index 0000000..52feff2
--- /dev/null
+++ b/myriad-scheduler/src/main/resources/webapp/js/components/HelpComponent.js
@@ -0,0 +1,38 @@
+var React = require('react');
+
+var HelpComponent = React.createClass({
+  displayName: "HelpComponent",
+
+  render: function () {
+    return(
+      <div>
+	<h4>Myriad dropdown menu</h4>
+        <ul>
+	   <li>Shutdown RM Only</li>
+		<p>Stop only the ResourceManager. The excutors and tasks continue to run.</p>
+           <li>Shutdown Framework, Stopping Driver</li>
+		<p> This will stop the driver in failover mode, which will stop the executor and
tasks, then stop the ResourceManager.
+       		This requires the ResourceManager to be either in HA mode or restarted so that it
re-registers with Mesos. </p>
+           <li>Shutdown Framework, Aborting Driver</li>
+ 		<p> This will shutdown all the tasks, then send a FrameworkMessage shutdown to the
executor, then exits the ResourceManager.
+		This allows the ResourceManager to be started backup without requiring it to re-register
or be in High Availability (HA) mode, great for testing.</p> 
+	</ul>
+	<h4>Flex tab</h4>
+	<p>Allows you to stand up or stop task resources</p>
+	<h4>Tasks tab</h4>
+	<p>Allows you to monitor running task states</p>
+	<h4>Help menu</h4>
+	<ul>
+	   <li>Menu options</li>
+		<p>This text</p>
+	   <li>About Myriad</li>
+		<p>Description of Myriad and its profiles</p>
+	</ul>
+	<h4>Config tab</h4>
+	<p>Shows Myriad configuration information</p>
+      </div>
+   )}
+
+});
+
+module.exports = HelpComponent;

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-scheduler/src/main/resources/webapp/js/components/NavbarComponent.js
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/resources/webapp/js/components/NavbarComponent.js b/myriad-scheduler/src/main/resources/webapp/js/components/NavbarComponent.js
index 26360fd..e8988d0 100644
--- a/myriad-scheduler/src/main/resources/webapp/js/components/NavbarComponent.js
+++ b/myriad-scheduler/src/main/resources/webapp/js/components/NavbarComponent.js
@@ -3,6 +3,8 @@ var React = require('react');
 var ReactBootstrap = require('react-bootstrap')
   , Nav = ReactBootstrap.Nav
   , Navbar = ReactBootstrap.Navbar
+  , DropdownButton = ReactBootstrap.DropdownButton
+  , MenuItem = ReactBootstrap.MenuItem
   , Label = ReactBootstrap.Label;
 
 var ReactRouterBootstrap = require('react-router-bootstrap')
@@ -15,16 +17,34 @@ var NavbarComponent = React.createClass({
 
   render: function () {
     return(
+<<<<<<< HEAD
     <Navbar fixedTop inverse>
       <Nav>
       <a className="navbar-brand" href="#">
           <img src="/img/navbar_logo.png"></img>
       </a>
+=======
+    <Navbar fixedTop>
+      <Nav bsStyle='tabs'   >
+	<DropdownButton  title='Myriad' naveItem={true} >
+	   <NavItemLink  to="rmDown">Shutdown RM Only</NavItemLink>
+	   <NavItemLink  to="frameworkDown">Shutdown Framework, Stopping Driver</NavItemLink>
+	   <NavItemLink  to="gracefulDown">Shutdown Framework, Aborting Driver</NavItemLink>
+	</DropdownButton>
+>>>>>>> 4721509... Update
       </Nav>
       <Nav>
         <NavItemLink to="flex">Flex</NavItemLink>
         <NavItemLink to="tasks">Tasks</NavItemLink>
       </Nav>
+
+      <Nav bsStyle='tabs'   >
+	<DropdownButton  title='Help' naveItem={true} >
+	   <NavItemLink  to="help">Menu Options</NavItemLink>
+	   <NavItemLink  to="about">About Myriad</NavItemLink>
+	</DropdownButton>
+      </Nav>
+
       <Nav right>
         <NavItemLink to="config">Config</NavItemLink>
         <span className="navbar-text">

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-scheduler/src/main/resources/webapp/js/components/ShutdownFrameworkComponent.js
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/resources/webapp/js/components/ShutdownFrameworkComponent.js
b/myriad-scheduler/src/main/resources/webapp/js/components/ShutdownFrameworkComponent.js
new file mode 100644
index 0000000..288854e
--- /dev/null
+++ b/myriad-scheduler/src/main/resources/webapp/js/components/ShutdownFrameworkComponent.js
@@ -0,0 +1,83 @@
+var React = require('react');
+var ReactBootstrap = require('react-bootstrap')
+  , Button = ReactBootstrap.Button
+  , Modal = ReactBootstrap.Modal;
+
+var OverlayMixin = ReactBootstrap.OverlayMixin;
+var Navigation = require('react-router').Navigation;
+var request = require('superagent');
+
+var XModal = React.createClass({
+  	mixins: [OverlayMixin],
+
+  	getInitialState() {
+    		return {
+      			isModalOpen: false
+    		};
+  	},
+
+  	handleToggle() {
+		// For whatever reason this toggle does not work as claimed on line....so cheat.
+		if (!this.state.isModalOpen)
+    	    		document.getElementById('shutdownModal').style.visibility = "hidden";
+        	this.setState({
+            		isModalOpen: !this.state.isModalOpen
+        	});
+  	},
+  	render() {
+    		return ( <Modal {...this.props} bsStyle='primary'   id="shutdownModal" title='Shutdown
Myriad Framework ?' animation={false}  					onRequestHide={this.handleToggle}>
+	 			<div className='modal-body' >
+					<p> This will stop the driver in failover mode, which will stop the executor and
tasks, then stop the ResourceManager.</p>
+       					<p> This requires the ResourceManager to be either in HA mode or restarted
so that it re-registers with Mesos. </p>
+				</div>
+       				<div className='modal-footer'>
+       	    				<Button bsStyle="default" onClick={function() {
+						this.handleToggle();
+						this.props.onCancel();
+						}.bind(this)}>Cancel</Button>
+	    				<Button bsStyle="success" onClick= {function(){
+                				this.handleToggle();
+						this.props.onShutdown();
+              					}.bind(this)} >Continue</Button>
+	 			</div>
+     			</Modal>);
+  	},
+
+ 	renderOverlay() {
+      	   		return <span/>;
+  	}
+});
+ 
+var ShutdownFrameworkComponent = React.createClass({
+	mixins: [Navigation],
+
+  	displayName: "ShutdownFrameworkComponent",
+
+  	render() {
+   		return (
+  			<XModal onShutdown={this.onRequestShutdown} onCancel={this.onCancel}/>
+    		);
+  	},
+ 	onCancel : function() {
+        	this.transitionTo("tasks");
+	},
+  	onRequestShutdown: function() {
+    		console.log( "shutting down Myriad .... ");
+    		request.get('/api/framework/shutdown/framework')
+    			.set('Content-Type', 'application/json')
+    			.end(function(err, res){
+           			console.log("Result from /api/framework/shutdown/framework");
+           			console.log(res);
+		   		if (!err) {
+		     			console.log("Shutdown Myraid framework successful!");
+		   		} else {
+		     			console.log('Shutdown Myraid framework failed: ' + res.text);
+           		}
+         }.bind(this));
+
+        this.transitionTo("tasks");
+      },
+
+});
+
+module.exports = ShutdownFrameworkComponent;

http://git-wip-us.apache.org/repos/asf/incubator-myriad/blob/e532d08d/myriad-scheduler/src/main/resources/webapp/package.json
----------------------------------------------------------------------
diff --git a/myriad-scheduler/src/main/resources/webapp/package.json b/myriad-scheduler/src/main/resources/webapp/package.json
index 8a6f9e8..076bd95 100644
--- a/myriad-scheduler/src/main/resources/webapp/package.json
+++ b/myriad-scheduler/src/main/resources/webapp/package.json
@@ -26,15 +26,26 @@
   "devDependencies": {
     "browserify": "^9.0.3",
     "gulp": "^3.8.11",
-    "gulp-concat": "^2.5.2",
-    "gulp-rename": "^1.2.0",
+    "gulp-concat": "~2.5.2",
+    "gulp-rename": "~1.2.2",
     "gulp-sourcemaps": "^1.5.0",
-    "gulp-uglify": "^1.1.0",
+    "gulp-uglify": "~1.2.0",
     "gulp-webserver": "^0.9.0",
     "reactify": "^1.0.0",
     "vinyl-buffer": "^1.0.0",
     "vinyl-source-stream": "^1.1.0",
     "vinyl-transform": "^1.0.0",
-    "watchify": "^2.4.0"
+    "watchify": "^2.4.0",
+    "gulp-connect": "~2.2.0",
+    "del": "~1.2.0",
+    "gulp-livereload": "~3.8.0",
+    "gulp-ruby-sass": "~1.0.5",
+    "gulp-imagemin": "~2.2.1",
+    "gulp-autoprefixer": "~2.3.1",
+    "gulp-cache": "~0.2.10",
+    "gulp-minify-css": "~1.1.6",
+    "gulp-jshint": "~1.11.0",
+    "gulp-notify": "~2.2.0",
+    "gulp-clean": "~0.3.1"
   }
 }


Mime
View raw message