Author: croberts
Date: 2012-04-20 18:49:12 +0000 (Fri, 20 Apr 2012)
New Revision: 5332
Modified:
trunk/cumin/model/plumage/plumage.xml
trunk/cumin/model/plumage/rosemary.xml
trunk/cumin/model/upgrades/1.2_to_1.3
trunk/mint/python/mint/plumage/session.py
Log:
Adding the plumage_host as a property of the OSUtil class.
Modified: trunk/cumin/model/plumage/plumage.xml
===================================================================
--- trunk/cumin/model/plumage/plumage.xml 2012-04-20 18:18:31 UTC (rev 5331)
+++ trunk/cumin/model/plumage/plumage.xml 2012-04-20 18:49:12 UTC (rev 5332)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<schema package="com.redhat.grid.plumage"
package_type="generic">
<class name="OSUtil">
+ <property name="host" type="sstr" />
<statistic name="ts" type="absTime" unit="uint32"
/>
<statistic name="total" type="uint32" uint="uint32"
/>
<statistic name="used" type="uint32" uint="uint32"
/>
Modified: trunk/cumin/model/plumage/rosemary.xml
===================================================================
--- trunk/cumin/model/plumage/rosemary.xml 2012-04-20 18:18:31 UTC (rev 5331)
+++ trunk/cumin/model/plumage/rosemary.xml 2012-04-20 18:49:12 UTC (rev 5332)
@@ -6,6 +6,10 @@
<collection>samples.machine</collection>
</source>
+ <property name="host">
+ <title>Host</title>
+ </property>
+
<statistic name="ts" timestamp="y">
</statistic>
Modified: trunk/cumin/model/upgrades/1.2_to_1.3
===================================================================
--- trunk/cumin/model/upgrades/1.2_to_1.3 2012-04-20 18:18:31 UTC (rev 5331)
+++ trunk/cumin/model/upgrades/1.2_to_1.3 2012-04-20 18:49:12 UTC (rev 5332)
@@ -1,5 +1,5 @@
#!/bin/bash
echo 'create schema "com.redhat.grid.plumage"' | psql -d cumin -U cumin
-h localhost
echo 'create sequence
"com.redhat.grid.plumage"."OSUtil_id_seq"' | psql -d cumin -U
cumin -h localhost
-echo 'create table "com.redhat.grid.plumage"."OSUtil"
("_id" int8 not null,"ts" timestamp not null,"total" int8
not null,"used" int8 not null,"unused" int8 not null,"owner"
int8 not null,"efficiency" float4 not null,constraint "OSUtil_pk"
primary key ("_id"))'| psql -d cumin -U cumin -h localhost
+echo 'create table "com.redhat.grid.plumage"."OSUtil"
("_id" int8 not null,"host" text not null,"ts" timestamp not
null,"total" int8 not null,"used" int8 not null,"unused"
int8 not null,"owner" int8 not null,"efficiency" float4 not
null,constraint "OSUtil_pk" primary key ("_id"))'| psql -d cumin
-U cumin -h localhost
echo 'create table "com.redhat.grid.plumage"."OSUtil_samples"
("ts" timestamp not null,"total" int8 not null,"used" int8
not null,"unused" int8 not null,"owner" int8 not
null,"efficiency" float4 not null)'| psql -d cumin -U cumin -h localhost
Modified: trunk/mint/python/mint/plumage/session.py
===================================================================
--- trunk/mint/python/mint/plumage/session.py 2012-04-20 18:18:31 UTC (rev 5331)
+++ trunk/mint/python/mint/plumage/session.py 2012-04-20 18:49:12 UTC (rev 5332)
@@ -125,6 +125,7 @@
for time in sample_times:
record = OSUtil()
+ record.host= "%s:%s" % (self.connection.host,
self.connection.port)
record.total =
len(self.collection.find({'ts':time}).distinct('n'))
record.used =
len(self.collection.find({'ts':time,'st':{'$nin':['Unclaimed','Owner']}}).distinct('n'))
record.unused =
len(self.collection.find({'ts':time,'st':'Unclaimed'}).distinct('n'))
@@ -157,6 +158,7 @@
for time in sample_times:
record = OSUtil()
+ record.host= "%s:%s" % (self.connection.host,
self.connection.port)
record.total =
len(self.collection.find({'ts':time}).distinct('n'))
record.used =
len(self.collection.find({'ts':time,'st':{'$nin':['Unclaimed','Owner']}}).distinct('n'))
record.unused =
len(self.collection.find({'ts':time,'st':'Unclaimed'}).distinct('n'))
@@ -167,7 +169,7 @@
obj = ObjectUpdate(self.app.model, record, self.cls)
self.app.update_thread.enqueue(obj)
log.info("PlumageSessionThread--current: pass completed")
- sleep(300)
+ sleep(300)
'''This thread is meant to run once at startup. It will figure out the
newest record in the cumin
@@ -185,6 +187,7 @@
for time in sample_times:
record = OSUtil()
+ record.host= "%s:%s" % (self.connection.host,
self.connection.port)
record.total =
len(self.collection.find({'ts':time}).distinct('n'))
record.used =
len(self.collection.find({'ts':time,'st':{'$nin':['Unclaimed','Owner']}}).distinct('n'))
record.unused =
len(self.collection.find({'ts':time,'st':'Unclaimed'}).distinct('n'))