r5114 - tags
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-11-04 12:13:55 +0000 (Fri, 04 Nov 2011)
New Revision: 5114
Added:
tags/sesame-1.0/
Log:
Add a tag for sesame-1.0
12 years, 6 months
r5113 - /
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-11-04 11:59:25 +0000 (Fri, 04 Nov 2011)
New Revision: 5113
Added:
tags/
Log:
Add a tags directory
12 years, 6 months
r5112 - branches
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-11-04 11:57:31 +0000 (Fri, 04 Nov 2011)
New Revision: 5112
Removed:
branches/sage_addition/
Log:
Get rid of this temporary branch
12 years, 6 months
r5111 - in branches/noflash/cumin: python/cumin/grid resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-03 20:15:19 +0000 (Thu, 03 Nov 2011)
New Revision: 5111
Modified:
branches/noflash/cumin/python/cumin/grid/dashboard.strings
branches/noflash/cumin/resources/app.js
Log:
Changes for non-flash graph axis formatting and the png pie chart replacements.
Modified: branches/noflash/cumin/python/cumin/grid/dashboard.strings
===================================================================
--- branches/noflash/cumin/python/cumin/grid/dashboard.strings 2011-11-03 15:12:45 UTC (rev 5110)
+++ branches/noflash/cumin/python/cumin/grid/dashboard.strings 2011-11-03 20:15:19 UTC (rev 5111)
@@ -209,11 +209,9 @@
[DefinitionSet.pie_html]
<script type="text/javascript" charset="utf-8">
//<![CDATA[
- window.addEvent("domready", function () {
values = {pie_slices};
colors = {colors};
- updatePieChart("{id_nodots}", values, colors);
- });
+ updatePieChart("{id_nodots}", values, colors);
//]]>
</script>
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-11-03 15:12:45 UTC (rev 5110)
+++ branches/noflash/cumin/resources/app.js 2011-11-03 20:15:19 UTC (rev 5111)
@@ -630,14 +630,13 @@
format = $j.jqplot.config.defaultTickFormatString;
}
if (val > 1000000) {
- val = val / 100000
+ val = val / 1000000
format = "%.2fM";
}
- if (val > 10000) {
- val = val / 100
+ if (val > 100000) {
+ val = val / 10000
format = "%.2fk";
- }
-
+ }
tickval = $j.jqplot.sprintf(format, val);
}
else {
@@ -648,8 +647,8 @@
updatePieChart = function (piediv, vals, colors) {
var data = vals;
-
- var plot1 = jQuery.jqplot (piediv, [data],
+ $(piediv).empty();
+ jQuery.jqplot (piediv, [data],
{
grid: {
drawBorder: false,
@@ -660,18 +659,20 @@
seriesDefaults: {
renderer: jQuery.jqplot.PieRenderer,
rendererOptions: {
- showDataLabels: false,
- dataLabels: 'value',
+ showDataLabels: true,
+ dataLabels: 'percent',
dataLabelThreshold: 3,
shadow:true,
shadowOffset: 1,
shadowAlpha: 0.06,
shadowDepth: 5,
padding:5,
- hilightMouseOver: false
+ sliceMargin:3,
+ diameter:null,
+ highlightMouseOver: false
}
},
- legend: { show:false, location: 'e' },
+ legend: { show:false},
seriesColors: colors
}
);
12 years, 6 months
r5110 - branches/noflash/cumin/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-03 15:12:45 +0000 (Thu, 03 Nov 2011)
New Revision: 5110
Modified:
branches/noflash/cumin/resources/app.js
Log:
Attempt to make y-axis values smarter for large values (> 10k)
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-11-03 15:07:34 UTC (rev 5109)
+++ branches/noflash/cumin/resources/app.js 2011-11-03 15:12:45 UTC (rev 5110)
@@ -629,10 +629,14 @@
if (!format) {
format = $j.jqplot.config.defaultTickFormatString;
}
- if (val > 10000000) {
- val = val / 1000000
+ if (val > 1000000) {
+ val = val / 100000
format = "%.2fM";
}
+ if (val > 10000) {
+ val = val / 100
+ format = "%.2fk";
+ }
tickval = $j.jqplot.sprintf(format, val);
}
12 years, 6 months
r5109 - branches/noflash/cumin/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-03 15:07:34 +0000 (Thu, 03 Nov 2011)
New Revision: 5109
Modified:
branches/noflash/cumin/resources/app.js
Log:
Attempt to make y-axis values smarter for large values (> 10M)
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-11-03 14:27:12 UTC (rev 5108)
+++ branches/noflash/cumin/resources/app.js 2011-11-03 15:07:34 UTC (rev 5109)
@@ -551,7 +551,8 @@
y2axis: {
autoscale: true,
min:0,
- tickOptions:{formatString:'%.0f'},
+ tickOptions:{formatString:'%.0f',
+ formatter: y_axis_Formatter,},
numberTicks:4,
},
xaxis: {
@@ -622,6 +623,25 @@
}
}
+y_axis_Formatter = function (format, val) {
+ tickval = "";
+ if (typeof val == 'number') {
+ if (!format) {
+ format = $j.jqplot.config.defaultTickFormatString;
+ }
+ if (val > 10000000) {
+ val = val / 1000000
+ format = "%.2fM";
+ }
+
+ tickval = $j.jqplot.sprintf(format, val);
+ }
+ else {
+ return String(val);
+ }
+ return tickval;
+}
+
updatePieChart = function (piediv, vals, colors) {
var data = vals;
12 years, 6 months
r5108 - in branches/noflash/cumin: python/cumin/grid resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-03 14:27:12 +0000 (Thu, 03 Nov 2011)
New Revision: 5108
Modified:
branches/noflash/cumin/python/cumin/grid/dashboard.py
branches/noflash/cumin/python/cumin/grid/dashboard.strings
branches/noflash/cumin/resources/app.js
Log:
Replacing the png pie charts with jqplot pie charts. Still using the same color schemes for now. Mostly just a 1-for-1 replacement functionality-wise, but we can definitely add some features to the new pie charts that were not possible before.
Modified: branches/noflash/cumin/python/cumin/grid/dashboard.py
===================================================================
--- branches/noflash/cumin/python/cumin/grid/dashboard.py 2011-11-03 13:21:58 UTC (rev 5107)
+++ branches/noflash/cumin/python/cumin/grid/dashboard.py 2011-11-03 14:27:12 UTC (rev 5108)
@@ -132,6 +132,9 @@
self.chart_link = None
self.popup_chart = self.DefinitionSetPopup(app, "popup_chart")
self.add_child(self.popup_chart)
+
+ self.pie_width = "150px"
+ self.pie_height = "150px"
self.pie_tmpl = WidgetTemplate(self, "pie_html")
@@ -190,6 +193,10 @@
def render_pie_src(self, session):
slices = self.get_pie_slices(session)
return PieChartPage.get_href(slices, self.color_scheme, self.radius)
+
+ def render_pie_slices(self, session):
+ items = self.do_get_items(session)
+ return [int(self.get_item_value(session, x)) or 0 for x in items if not self.is_total(x)]
def render_width(self, session):
return self.radius * 2
@@ -201,6 +208,26 @@
# don't include total lines, convert None to 0
items = self.do_get_items(session)
return [self.get_item_value(session, x) or 0 for x in items if not self.is_total(x)]
+
+ def render_id_nodots(self, session):
+ return self.render_id(session).replace(".", "_")
+
+ def render_pie_width(self, session):
+ if self.has_pie_chart:
+ return self.pie_width
+ else:
+ return "0px"
+
+ def render_pie_height(self, session):
+ if self.has_pie_chart:
+ return self.pie_height
+ else:
+ return "0px"
+
+ def render_colors(self, session):
+ colors = PieChartPage.color_schemes[self.color_scheme]
+ color_list = ["#%s" % rgb_to_string(*color) for color in colors]
+ return color_list
class DefinitionSetPopup(Widget):
def render_chart_href(self, session):
Modified: branches/noflash/cumin/python/cumin/grid/dashboard.strings
===================================================================
--- branches/noflash/cumin/python/cumin/grid/dashboard.strings 2011-11-03 13:21:58 UTC (rev 5107)
+++ branches/noflash/cumin/python/cumin/grid/dashboard.strings 2011-11-03 14:27:12 UTC (rev 5108)
@@ -183,11 +183,16 @@
{legend_styles}
</style>
<h3>{title}</h3>
+ <div>
+ <div id="{id_nodots}" style="width:{pie_width};height:{pie_height};float:left;" alt="pie_chart" title="{title}"></div>
+ <div style="float:left;">
<dl>
{items}
</dl>
+ </div>
{chart}
- <div class="icons">
+ </div>
+ <div class="icons" style="clear:both;">
{export}
{popup_chart}
</div>
@@ -202,7 +207,17 @@
</div>
[DefinitionSet.pie_html]
- <img src="{pie_src}" alt="pie_chart" title="{title}" width="{width}" height="{height}"/>
+ <script type="text/javascript" charset="utf-8">
+ //<![CDATA[
+ window.addEvent("domready", function () {
+ values = {pie_slices};
+ colors = {colors};
+ updatePieChart("{id_nodots}", values, colors);
+ });
+//]]>
+</script>
+
+
[DefinitionSet.timeseries_html]
{timeseries}
Modified: branches/noflash/cumin/resources/app.js
===================================================================
--- branches/noflash/cumin/resources/app.js 2011-11-03 13:21:58 UTC (rev 5107)
+++ branches/noflash/cumin/resources/app.js 2011-11-03 14:27:12 UTC (rev 5108)
@@ -551,7 +551,7 @@
y2axis: {
autoscale: true,
min:0,
- tickOptions:{formatString:'%d'},
+ tickOptions:{formatString:'%.0f'},
numberTicks:4,
},
xaxis: {
@@ -560,7 +560,8 @@
min:dataopts['xmin'] / dataContainer['x_axis_normalizer'],
max:dataopts['xmax'] / dataContainer['x_axis_normalizer'],
//ticks:[[-3600, "60 min"], [-2700, "45 min"], [-1800, "30 min"], [-900, "15 min"], [0, "0"]]
- tickOptions:{formatString:'%g ' + dataContainer['x_axis_unit_label']},
+ tickOptions:{formatString:'%.0f ' + dataContainer['x_axis_unit_label'],
+ formatter: x_axis_Formatter,},
}
},
series: getSeries(dataContainer),
@@ -579,7 +580,8 @@
markerOptions: {show:true,
lineWidth:2,
style:'filledCircle',
- size:4},
+ size:4,
+ },
},
highlighter: {
tooltipaxes:'xy',
@@ -608,4 +610,45 @@
}
}
+x_axis_Formatter = function (format, val) {
+ if (typeof val == 'number') {
+ if (!format) {
+ format = $j.jqplot.config.defaultTickFormatString;
+ }
+ return ($j.jqplot.sprintf(format, val)).replace(/-/,""); // hack to prevent negative axis labels, which we don't have
+ }
+ else {
+ return String(val);
+ }
+}
+updatePieChart = function (piediv, vals, colors) {
+ var data = vals;
+
+ var plot1 = jQuery.jqplot (piediv, [data],
+ {
+ grid: {
+ drawBorder: false,
+ drawGridlines: false,
+ background: '#ffffff',
+ shadow:false
+ },
+ seriesDefaults: {
+ renderer: jQuery.jqplot.PieRenderer,
+ rendererOptions: {
+ showDataLabels: false,
+ dataLabels: 'value',
+ dataLabelThreshold: 3,
+ shadow:true,
+ shadowOffset: 1,
+ shadowAlpha: 0.06,
+ shadowDepth: 5,
+ padding:5,
+ hilightMouseOver: false
+ }
+ },
+ legend: { show:false, location: 'e' },
+ seriesColors: colors
+ }
+ );
+ }
12 years, 6 months
r5107 - in branches/lucidity/sesame/cpp: etc src
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-11-03 13:21:58 +0000 (Thu, 03 Nov 2011)
New Revision: 5107
Modified:
branches/lucidity/sesame/cpp/etc/sesame.conf
branches/lucidity/sesame/cpp/src/SysAgent.cpp
Log:
Merge from trunk
svn merge -c 5101 svn+ssh://svn.fedorahosted.org/svn/cumin/trunk/sesame .
BZ750315
Modified: branches/lucidity/sesame/cpp/etc/sesame.conf
===================================================================
--- branches/lucidity/sesame/cpp/etc/sesame.conf 2011-11-03 13:04:05 UTC (rev 5106)
+++ branches/lucidity/sesame/cpp/etc/sesame.conf 2011-11-03 13:21:58 UTC (rev 5107)
@@ -30,14 +30,14 @@
##======================
##
-## Set the SASL mechanism (PLAIN by default), and the username and password
+## Set the SASL mechanism (ANONYMOUS by default), and the username and password
## to be used when authenticating to the broker. If you wish to not store
## the password in this configuration file, you may use pwd-file to point
## to an access-restricted file containing the password.
##
-#mech=PLAIN
-#uid=guest
-#pwd=guest
+#mech=ANONYMOUS
+#uid=
+#pwd=
#pwd-file=/etc/sesame/password
##==============
Modified: branches/lucidity/sesame/cpp/src/SysAgent.cpp
===================================================================
--- branches/lucidity/sesame/cpp/src/SysAgent.cpp 2011-11-03 13:04:05 UTC (rev 5106)
+++ branches/lucidity/sesame/cpp/src/SysAgent.cpp 2011-11-03 13:21:58 UTC (rev 5107)
@@ -325,9 +325,9 @@
options["host"] = Option("ADDR", "localhost", "Broker host name or IP address");
options["port"] = Option("N", "5672", "Port for broker service");
options["proto"] = Option("NAME", "tcp", "Protocol for broker communication");
- options["mech"] = Option("NAME", "", "Authentication mechanism");
- options["uid"] = Option("NAME", "guest", "Authentication user name");
- options["pwd"] = Option("PASSWORD", "guest", "Authentication password");
+ options["mech"] = Option("NAME", "ANONYMOUS", "Authentication mechanism");
+ options["uid"] = Option("NAME", "", "Authentication user name");
+ options["pwd"] = Option("PASSWORD", "", "Authentication password");
options["pwd-file"] = Option("FILE", "", "File containing password");
options["service"] = Option("NAME", "qpidd", "SASL service name");
options["min-ssf"] = Option("N", "0", "Minimum acceptable strength for SASL security layer");
12 years, 6 months
r5106 - branches/noflash/wooly/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2011-11-03 13:04:05 +0000 (Thu, 03 Nov 2011)
New Revision: 5106
Modified:
branches/noflash/wooly/resources/jquery.jqplot.js
Log:
Eliminating hack for negative values. It is now properly overridden via tickOptions.formatter in our custom code.
Modified: branches/noflash/wooly/resources/jquery.jqplot.js
===================================================================
--- branches/noflash/wooly/resources/jquery.jqplot.js 2011-11-02 19:45:30 UTC (rev 5105)
+++ branches/noflash/wooly/resources/jquery.jqplot.js 2011-11-03 13:04:05 UTC (rev 5106)
@@ -3811,13 +3811,12 @@
if (!format) {
format = $.jqplot.config.defaultTickFormatString;
}
- return ($.jqplot.sprintf(format, val)).replace(/-/,""); // hack to prevent negative axis labels, which we don't have
+ return $.jqplot.sprintf(format, val);
}
else {
return String(val);
}
};
-
$.jqplot.AxisTickRenderer.prototype.pack = function() {
};
12 years, 6 months
r5105 - in trunk/cumin: etc python/cumin python/cumin/inventory python/cumin/messaging python/cumin/usergrid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-11-02 19:45:30 +0000 (Wed, 02 Nov 2011)
New Revision: 5105
Removed:
trunk/cumin/etc/cumin.crt
trunk/cumin/etc/cumin.key
trunk/cumin/python/cumin/tools.py
trunk/cumin/python/cumin/usergrid/submission.py
Modified:
trunk/cumin/python/cumin/inventory/main.strings
trunk/cumin/python/cumin/messaging/main.strings
Log:
Modifications arising out of rpmlint on the cumin package.
- Remove cumin.crt, cumin.key, and tools.py. The functionality
here is no longer used (benchmarking, test harness, and ssl).
If we need these things we can revisit.
- Add dummy tags to inventory/main.strings and
messaging/main.strings to prevent 0 length errors.
- Remove empty usergrid/submission.py
Deleted: trunk/cumin/etc/cumin.crt
===================================================================
--- trunk/cumin/etc/cumin.crt 2011-11-01 19:06:44 UTC (rev 5104)
+++ trunk/cumin/etc/cumin.crt 2011-11-02 19:45:30 UTC (rev 5105)
@@ -1,40 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIICXQIBAAKBgQC8zL7h6pevyBeme9LMDvCKEBOzKuBMr4QUsnsBdKa+DO21wZWd
-X3h/GKhV7ELgl7j/G4lZVYyy8jbFa7YlEawrTucryIv6VVCI4nKnw6KuclHP0UTm
-niENl6grDqu3s7cEom02nQTjtRAVn/2Tx+VO5b9M6u+4SNm686DdvH/7bwIDAQAB
-AoGBAJv4VVUTVX6dQZSCxLFZQjP8dhnUuPoBIY9rpxybvshQq+w0YaJh5Yyx1Rcu
-mE0samMt33jSqOqIGOFdS1syT1UFwdfN2PjoPCdwlkEefN1yOqlU3IYUs0AcU8Vt
-+HZfR5nCZl0lzV8bHVTOhkYBHvsTKT1RTqd6A6gPD2WMkt4xAkEA+SdLRmxigF5i
-1E02C2D3REVgdMG/8/s+y03QD1/eYb0T8H6RsUqdPbz7TfLdjBZSGe2Lqwaluq1E
-sc4ZDEhnlwJBAMH84oKGwO4XWTVQIPqZ0yNwAyi32Wk8FsHH484beJjvexclyysC
-kDoNURq1tP4wLInAs7gYzoBLkw3sHBCCRekCQF3DCtHywdLbMkgA0oDPud3oWdc2
-fp07hLMPkmfmxRJ1DEbp6rwUfz4Xm18HMZahY748Jd5zvvSUdhCPpd94c/sCQGwp
-ES6P7fCSyiWkqM6xh/0BTnGcmLdJTrL7PfREcuhq1qngY7h2dG450Jfg6qqzt5GT
-BWHHSxRTjwm7NSarTEkCQQCzFsf/s6imADbjw17bkIwdcyIO3LC9KZzeXwvX9zjR
-ZkOMh3I9h4EYW9gxx6K3Hdsc59FaFN5bDM63nGTxHEzG
------END RSA PRIVATE KEY-----
-
------BEGIN CERTIFICATE-----
-MIIEHDCCA4WgAwIBAgIJALFw4Q2OWzQ4MA0GCSqGSIb3DQEBBQUAMIG7MQswCQYD
-VQQGEwItLTESMBAGA1UECBMJU29tZVN0YXRlMREwDwYDVQQHEwhTb21lQ2l0eTEZ
-MBcGA1UEChMQU29tZU9yZ2FuaXphdGlvbjEfMB0GA1UECxMWU29tZU9yZ2FuaXph
-dGlvbmFsVW5pdDEeMBwGA1UEAxMVbG9jYWxob3N0LmxvY2FsZG9tYWluMSkwJwYJ
-KoZIhvcNAQkBFhpyb290QGxvY2FsaG9zdC5sb2NhbGRvbWFpbjAeFw0wODAyMjYx
-NjUwMzlaFw0wOTAyMjUxNjUwMzlaMIG7MQswCQYDVQQGEwItLTESMBAGA1UECBMJ
-U29tZVN0YXRlMREwDwYDVQQHEwhTb21lQ2l0eTEZMBcGA1UEChMQU29tZU9yZ2Fu
-aXphdGlvbjEfMB0GA1UECxMWU29tZU9yZ2FuaXphdGlvbmFsVW5pdDEeMBwGA1UE
-AxMVbG9jYWxob3N0LmxvY2FsZG9tYWluMSkwJwYJKoZIhvcNAQkBFhpyb290QGxv
-Y2FsaG9zdC5sb2NhbGRvbWFpbjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
-vMy+4eqXr8gXpnvSzA7wihATsyrgTK+EFLJ7AXSmvgzttcGVnV94fxioVexC4Je4
-/xuJWVWMsvI2xWu2JRGsK07nK8iL+lVQiOJyp8OirnJRz9FE5p4hDZeoKw6rt7O3
-BKJtNp0E47UQFZ/9k8flTuW/TOrvuEjZuvOg3bx/+28CAwEAAaOCASQwggEgMB0G
-A1UdDgQWBBSG2ASHUAYMHesFOdIuwEP2JXLRETCB8AYDVR0jBIHoMIHlgBSG2ASH
-UAYMHesFOdIuwEP2JXLREaGBwaSBvjCBuzELMAkGA1UEBhMCLS0xEjAQBgNVBAgT
-CVNvbWVTdGF0ZTERMA8GA1UEBxMIU29tZUNpdHkxGTAXBgNVBAoTEFNvbWVPcmdh
-bml6YXRpb24xHzAdBgNVBAsTFlNvbWVPcmdhbml6YXRpb25hbFVuaXQxHjAcBgNV
-BAMTFWxvY2FsaG9zdC5sb2NhbGRvbWFpbjEpMCcGCSqGSIb3DQEJARYacm9vdEBs
-b2NhbGhvc3QubG9jYWxkb21haW6CCQCxcOENjls0ODAMBgNVHRMEBTADAQH/MA0G
-CSqGSIb3DQEBBQUAA4GBABAhLdp86AYqfd7g1ICfeXyQK9rAvg6dAzgND6PFE0mc
-8aBYGT7vkFFv97cxxfjtDlRpjfsxdIlKxeZZ2JpP0pW6DUdn243CUZ+4g0AYSUs6
-OboH5gkG03eJGYT1w8+7F13DQFAEvEwAtf28xItlH3Y4YeXU3Z5U/mpY+Rh6vlxk
------END CERTIFICATE-----
Deleted: trunk/cumin/etc/cumin.key
===================================================================
--- trunk/cumin/etc/cumin.key 2011-11-01 19:06:44 UTC (rev 5104)
+++ trunk/cumin/etc/cumin.key 2011-11-02 19:45:30 UTC (rev 5105)
@@ -1 +0,0 @@
-link cumin.crt
\ No newline at end of file
Modified: trunk/cumin/python/cumin/inventory/main.strings
===================================================================
--- trunk/cumin/python/cumin/inventory/main.strings 2011-11-01 19:06:44 UTC (rev 5104)
+++ trunk/cumin/python/cumin/inventory/main.strings 2011-11-02 19:45:30 UTC (rev 5105)
@@ -0,0 +1 @@
+[thisSpaceIntentionallyLeftBlank]
\ No newline at end of file
Modified: trunk/cumin/python/cumin/messaging/main.strings
===================================================================
--- trunk/cumin/python/cumin/messaging/main.strings 2011-11-01 19:06:44 UTC (rev 5104)
+++ trunk/cumin/python/cumin/messaging/main.strings 2011-11-02 19:45:30 UTC (rev 5105)
@@ -0,0 +1 @@
+[thisSpaceIntentionallyLeftBlank]
\ No newline at end of file
Deleted: trunk/cumin/python/cumin/tools.py
===================================================================
--- trunk/cumin/python/cumin/tools.py 2011-11-01 19:06:44 UTC (rev 5104)
+++ trunk/cumin/python/cumin/tools.py 2011-11-02 19:45:30 UTC (rev 5105)
@@ -1,247 +0,0 @@
-import sys, os, re, signal
-
-from mint import *
-from parsley.config import *
-from parsley.command import *
-from wooly.bench import *
-from time import sleep
-
-from util import *
-from cumin import Cumin
-from cumin.account.model import *
-from cumin.config import CuminConfig
-from cumin.server import CuminServer
-from test import *
-
-class BaseCuminTool(Command):
- def __init__(self, name):
- super(BaseCuminTool, self).__init__(None, name)
-
- self.config = CuminConfig()
-
- opt = CommandOption(self, "data")
- opt.argument = "URI"
- opt.description = "Connect to database at URI"
-
- opt = CommandOption(self, "qmf")
- opt.argument = "URI"
- opt.description = "Connect to QMF server at URI"
-
- opt = CommandOption(self, "log-file")
- opt.argument = "PATH"
- opt.description = "Log to file at PATH"
-
- opt = CommandOption(self, "log-level")
- opt.argument = "LEVEL"
- opt.description = "Log messages at or above LEVEL " + \
- "('debug', 'info', 'warn', 'error')"
-
- opt = CommandOption(self, "debug")
- opt.description = "Enable debugging; print logging to console"
-
- def check(self):
- if os.getuid() not in (os.stat(sys.argv[0]).st_uid, 0):
- print "Error: You have insufficient privileges"
- sys.exit(1)
-
- def init(self):
- super(BaseCuminTool, self).init()
-
- # Drop privileges
-
- if os.getuid() == 0:
- os.setuid(os.stat(sys.argv[0]).st_uid)
-
- self.config.init()
-
- def run(self):
- try:
- opts, args = self.parse(sys.argv)
- except CommandException, e:
- print "Error: %s" % e
- e.command.print_help()
- sys.exit(1)
-
- if "help" in opts:
- self.print_help()
- sys.exit(0)
-
- self.config.load_dict(opts)
-
- if self.config.debug:
- self.config.prt()
-
- self.do_run(opts, args)
-
- def do_run(self, opts, args):
- raise Exception("Not implemented")
-
- def main(self):
- self.check()
- self.init()
- self.run()
-
-class CuminServerTool(BaseCuminTool):
- def __init__(self, name):
- super(CuminServerTool, self).__init__(name)
-
- self.description = "Cumin web server"
-
- param = ConfigParameter(self.config, "addr", str)
- param.default = "localhost"
-
- param = ConfigParameter(self.config, "port", int)
- param.default = 45672
-
- param = ConfigParameter(self.config, "ssl", bool)
- param.default = False
-
- opt = CommandOption(self, "addr")
- opt.argument = "ADDR"
- opt.description = "Run web server at address ADDR"
-
- opt = CommandOption(self, "port")
- opt.argument = "PORT"
- opt.description = "Run web server on port PORT"
-
- opt = CommandOption(self, "ssl")
- opt.description = "Serve web pages using SSL"
-
- def do_run(self, opts, args):
- app = Cumin(self.config)
-
- try:
- app.check()
- except Exception, e:
- log.exception(e)
- sys.exit(1)
-
- app.init()
-
- server = CuminServer(app, self.config.addr, self.config.port)
- server.init()
-
- if self.config.ssl:
- cpath = os.path.join(self.config.home, "etc", "cumin.crt")
- kpath = os.path.join(self.config.home, "etc", "cumin.key")
-
- if os.path.isfile(cpath):
- server.set_ssl_cert_path(cpath)
- else:
- log.error("SSL certificate file '%s' not found" % cpath)
- sys.exit(1)
-
- if os.path.isfile(kpath):
- server.set_ssl_key_path(kpath)
- else:
- log.error("SSL key file '%s' not found" % kpath)
- sys.exit(1)
-
- app.start()
-
- try:
- server.start()
-
- try:
- while True:
- print "Sleeping!"
-
- sleep(1)
- finally:
- server.stop()
- finally:
- app.stop()
-
-class CuminTestTool(BaseCuminTool):
- def __init__(self, name):
- super(CuminTestTool, self).__init__(name)
-
- self.description = "Cumin test tool"
-
- def do_run(self, opts, args):
- app = Cumin(self.config)
-
- try:
- app.check()
- except Exception, e:
- print e
-
- sys.exit(1)
-
- app.init()
- app.start()
-
- try:
- test = CuminTest(app)
-
- harness = TestHarness(test)
-
- if len(args) < 2:
- harness.include.append("*")
- else:
- for pattern in args[1:]:
- harness.include.append(pattern)
-
- harness.init()
-
- session = harness.run()
-
- session.report()
- finally:
- app.stop()
-
-class CuminBenchTool(BaseCuminTool):
- def __init__(self, name):
- super(CuminBenchTool, self).__init__(name)
-
- self.description = "Cumin benchmarking tool"
-
- opt = CommandOption(self, "count")
- opt.argument = "COUNT"
- opt.description = "Stop after COUNT page hits; 0 means no limit"
-
- opt = CommandOption(self, "profile")
- opt.description = "Enable profiling"
-
- opt = CommandOption(self, "continue-on-error")
- opt.description = "Don't stop if a page load fails"
-
- opt = CommandOption(self, "check-output")
- opt.description = "Check that page output is well-formed xml"
-
- opt = CommandOption(self, "print-output")
- opt.description = "Print the rendered page to the console"
-
- opt = CommandOption(self, "broker")
- opt.argument = "ADDR"
- opt.description = "Use existing broker at ADDR"
-
- def do_run(self, opts, args):
- app = Cumin(self.config)
- app.debug = True
-
- try:
- app.check()
- except Exception, e:
- print e
-
- sys.exit(1)
-
- app.init()
- app.start()
-
- harness = BenchmarkHarness(app)
- harness.continue_on_error = "continue-on-error" in opts
- harness.check_output = "check-output" in opts
- harness.print_output = "print-output" in opts
-
- login = LoginSession(app, Subject.getByName("guest"))
-
- harness.client_session.attributes["login_session"] = login
-
- sleep(0.5) # XXXX! arrgh
-
- try:
- harness.run(int(opts.get("count", "1000")))
- finally:
- app.stop()
Deleted: trunk/cumin/python/cumin/usergrid/submission.py
===================================================================
12 years, 6 months