You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2012/05/14 19:49:23 UTC
svn commit: r1338312 - in /incubator/mesos/trunk/src: slave/webui.cpp
webui/slave/executor.tpl webui/slave/framework.tpl webui/slave/index.tpl
webui/slave/webui.py
Author: benh
Date: Mon May 14 17:49:23 2012
New Revision: 1338312
URL: http://svn.apache.org/viewvc?rev=1338312&view=rev
Log:
Fixing broken slave webui after adding ID::generate functionality (https://reviews.apache.org/r/5106).
Modified:
incubator/mesos/trunk/src/slave/webui.cpp
incubator/mesos/trunk/src/webui/slave/executor.tpl
incubator/mesos/trunk/src/webui/slave/framework.tpl
incubator/mesos/trunk/src/webui/slave/index.tpl
incubator/mesos/trunk/src/webui/slave/webui.py
Modified: incubator/mesos/trunk/src/slave/webui.cpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/slave/webui.cpp?rev=1338312&r1=1338311&r2=1338312&view=diff
==============================================================================
--- incubator/mesos/trunk/src/slave/webui.cpp (original)
+++ incubator/mesos/trunk/src/slave/webui.cpp Mon May 14 17:49:23 2012
@@ -36,11 +36,12 @@ namespace webui {
void start(const process::PID<Slave>& slave, const Configuration& conf)
{
- std::vector<std::string> args(4);
- args[0] = "--slave_port=" + utils::stringify(slave.port);
- args[1] = "--webui_port=" + conf.get<std::string>("webui_port", "8081");
- args[2] = "--log_dir=" + conf.get<std::string>("log_dir", FLAGS_log_dir);
- args[3] = "--work_dir=" + conf.get<std::string>("work_dir", "/tmp/mesos");
+ std::vector<std::string> args(5);
+ args[0] = "--slave_id=" + slave.id;
+ args[1] = "--slave_port=" + utils::stringify(slave.port);
+ args[2] = "--webui_port=" + conf.get<std::string>("webui_port", "8081");
+ args[3] = "--log_dir=" + conf.get<std::string>("log_dir", FLAGS_log_dir);
+ args[4] = "--work_dir=" + conf.get<std::string>("work_dir", "/tmp/mesos");
utils::webui::start(conf, "slave/webui.py", args);
}
Modified: incubator/mesos/trunk/src/webui/slave/executor.tpl
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/webui/slave/executor.tpl?rev=1338312&r1=1338311&r2=1338312&view=diff
==============================================================================
--- incubator/mesos/trunk/src/webui/slave/executor.tpl (original)
+++ incubator/mesos/trunk/src/webui/slave/executor.tpl Mon May 14 17:49:23 2012
@@ -3,7 +3,7 @@
% from webui_lib import *
-% url = "http://localhost:" + slave_port + "/slave/state.json"
+% url = "http://localhost:" + slave_port + "/" + slave_id + "/state.json"
% data = urllib.urlopen(url).read()
% state = json.loads(data)
Modified: incubator/mesos/trunk/src/webui/slave/framework.tpl
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/webui/slave/framework.tpl?rev=1338312&r1=1338311&r2=1338312&view=diff
==============================================================================
--- incubator/mesos/trunk/src/webui/slave/framework.tpl (original)
+++ incubator/mesos/trunk/src/webui/slave/framework.tpl Mon May 14 17:49:23 2012
@@ -3,7 +3,7 @@
% from webui_lib import *
-% url = "http://localhost:" + slave_port + "/slave/state.json"
+% url = "http://localhost:" + slave_port + "/" + slave_id + "/state.json"
% data = urllib.urlopen(url).read()
% state = json.loads(data)
Modified: incubator/mesos/trunk/src/webui/slave/index.tpl
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/webui/slave/index.tpl?rev=1338312&r1=1338311&r2=1338312&view=diff
==============================================================================
--- incubator/mesos/trunk/src/webui/slave/index.tpl (original)
+++ incubator/mesos/trunk/src/webui/slave/index.tpl Mon May 14 17:49:23 2012
@@ -6,7 +6,7 @@
% from datetime import datetime
% from webui_lib import *
-% url = "http://localhost:" + slave_port + "/slave/state.json"
+% url = "http://localhost:" + slave_port + "/" + slave_id + "/state.json"
% data = urllib.urlopen(url).read()
% state = json.loads(data)
Modified: incubator/mesos/trunk/src/webui/slave/webui.py
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/src/webui/slave/webui.py?rev=1338312&r1=1338311&r2=1338312&view=diff
==============================================================================
--- incubator/mesos/trunk/src/webui/slave/webui.py (original)
+++ incubator/mesos/trunk/src/webui/slave/webui.py Mon May 14 17:49:23 2012
@@ -30,6 +30,7 @@ from optparse import OptionParser
# Parse options for this script.
parser = OptionParser()
+parser.add_option('--slave_id', default=None)
parser.add_option('--slave_port', default=None)
parser.add_option('--webui_port', default=None)
parser.add_option('--log_dir', default=None)
@@ -37,11 +38,13 @@ parser.add_option('--work_dir', default=
(options, args) = parser.parse_args(sys.argv)
+assert options.slave_id is not None, "Missing --slave_id argument"
assert options.slave_port is not None, "Missing --slave_port argument"
assert options.webui_port is not None, "Missing --webui_port argument"
assert options.log_dir is not None, "Missing --log_dir argument"
assert options.work_dir is not None, "Missing --log_dir argument"
+slave_id = options.slave_id
slave_port = options.slave_port
webui_port = options.webui_port
log_dir = options.log_dir
@@ -54,19 +57,23 @@ webui_dir = os.path.abspath(os.path.dirn
@route('/')
def index():
bottle.TEMPLATES.clear() # For rapid development
- return template("index", slave_port = slave_port, log_dir = log_dir)
+ return template("index", slave_id = slave_id,
+ slave_port = slave_port, log_dir = log_dir)
@route('/framework/:id#.*#')
def framework(id):
bottle.TEMPLATES.clear() # For rapid development
- return template("framework", slave_port = slave_port, framework_id = id)
+ return template("framework", slave_id = slave_id,
+ slave_port = slave_port, framework_id = id)
@route('/executor/:fid#.*#/:eid#.*#')
def executor(fid, eid):
bottle.TEMPLATES.clear() # For rapid development
- return template("executor", slave_port = slave_port, framework_id = fid, executor_id = eid)
+ return template("executor", slave_id = slave_id,
+ slave_port = slave_port, framework_id = fid,
+ executor_id = eid)
@route('/static/:filename#.*#')
@@ -89,7 +96,7 @@ def log_tail(level, lines):
@route('/executor-logs/:fid#.*#/:eid#.*#/:log_type#[a-z]*#')
def framework_log_full(fid, eid, log_type):
- url = "http://localhost:" + slave_port + "/slave/state.json"
+ url = "http://localhost:" + slave_port + "/" + slave_id + "/state.json"
data = urllib.urlopen(url).read()
state = json.loads(data)
sid = state['id']
@@ -106,7 +113,7 @@ def framework_log_full(fid, eid, log_typ
@route('/executor-logs/:fid#.*#/:eid#.*#/:log_type#[a-z]*#/:lines#[0-9]*#')
def framework_log_tail(fid, eid, log_type, lines):
bottle.response.content_type = 'text/plain'
- url = "http://localhost:" + slave_port + "/slave/state.json"
+ url = "http://localhost:" + slave_port + "/" + slave_id + "/state.json"
data = urllib.urlopen(url).read()
state = json.loads(data)
sid = state['id']