r5124 - branches/noflash/cumin/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-09 15:25:04 +0000 (Wed, 09 Nov 2011)
New Revision: 5124
Modified:
branches/noflash/cumin/resources/app.js
Log:
Removing call to <element>.empty() in favor of <chart>.destroy() to [hopefully] vanquish the memory leak in the jqplot charts.
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-11-08 21:35:27 UTC (rev 5123)
+++ branches/noflash/cumin/resources/app.js 2011-11-09 15:25:04 UTC (rev 5124)
@@ -603,10 +603,8 @@
if(allCharts[divName]) {
var parent = $(divName).getParent();
var newDiv = $(divName);
- $(divName).empty();
- $(divName).destroy();
+ allCharts[divName].destroy();
newDiv.inject(parent);
- allCharts[divName].destroy();
allCharts[divName] = $j.jqplot(holder, dataContainer['y_coordinate_values'],chartOptionsObject);
} else {
allCharts[divName] = $j.jqplot(holder, dataContainer['y_coordinate_values'],chartOptionsObject);
12 years, 6 months
r5123 - trunk/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-11-08 21:35:27 +0000 (Tue, 08 Nov 2011)
New Revision: 5123
Modified:
trunk/cumin/bin/cumin
Log:
Send SIGINT to child processes first, then wait up to 10 seconds
for all children to exit before issuing SIGKILL
Modified: trunk/cumin/bin/cumin
===================================================================
--- trunk/cumin/bin/cumin 2011-11-08 20:36:56 UTC (rev 5122)
+++ trunk/cumin/bin/cumin 2011-11-08 21:35:27 UTC (rev 5123)
@@ -6,6 +6,7 @@
import sys
import signal
import traceback
+from datetime import datetime, timedelta
home = os.environ.get("CUMIN_HOME", os.path.normpath("/usr/share/cumin"))
sys.path.append(os.path.join(home, "python"))
@@ -166,8 +167,34 @@
else:
start(app, "Restart")
finally:
- for app in apps:
- app[PROCESS] and os.kill(app[PROCESS].pid, signal.SIGTERM)
+ # Try a ctrl-C first
+ log.info("Send SIGINT to all children")
+ complete = 0
+ for app in apps:
+ if app[PROCESS]:
+ complete += 1
+ os.kill(app[PROCESS].pid, signal.SIGINT)
+
+ # Give children 10 seconds to exit, then bail
+ then = datetime.now()
+ while complete != 0:
+ for app in apps:
+ poll = app[PROCESS] and app[PROCESS].poll()
+ if poll is not None:
+ app[PROCESS] = None
+ complete -= 1
+
+ if complete == 0:
+ log.info("All children exited")
+ break
+
+ sleep(0.25)
+ if datetime.now() - then > timedelta(seconds=10):
+ for app in apps: # just to be paranoid
+ app[PROCESS] and os.kill(app[PROCESS].pid, signal.SIGKILL)
+ log.info("Timed out waiting for children, exited")
+ break
+
return return_code
if __name__ == "__main__":
12 years, 6 months
r5122 - in branches/noflash/cumin/python/cumin: . grid
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-08 20:36:56 +0000 (Tue, 08 Nov 2011)
New Revision: 5122
Modified:
branches/noflash/cumin/python/cumin/grid/negotiator.strings
branches/noflash/cumin/python/cumin/stat.strings
Log:
Fixing leftlegend conflict for the negotiator quota editing legend. Also resolving the updatePieChart function conflict.
Modified: branches/noflash/cumin/python/cumin/grid/negotiator.strings
===================================================================
--- branches/noflash/cumin/python/cumin/grid/negotiator.strings 2011-11-08 20:07:15 UTC (rev 5121)
+++ branches/noflash/cumin/python/cumin/grid/negotiator.strings 2011-11-08 20:36:56 UTC (rev 5122)
@@ -25,7 +25,7 @@
<script type="text/javascript" charset="utf-8">
//<![CDATA[
- updatePieChart = function (vals, legend) {
+ updateQuotaPieChart = function (vals, legend) {
var data = combineValsAndLegend(vals, legend);
colors = ['#4572A7', '#AA4643', '#89A54E', '#80699B', '#3D96AE', '#000000', '#666600']
colors[vals.length-1]= "#B0B0B0";
@@ -58,21 +58,10 @@
);
}
- combineValsAndLegend = function (vals, legend) {
- var index, length;
- var result = [];
- result.length = vals.length; // Helps performance in some implemenations, harmless in others
- for (index = 0, length = vals.length; index < length; ++index) {
- result[index] = [legend[index], vals[index]];
- }
- return result;
-
- }
-
window.addEvent("domready", function () {
values = {all_group_values};
legend = {all_group_names};
- updatePieChart(values, legend);
+ updateQuotaPieChart(values, legend);
});
@@ -244,7 +233,7 @@
values_array[i] = new_values[i]['value'];
legend_array[i] = new_values[i]['label'];
}
- updatePieChart(values_array, legend_array);
+ updateQuotaPieChart(values_array, legend_array);
}//end onchange
}) //end addEvents
Modified: branches/noflash/cumin/python/cumin/stat.strings
===================================================================
--- branches/noflash/cumin/python/cumin/stat.strings 2011-11-08 20:07:15 UTC (rev 5121)
+++ branches/noflash/cumin/python/cumin/stat.strings 2011-11-08 20:36:56 UTC (rev 5122)
@@ -301,7 +301,7 @@
<div>
<!-- don't put this data url inside the holder div, jqplot will kill it on a zoom -->
<a rel="api" type="application/json" href="{href}" style="display:none">Data</a>
- <div id="{id_nodots}_chart" class="jqplotgraph" style="height:150px;width:400px;">
+ <div id="{id_nodots}_chart" class="jqplotgraph leftlegend" style="height:150px;width:400px;">
<div class="loading" style="display:none;"><span>Loading...</span></div>
</div>
</div>
12 years, 6 months
r5121 - trunk/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-11-08 20:07:15 +0000 (Tue, 08 Nov 2011)
New Revision: 5121
Modified:
trunk/cumin/bin/cumin
trunk/cumin/bin/cumin-data
trunk/cumin/bin/cumin-web
Log:
More changes to start up and monitoring code. Treat termination
signals as normal and restart, record pids and init failures.
Modified: trunk/cumin/bin/cumin
===================================================================
--- trunk/cumin/bin/cumin 2011-11-08 15:44:25 UTC (rev 5120)
+++ trunk/cumin/bin/cumin 2011-11-08 20:07:15 UTC (rev 5121)
@@ -19,15 +19,7 @@
sys.exit()
def set_exit_handler(func):
- if os.name == "nt":
- try:
- import win32api
- win32api.SetConsoleCtrlHandler(func, True)
- except ImportError:
- version = ".".join(map(str, sys.version_info[:2]))
- raise Exception("pywin32 not installed for Python " + version)
- else:
- signal.signal(signal.SIGTERM, func)
+ signal.signal(signal.SIGTERM, func)
def log_parse_errors(r):
msg = os.fdopen(r, "r").readlines()
@@ -130,38 +122,49 @@
complete = 0
return_code = 0
sleep_time = 0.25
- slow_down = 40
+ slow_down = 40 # slow down polling after initial period
try:
+ def start(app, verb):
+ app[PROCESS] = subprocess.Popen(app[ARGS])
+ if app[PROCESS]:
+ log.info(verb+"ed subprocess (pid %s): %s" %\
+ (app[PROCESS].pid, app[PROG_STRING]))
+ else:
+ log.warn("Failed to %s: %s" % (verb, app[PROG_STRING]))
+
for app in apps:
- log.info("Starting:" + app[PROG_STRING])
- app[PROCESS] = subprocess.Popen(app[ARGS])
+ start(app, "Start")
+
while complete != len(apps):
sleep(sleep_time)
if slow_down > 0:
slow_down -= 1
if slow_down == 0:
- print "set sleep to 5 seconds"
sleep_time = 5
for app in apps:
poll = app[PROCESS] and app[PROCESS].poll()
if poll is not None:
- log.warn("Subprocess exited with status " + str(poll))
+ log.warn("Subprocess exited (pid %s), status %s" %\
+ (app[PROCESS].pid, str(poll)))
# If the low bit is set on the return code, the
# process got an error during init checks.
# Exit and shut down any processes that have already
# been started, do not start the remaining.
- if poll & 1:
+ # Note, signals that cause termination will result in
+ # a negative error code, we treat those as "normal"
+ if poll > 0 and poll & 1:
+ log.error("Subprocess failed init checks (pid %s),"\
+ " stopping cumin" % app[PROCESS].pid)
app[PROCESS] = None
return_code = 2
complete = len(apps)
- break
+ break
elif options.init_only:
app[PROCESS] = None
complete += 1
else:
- log.info("Restarting:" + app[PROG_STRING])
- app[PROCESS] = subprocess.Popen(app[ARGS])
+ start(app, "Restart")
finally:
for app in apps:
app[PROCESS] and os.kill(app[PROCESS].pid, signal.SIGTERM)
Modified: trunk/cumin/bin/cumin-data
===================================================================
--- trunk/cumin/bin/cumin-data 2011-11-08 15:44:25 UTC (rev 5120)
+++ trunk/cumin/bin/cumin-data 2011-11-08 20:07:15 UTC (rev 5121)
@@ -94,6 +94,7 @@
def main():
passed_init = 1
+ return_code = 0
# Do our own simple option check so we can redirect IO early
# without worrying about other options or the behavior of optParse
@@ -126,121 +127,127 @@
print_exc()
pipeThread = None
+ class EarlyReturn(Exception):
+ pass
+
try:
- try:
- mint = None
- return_code = 0
- setup_initial_logging()
+ mint = None
+ setup_initial_logging()
- parser = CuminOptionParser()
+ parser = CuminOptionParser()
- # Add additional parameters for data
- parser.add_option("--print-stats", action="store_true", default=False)
- parser.add_option("--print-events", type="int", default=0, metavar="LEVEL")
- parser.add_option("--section", default="data")
- parser.add_option("--daemon", action="store_true", default=False)
- parser.add_option("--no-vacuum", dest="vacuum_enabled", action="store_false")
- parser.add_option("--no-expire", dest="expire_enabled", action="store_false")
+ # Add additional parameters for data
+ parser.add_option("--print-stats", action="store_true", default=False)
+ parser.add_option("--print-events", type="int", default=0, metavar="LEVEL")
+ parser.add_option("--section", default="data")
+ parser.add_option("--daemon", action="store_true", default=False)
+ parser.add_option("--no-vacuum", dest="vacuum_enabled", action="store_false")
+ parser.add_option("--no-expire", dest="expire_enabled", action="store_false")
- # Get options
- opts, args = parser.parse_args()
-
- # --section controls which section is read from the config file
- # If a section other than "data" is specified, require it to exist
- config = CuminDataConfig(opts.section, strict_section = opts.section != "data")
+ # Get options
+ opts, args = parser.parse_args()
+ if len(args) != 0:
+ log.error("Extra arguments:" + "".join([" "+arg for arg in args]))
+ raise EarlyReturn
- # There might be other sections returned from config.parse() but
- # currently we don't care about them...
- values = getattr(config.parse(), opts.section)
+ # --section controls which section is read from the config file
+ # If a section other than "data" is specified, require it to exist
+ config = CuminDataConfig(opts.section, strict_section = opts.section != "data")
- # Use the config values as defaults for unspecified options
- apply_defaults(values, opts)
+ # There might be other sections returned from config.parse() but
+ # currently we don't care about them...
+ values = getattr(config.parse(), opts.section)
- setup_operational_logging(opts,
- values.log_max_mb,
- values.log_max_archives)
+ # Use the config values as defaults for unspecified options
+ apply_defaults(values, opts)
- model_dir = os.path.join(config.home, "model")
+ setup_operational_logging(opts,
+ values.log_max_mb,
+ values.log_max_archives)
- broker_uris = [x.strip() for x in opts.brokers.split(",")]
+ model_dir = os.path.join(config.home, "model")
- mint = Mint(model_dir, broker_uris, opts.database)
+ broker_uris = [x.strip() for x in opts.brokers.split(",")]
- if type(values.sasl_mech_list) == str:
- mint.sasl_mech_list = values.sasl_mech_list.upper()
+ mint = Mint(model_dir, broker_uris, opts.database)
- mint.print_event_level = opts.print_events
+ if type(values.sasl_mech_list) == str:
+ mint.sasl_mech_list = values.sasl_mech_list.upper()
- mint.expire_enabled = opts.expire_enabled
- mint.expire_thread.interval = values.expire_interval
- mint.expire_thread.threshold = values.expire_threshold
+ mint.print_event_level = opts.print_events
- mint.vacuum_enabled = opts.vacuum_enabled
- mint.vacuum_thread.interval = values.vacuum_interval
+ mint.expire_enabled = opts.expire_enabled
+ mint.expire_thread.interval = values.expire_interval
+ mint.expire_thread.threshold = values.expire_threshold
- mint.check()
- mint.init()
-
- # Handle QMF class binding options
- if values.include_classes or values.exclude_classes:
- return_code, includes = process_classes(mint,
- values.include_classes,
- opts.section, on_empty="all")
+ mint.vacuum_enabled = opts.vacuum_enabled
+ mint.vacuum_thread.interval = values.vacuum_interval
- return_code, excludes = process_classes(mint,
- values.exclude_classes,
- opts.section)
+ mint.check()
+ mint.init()
- mint.qmf_classes = includes.difference(excludes)
+ # Handle QMF class binding options
+ if values.include_classes or values.exclude_classes:
+ return_code, includes = process_classes(mint,
+ values.include_classes,
+ opts.section, on_empty="all")
- # Handle agents binding option
- if values.agents:
- return_code, agents = process_agents(values.agents, opts.section)
- mint.qmf_agents = agents
+ return_code, excludes = process_classes(mint,
+ values.exclude_classes,
+ opts.section)
- # If init_only was set or we failed init, don't proceed...
- if not opts.init_only and not return_code:
- passed_init = 0
+ mint.qmf_classes = includes.difference(excludes)
- mint.start()
- stats = mint.update_thread.stats
- count = 0
+ # Handle agents binding option
+ if values.agents:
+ return_code, agents = process_agents(values.agents, opts.section)
+ mint.qmf_agents = agents
- if opts.print_stats:
- print "[Starred columns are the number of events per second]"
+ # If init_only was set or we failed init, don't proceed...
+ if not opts.init_only and not return_code:
+ passed_init = 0
- while True:
- if count % 20 == 0:
- stats.print_headings()
+ mint.start()
+ stats = mint.update_thread.stats
+ count = 0
- count += 1
+ if opts.print_stats:
+ print "[Starred columns are the number of events per second]"
- stats.print_values()
+ while True:
+ if count % 20 == 0:
+ stats.print_headings()
- sleep(5)
- else:
- while True:
- sleep(86400)
+ count += 1
- except KeyboardInterrupt:
- pass
+ stats.print_values()
- except SystemExit:
- if "--help" not in sys.argv:
- return_code = 1
+ sleep(5)
+ else:
+ while True:
+ sleep(86400)
- except:
- print_exc()
+ except KeyboardInterrupt:
+ pass
+
+ except SystemExit:
+ if "--help" not in sys.argv:
return_code = 1
- finally:
- if mint:
- mint.stop()
- if pipeThread:
- pipeThread.stop()
- logging.shutdown()
- return adjust_return(passed_init, return_code)
+ except EarlyReturn:
+ return_code = 1
+ except:
+ print_exc()
+ return_code = 2
+
+ if mint:
+ mint.stop()
+ if pipeThread:
+ pipeThread.stop()
+ logging.shutdown()
+ return adjust_return(passed_init, return_code)
+
if __name__ == "__main__":
try:
sys.exit(main())
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2011-11-08 15:44:25 UTC (rev 5120)
+++ trunk/cumin/bin/cumin-web 2011-11-08 20:07:15 UTC (rev 5121)
@@ -48,6 +48,7 @@
def main():
passed_init = 1
+ return_code = 0
# Do our own simple option check so we can redirect IO early
# without worrying about other options or the behavior of optParse
@@ -81,97 +82,104 @@
print_exc()
pipeThread = None
+ # Use EarlyReturn to jump to the finally block and exit
+ class EarlyReturn(Exception):
+ pass
+
try:
- try:
- return_code = 0
- cumin = None
+ cumin = None
- setup_initial_logging()
+ setup_initial_logging()
- parser = CuminOptionParser()
+ parser = CuminOptionParser()
- # Add additional parameters for web
- parser.add_option("--host")
- parser.add_option("--port", type=int)
- parser.add_option("--section", default="web")
- parser.add_option("--daemon", action="store_true", default=False)
+ # Add additional parameters for web
+ parser.add_option("--host")
+ parser.add_option("--port", type=int)
+ parser.add_option("--section", default="web")
+ parser.add_option("--daemon", action="store_true", default=False)
- # Get options
- opts, args = parser.parse_args()
-
- # --section controls which section is read from the config file
- # If a section other than "web" is specified, require it to exist
- config = CuminWebConfig(opts.section, strict_section = opts.section != "web")
+ # Get options
+ opts, args = parser.parse_args()
+ if len(args) != 0:
+ log.error("Extra arguments:" + "".join([" "+arg for arg in args]))
+ raise EarlyReturn
- # There might be other sections returned from config.parse() but
- # currently we don't care about them...
- values = getattr(config.parse(), opts.section)
+ # --section controls which section is read from the config file
+ # If a section other than "web" is specified, require it to exist
+ config = CuminWebConfig(opts.section, strict_section = opts.section != "web")
- # Use the config values as defaults for unspecified options
- apply_defaults(values, opts)
+ # There might be other sections returned from config.parse() but
+ # currently we don't care about them...
+ values = getattr(config.parse(), opts.section)
- setup_operational_logging(opts,
- values.log_max_mb,
- values.log_max_archives)
+ # Use the config values as defaults for unspecified options
+ apply_defaults(values, opts)
- broker_uris = [x.strip() for x in opts.brokers.split(",")]
- authmech = [x.strip() for x in values.auth.split(";")]
- cumin = Cumin(config.get_home(), broker_uris, opts.database,
- opts.host, opts.port, values.persona, authmech)
+ setup_operational_logging(opts,
+ values.log_max_mb,
+ values.log_max_archives)
- if type(values.sasl_mech_list) == str:
- cumin.sasl_mech_list = values.sasl_mech_list.upper()
+ broker_uris = [x.strip() for x in opts.brokers.split(",")]
+ authmech = [x.strip() for x in values.auth.split(";")]
+ cumin = Cumin(config.get_home(), broker_uris, opts.database,
+ opts.host, opts.port, values.persona, authmech)
- set_aviary_configs(cumin, values)
- set_wallaby_configs(cumin, values, broker_uris)
+ if type(values.sasl_mech_list) == str:
+ cumin.sasl_mech_list = values.sasl_mech_list.upper()
- cumin.debug = opts.debug
- cumin.user = values.user
- cumin.update_interval = values.update_interval
- cumin.max_qmf_table_sort = values.max_qmf_table_sort
-
- cumin.fast_view_attributes = [x.strip() for x in values.fast_view_attributes.split(',')]
-
- # set default values for form inputs
- cumin.set_form_defaults(values.request_memory,
- values.request_memory_vm,
- values.request_disk,
- values.request_disk_vm)
+ set_aviary_configs(cumin, values)
+ set_wallaby_configs(cumin, values, broker_uris)
- cumin.check()
- cumin.init()
+ cumin.debug = opts.debug
+ cumin.user = values.user
+ cumin.update_interval = values.update_interval
+ cumin.max_qmf_table_sort = values.max_qmf_table_sort
- if not opts.init_only and not return_code:
- passed_init = 0
+ cumin.fast_view_attributes = [x.strip() for x in values.fast_view_attributes.split(',')]
- cumin.start()
- while True:
- # print_threads()
- sleep(1)
- if not cumin.server_alive():
- print "web server has stopped, exiting..."
- return_code = 1
- break
+ # set default values for form inputs
+ cumin.set_form_defaults(values.request_memory,
+ values.request_memory_vm,
+ values.request_disk,
+ values.request_disk_vm)
- except KeyboardInterrupt:
- pass
+ cumin.check()
+ cumin.init()
- except SystemExit:
- if "--help" not in sys.argv:
- return_code = 1
+ if not opts.init_only and not return_code:
+ passed_init = 0
- except:
- print_exc()
+ cumin.start()
+ while True:
+ # print_threads()
+ sleep(1)
+ if not cumin.server_alive():
+ print "web server has stopped, exiting..."
+ return_code = 1
+ break
+
+ except KeyboardInterrupt:
+ pass
+
+ except SystemExit:
+ if "--help" not in sys.argv:
return_code = 1
- finally:
- if cumin:
- cumin.stop()
- if pipeThread:
- pipeThread.stop()
- logging.shutdown()
- return adjust_return(passed_init, return_code)
+ except EarlyReturn:
+ return_code = 1
+ except:
+ print_exc()
+ return_code = 2
+
+ if cumin:
+ cumin.stop()
+ if pipeThread:
+ pipeThread.stop()
+ logging.shutdown()
+ return adjust_return(passed_init, return_code)
+
if __name__ == "__main__":
try:
sys.exit(main())
12 years, 6 months
r5120 - branches/noflash/cumin/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-08 15:44:25 +0000 (Tue, 08 Nov 2011)
New Revision: 5120
Modified:
branches/noflash/cumin/resources/app.js
Log:
Giving some love to the full-page version of the new JavaScript charts. The "full page icon" is now working for all charts.
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-11-08 02:13:01 UTC (rev 5119)
+++ branches/noflash/cumin/resources/app.js 2011-11-08 15:44:25 UTC (rev 5120)
@@ -318,6 +318,8 @@
oFullPage.originalParent.appendChild(oFullPage);
oIcon.setProperty("title", "Full Page");
setFullpageParam(false, oFullPage);
+ $(oFullPage).getElement(".jqplotgraph").setProperty("style", "width:400px;height:150px;");
+ drawSingleChart($(oFullPage).getElement(".jqplotgraph"));
var onrestore = oFullPage.onrestore;
if (onrestore) onrestore();
window.scrollTo(oFullPage.origScroll.x, oFullPage.origScroll.y);
@@ -341,7 +343,8 @@
var height = Math.min(Math.max(window.getSize().y - 100, 200), 600);
if (onfullpage)
onfullpage(coords.width, height);
-
+ $(oFullPage).getElement(".jqplotgraph").setProperty("style", "width:100%");
+ drawSingleChart($(oFullPage).getElement(".jqplotgraph"));
var curScroll = window.getScroll();
oFullPage.origScroll = curScroll;
window.scrollTo(0,0);
@@ -434,7 +437,7 @@
}
startChartMonitor = function(id) {
- setInterval(function() {drawSingleChart(id)}, 120000);
+ setInterval(function() {drawSingleChart(id)}, 30000);
}
stathandler = function(response) {
@@ -677,3 +680,14 @@
}
);
}
+
+combineValsAndLegend = function (vals, legend) {
+ var index, length;
+ var result = [];
+ result.length = vals.length; // Helps performance in some implemenations, harmless in others
+ for (index = 0, length = vals.length; index < length; ++index) {
+ result[index] = [legend[index], vals[index]];
+ }
+ return result;
+
+}
\ No newline at end of file
12 years, 6 months
r5119 - trunk/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-11-08 02:13:01 +0000 (Tue, 08 Nov 2011)
New Revision: 5119
Modified:
trunk/cumin/bin/cumin
trunk/cumin/bin/cumin-data
trunk/cumin/bin/cumin-web
Log:
Merge --init-only case into the main process monitoring loop in bin/cumin.
Use the low bit of the return value from cumin-data and cumin-web to
indicate an error that happened during init checks.
Make cumin exit and terminate all processes if any child fails init checks.
These changes make the preliminary --init-only checks done by the cumin
sysvinit run in parallel (much faster) while also setting cumin up for
migration to systemd scripts under Fedora (and someday RHEL)
Modified: trunk/cumin/bin/cumin
===================================================================
--- trunk/cumin/bin/cumin 2011-11-07 18:47:07 UTC (rev 5118)
+++ trunk/cumin/bin/cumin 2011-11-08 02:13:01 UTC (rev 5119)
@@ -33,7 +33,8 @@
msg = os.fdopen(r, "r").readlines()
if len(msg) > 0:
log.error("".join(msg))
- return True
+ return 1
+ return 0
def get_args(app, section, init_only, console, extra_options=""):
args = [app, "--section="+section.strip()]
@@ -124,34 +125,47 @@
for instance in options.datas.split(','):
args, prog_string = get_args("cumin-data", instance, options.init_only, console, options.data_options)
apps.append([None, args, prog_string])
+
+ # Launch and babysit, do not restart if options.init_only is set
+ complete = 0
+ return_code = 0
+ sleep_time = 0.25
+ slow_down = 40
+ try:
+ for app in apps:
+ log.info("Starting:" + app[PROG_STRING])
+ app[PROCESS] = subprocess.Popen(app[ARGS])
+ while complete != len(apps):
+ sleep(sleep_time)
+ if slow_down > 0:
+ slow_down -= 1
+ if slow_down == 0:
+ print "set sleep to 5 seconds"
+ sleep_time = 5
- # If we are just checking startup flags, invoke each instance
- # with "--init-only" and return status to caller.
- if options.init_only:
- for app in apps:
- if subprocess.Popen(app[ARGS]).wait() != 0:
- log.error("Subprocess failed init check:" + app[PROG_STRING])
- return 1
- else:
- # Launch and babysit
- try:
for app in apps:
- log.info("Starting:" + app[PROG_STRING])
- app[PROCESS] = subprocess.Popen(app[ARGS])
-
- while True:
- sleep(5)
- for app in apps:
- return_code = app[PROCESS].poll()
- if return_code != None:
- if return_code != 0:
- log.warn("Subprocess exited with status " + str(return_code))
+ poll = app[PROCESS] and app[PROCESS].poll()
+ if poll is not None:
+ log.warn("Subprocess exited with status " + str(poll))
+ # If the low bit is set on the return code, the
+ # process got an error during init checks.
+ # Exit and shut down any processes that have already
+ # been started, do not start the remaining.
+ if poll & 1:
+ app[PROCESS] = None
+ return_code = 2
+ complete = len(apps)
+ break
+ elif options.init_only:
+ app[PROCESS] = None
+ complete += 1
+ else:
log.info("Restarting:" + app[PROG_STRING])
- app[PROCESS] = subprocess.Popen(app[ARGS])
- finally:
- for app in apps:
- if app[PROCESS]:
- os.kill(app[PROCESS].pid, signal.SIGTERM)
+ app[PROCESS] = subprocess.Popen(app[ARGS])
+ finally:
+ for app in apps:
+ app[PROCESS] and os.kill(app[PROCESS].pid, signal.SIGTERM)
+ return return_code
if __name__ == "__main__":
# This is necessary so that on a SIGTERM we can call sys.exit()
@@ -161,4 +175,5 @@
try:
sys.exit(main())
except KeyboardInterrupt:
- pass
+ sys.exit(0)
+
Modified: trunk/cumin/bin/cumin-data
===================================================================
--- trunk/cumin/bin/cumin-data 2011-11-07 18:47:07 UTC (rev 5118)
+++ trunk/cumin/bin/cumin-data 2011-11-08 02:13:01 UTC (rev 5119)
@@ -85,7 +85,15 @@
return return_code, agents
+def adjust_return(passed_init, ret):
+ # Shift non-zer0 return codes left 1 bit
+ # and OR in whether or not init passed
+ if ret != 0:
+ ret = ret << 1 | passed_init
+ return ret
+
def main():
+ passed_init = 1
# Do our own simple option check so we can redirect IO early
# without worrying about other options or the behavior of optParse
@@ -190,33 +198,37 @@
return_code, agents = process_agents(values.agents, opts.section)
mint.qmf_agents = agents
- if opts.init_only or return_code:
- return
+ # If init_only was set or we failed init, don't proceed...
+ if not opts.init_only and not return_code:
+ passed_init = 0
- mint.start()
+ mint.start()
+ stats = mint.update_thread.stats
+ count = 0
- stats = mint.update_thread.stats
- count = 0
+ if opts.print_stats:
+ print "[Starred columns are the number of events per second]"
- if opts.print_stats:
- print "[Starred columns are the number of events per second]"
+ while True:
+ if count % 20 == 0:
+ stats.print_headings()
- while True:
- if count % 20 == 0:
- stats.print_headings()
+ count += 1
- count += 1
+ stats.print_values()
- stats.print_values()
+ sleep(5)
+ else:
+ while True:
+ sleep(86400)
- sleep(5)
- else:
- while True:
- sleep(86400)
-
- except (KeyboardInterrupt, SystemExit):
+ except KeyboardInterrupt:
pass
+ except SystemExit:
+ if "--help" not in sys.argv:
+ return_code = 1
+
except:
print_exc()
return_code = 1
@@ -227,10 +239,10 @@
if pipeThread:
pipeThread.stop()
logging.shutdown()
- sys.exit(return_code)
+ return adjust_return(passed_init, return_code)
if __name__ == "__main__":
try:
- main()
+ sys.exit(main())
except KeyboardInterrupt:
- pass
+ sys.exit(0)
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2011-11-07 18:47:07 UTC (rev 5118)
+++ trunk/cumin/bin/cumin-web 2011-11-08 02:13:01 UTC (rev 5119)
@@ -39,7 +39,16 @@
if cumin.wallaby_refresh == 0:
cumin.wallaby_refresh = None
+def adjust_return(passed_init, ret):
+ # Shift non-zer0 return codes left 1 bit
+ # and OR in whether or not init passed
+ if ret != 0:
+ ret = ret << 1 | passed_init
+ return ret
+
def main():
+ passed_init = 1
+
# Do our own simple option check so we can redirect IO early
# without worrying about other options or the behavior of optParse
opts = check_for_options(["--section", "--daemon"], sys.argv[1:])
@@ -132,22 +141,25 @@
cumin.check()
cumin.init()
- if opts.init_only:
- return
+ if not opts.init_only and not return_code:
+ passed_init = 0
- cumin.start()
+ cumin.start()
+ while True:
+ # print_threads()
+ sleep(1)
+ if not cumin.server_alive():
+ print "web server has stopped, exiting..."
+ return_code = 1
+ break
- while True:
- # print_threads()
- sleep(1)
- if not cumin.server_alive():
- print "web server has stopped, exiting..."
- return_code = 1
- break
-
- except (KeyboardInterrupt, SystemExit):
+ except KeyboardInterrupt:
pass
+ except SystemExit:
+ if "--help" not in sys.argv:
+ return_code = 1
+
except:
print_exc()
return_code = 1
@@ -158,10 +170,10 @@
if pipeThread:
pipeThread.stop()
logging.shutdown()
- sys.exit(return_code)
+ return adjust_return(passed_init, return_code)
if __name__ == "__main__":
try:
- main()
+ sys.exit(main())
except KeyboardInterrupt:
- pass
+ sys.exit(0)
12 years, 6 months
r5118 - trunk/cumin/python/cumin/grid
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-07 18:47:07 +0000 (Mon, 07 Nov 2011)
New Revision: 5118
Modified:
trunk/cumin/python/cumin/grid/scheduler.py
Log:
Addressing BZ:751775 by making a customization to the SchedulerGeneralStatSet to render MonitorSelfAge in the dd:hh:mm format.
Modified: trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- trunk/cumin/python/cumin/grid/scheduler.py 2011-11-04 20:00:58 UTC (rev 5117)
+++ trunk/cumin/python/cumin/grid/scheduler.py 2011-11-07 18:47:07 UTC (rev 5118)
@@ -122,7 +122,44 @@
"MonitorSelfAge", "MonitorSelfCPUUsage",
"MonitorSelfImageSize","MonitorSelfRegisteredSocketCount",
"MonitorSelfResidentSetSize","MonitorSelfTime")
+
+ def render_formatted_value(self, session, item, value):
+ def fmt_b(value):
+ return value is not None and fmt_bytes(value) or None
+ def fmt_kb(value):
+ return value is not None and fmt_bytes(value * 1024) or None
+
+ def fmt_mb(value):
+ return value is not None and fmt_bytes(value * 1024 * 1024) or None
+
+ def fmt_timestamp_ddhhmmss(value):
+ days = value / 86400
+ hours = (value / 3600) - (days * 24)
+ minutes = (value / 60) - (days * 1440) - (hours * 60)
+ return '%02d:%02d:%02d' % (days, hours, minutes)
+
+ try:
+ format = self.get_item_unit(session, item)
+ if format:
+ if format == "MiB":
+ return fmt_mb(value)
+ elif format == "KiB":
+ return fmt_kb(value)
+ name = self.get_item_name(session, item)
+ # Since condor.xml doesn't have a unit for this, we will improvise a bit.
+ # In a perfect world, this might use the same Rosemary code that Negotiator uses
+ if(name in ["MonitorSelfAge"]):
+ return fmt_timestamp_ddhhmmss(value)
+ except:
+ pass
+
+ return CuminStatistic.fmt_value(value)
+
+ def get_item_name(self, session, item):
+ the_item, _ = item
+ return the_item.name
+
class SchedulerOverviewGeneral(Widget):
def __init__(self, app, name, scheduler):
super(SchedulerOverviewGeneral, self).__init__(app, name)
12 years, 6 months
r5117 - branches/noflash/wooly/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-04 20:00:58 +0000 (Fri, 04 Nov 2011)
New Revision: 5117
Modified:
branches/noflash/wooly/resources/jquery.jqplot.css
Log:
Fix for the desire to have the legend for line charts above and to the left of the chart. This fix will no longer always override the left property for all legends. It will only act on those that have the chart container div with a class of leftlegend. This lets us preserve the standard legend placement for jqplot.
Modified: branches/noflash/wooly/resources/jquery.jqplot.css
===================================================================
--- branches/noflash/wooly/resources/jquery.jqplot.css 2011-11-04 13:51:54 UTC (rev 5116)
+++ branches/noflash/wooly/resources/jquery.jqplot.css 2011-11-04 20:00:58 UTC (rev 5117)
@@ -184,8 +184,8 @@
border-right-style: solid;
}
-/* This gives us a left justified 'n' position for our legend */
-.jqplot-table-legend {
+/* This gives us a left justified 'n' position for our legend, just have the container div use the leftlegend class */
+div.leftlegend>table.jqplot-table-legend{
left:0px !important;
}
12 years, 6 months
r5116 - branches/noflash/wooly/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-04 13:51:54 +0000 (Fri, 04 Nov 2011)
New Revision: 5116
Modified:
branches/noflash/wooly/resources/wooly.js
Log:
Fixing a bug in executeJS for IE. Previously, we were only grabbing node.textContent as the payload for the script tag. That works in FF and Chrome, but for IE, the payload is in node.text. We will now check both places and take whichever exists.
Modified: branches/noflash/wooly/resources/wooly.js
===================================================================
--- branches/noflash/wooly/resources/wooly.js 2011-11-04 13:46:52 UTC (rev 5115)
+++ branches/noflash/wooly/resources/wooly.js 2011-11-04 13:51:54 UTC (rev 5116)
@@ -279,7 +279,11 @@
while (child) {
if (child.nodeType == 1 && child.nodeName == "script") {
var oScript = document.createElement("script");
- oScript.text = child.textContent;
+ if(child.textContent) {
+ oScript.text = child.textContent;
+ } else {
+ oScript.text = child.text; // for IE
+ }
document.getElementsByTagName("head").item(0).appendChild(oScript);
}
child = child.nextSibling;
12 years, 6 months
r5115 - branches/noflash/cumin/python/cumin/grid
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-04 13:46:52 +0000 (Fri, 04 Nov 2011)
New Revision: 5115
Modified:
branches/noflash/cumin/python/cumin/grid/dashboard.strings
Log:
changing the pie_html rendering text to be a 1-line JS that triggers the pie to be redrawn after each page update.
Modified: branches/noflash/cumin/python/cumin/grid/dashboard.strings
===================================================================
--- branches/noflash/cumin/python/cumin/grid/dashboard.strings 2011-11-04 12:13:55 UTC (rev 5114)
+++ branches/noflash/cumin/python/cumin/grid/dashboard.strings 2011-11-04 13:46:52 UTC (rev 5115)
@@ -190,13 +190,13 @@
{items}
</dl>
</div>
- {chart}
</div>
<div class="icons" style="clear:both;">
{export}
{popup_chart}
</div>
</div>
+{chart}
[DefinitionSetPopup.html]
<div class="{class}">
@@ -207,15 +207,9 @@
</div>
[DefinitionSet.pie_html]
- <script type="text/javascript" charset="utf-8">
- //<![CDATA[
- values = {pie_slices};
- colors = {colors};
- updatePieChart("{id_nodots}", values, colors);
-//]]>
+<script type="text/javascript" charset="utf-8">
+ updatePieChart("{id_nodots}", {pie_slices}, {colors});
</script>
-
-
[DefinitionSet.timeseries_html]
{timeseries}
12 years, 6 months