Author: justi9
Date: 2008-08-21 10:11:03 -0400 (Thu, 21 Aug 2008)
New Revision: 2330
Added:
mgmt/trunk/cumin/bin/cumin-load-demo-data
Modified:
mgmt/trunk/bin/reschema
mgmt/trunk/cumin/python/cumin/demo.py
Log:
Add a demo data loading script, and make it by default a part of reschema
Modified: mgmt/trunk/bin/reschema
===================================================================
--- mgmt/trunk/bin/reschema 2008-08-20 21:03:53 UTC (rev 2329)
+++ mgmt/trunk/bin/reschema 2008-08-21 14:11:03 UTC (rev 2330)
@@ -3,3 +3,4 @@
cumin-admin drop-schema --force
cumin-admin create-schema --force
cumin-admin add-user guest
+cumin-load-demo-data
Added: mgmt/trunk/cumin/bin/cumin-load-demo-data
===================================================================
--- mgmt/trunk/cumin/bin/cumin-load-demo-data (rev 0)
+++ mgmt/trunk/cumin/bin/cumin-load-demo-data 2008-08-21 14:11:03 UTC (rev 2330)
@@ -0,0 +1,42 @@
+#!/usr/bin/python
+
+import sys, os
+from sqlobject import connectionForURI
+from traceback import print_exc
+from getpass import getpass
+from random import sample
+from crypt import crypt
+from mint import MintDatabase, ConsoleUser
+from psycopg2 import IntegrityError
+
+from cumin import *
+from cumin.util import *
+from cumin.demo import *
+
+def main():
+ config = CuminConfig()
+
+ if "-h" in sys.argv or "--help" in sys.argv:
+ config.print_usage("cumin-load-demo-data")
+ sys.exit(0)
+
+ config.init()
+
+ if config.debug:
+ config.prt()
+
+ cumin = Cumin(config.home, config.data, config.spec)
+ cumin.check()
+ cumin.init()
+
+ data = DemoData()
+ data.load()
+
+if __name__ == "__main__":
+ try:
+ main()
+ except SystemExit, e:
+ raise e
+ except:
+ print_exc()
+ sys.exit(1)
Property changes on: mgmt/trunk/cumin/bin/cumin-load-demo-data
___________________________________________________________________
Name: svn:executable
+ *
Modified: mgmt/trunk/cumin/python/cumin/demo.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/demo.py 2008-08-20 21:03:53 UTC (rev 2329)
+++ mgmt/trunk/cumin/python/cumin/demo.py 2008-08-21 14:11:03 UTC (rev 2330)
@@ -19,20 +19,22 @@
group = BrokerGroup(name=name)
groups[name] = group
- profiles = list()
+ Pool(name="main")
- for name in ("4S Xserve", "2S ProLiant"):
- profile = BrokerProfile(name=name)
- profiles.append(profile)
+ #profiles = list()
- #self.load_props(profile)
+ #for name in ("4S Xserve", "2S ProLiant"):
+ # profile = BrokerProfile(name=name)
+ # profiles.append(profile)
- clusters = list()
+ # self.load_props(profile)
- for cluster_count in range(3):
- cluster = BrokerCluster(name=fmt("cluster", cluster_count))
- clusters.append(cluster)
+ #clusters = list()
+ #for cluster_count in range(3):
+ # cluster = BrokerCluster(name=fmt("cluster", cluster_count))
+ # clusters.append(cluster)
+
def load_props(self, obj):
prop = ConfigProperty()
prop.name = "max_threads"