changeset 2228:1d1362c54c94

Some doc / comment fixes. Added tools/load_tracker.py - see its usage string. Used to load a tracker with data for load testing. Preliminary results: sqlite, mysql, postgresql and metakit break *no* sweat with 2000 issues (approx 1700-1800 "open").
author Richard Jones <richard@users.sourceforge.net>
date Tue, 20 Apr 2004 05:47:33 +0000
parents 15c20983fd13
children 77461135596d
files roundup/backends/rdbms_common.py roundup/roundupdb.py tools/load_tracker.py
diffstat 3 files changed, 94 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Tue Apr 20 00:43:29 2004 +0000
+++ b/roundup/backends/rdbms_common.py	Tue Apr 20 05:47:33 2004 +0000
@@ -1,4 +1,4 @@
-# $Id: rdbms_common.py,v 1.91 2004-04-18 05:31:02 richard Exp $
+# $Id: rdbms_common.py,v 1.92 2004-04-20 05:47:33 richard Exp $
 ''' Relational database (SQL) backend common code.
 
 Basics:
@@ -391,6 +391,9 @@
                 print >>hyperdb.DEBUG, 'create_index', (self, index_sql3)
             self.cursor.execute(index_sql3)
 
+        # TODO: create indexes on (selected?) Link property columns, as
+        # they're more likely to be used for lookup
+
     def drop_class_table_indexes(self, cn, key):
         # drop the old table indexes first
         l = ['_%s_id_idx'%cn, '_%s_retired_idx'%cn]
@@ -1709,8 +1712,6 @@
         None, or a TypeError is raised.  The values of the key property on
         all existing nodes must be unique or a ValueError is raised.
         '''
-        # XXX create an index on the key prop column. We should also 
-        # record that we've created this index in the schema somewhere.
         prop = self.getprops()[propname]
         if not isinstance(prop, String):
             raise TypeError, 'key properties must be String'
--- a/roundup/roundupdb.py	Tue Apr 20 00:43:29 2004 +0000
+++ b/roundup/roundupdb.py	Tue Apr 20 05:47:33 2004 +0000
@@ -15,7 +15,7 @@
 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
 # 
-# $Id: roundupdb.py,v 1.107 2004-04-18 06:13:48 richard Exp $
+# $Id: roundupdb.py,v 1.108 2004-04-20 05:47:33 richard Exp $
 
 """Extending hyperdb with types specific to issue-tracking.
 """
@@ -121,7 +121,6 @@
         appended to the "messages" field of the specified issue.
         """
 
-    # XXX "bcc" is an optional extra here...
     def nosymessage(self, nodeid, msgid, oldvalues, whichnosy='nosy',
             from_address=None, cc=[], bcc=[]):
         """Send a message to the members of an issue's nosy list.
@@ -133,6 +132,15 @@
 
         If 'msgid' is None, the message gets sent only to the nosy
         list, and it's called a 'System Message'.
+
+        The "cc" argument indicates additional recipients to send the
+        message to that may not be specified in the message's recipients
+        list.
+
+        The "bcc" argument also indicates additional recipients to send the
+        message to that may not be specified in the message's recipients
+        list. These recipients will not be included in the To: or Cc:
+        address lists.
         """
         authid = self.db.msg.safeget(msgid, 'author')
         recipients = self.db.msg.safeget(msgid, 'recipients', [])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/load_tracker.py	Tue Apr 20 05:47:33 2004 +0000
@@ -0,0 +1,80 @@
+#! /usr/bin/env python
+# $Id: load_tracker.py,v 1.1 2004-04-20 05:47:33 richard Exp $
+
+'''
+Usage: %s <tracker home> <N>
+
+Load up the indicated tracker with N issues and N/100 users.
+'''
+
+import sys, os, random
+from roundup import instance
+
+# open the instance
+if len(sys.argv) < 2:
+    print "Error: Not enough arguments"
+    print __doc__.strip()%(sys.argv[0], username)
+    sys.exit(1)
+tracker_home = sys.argv[1]
+N = int(sys.argv[2])
+
+# open the tracker
+tracker = instance.open(tracker_home)
+db = tracker.open('admin')
+
+priorities = db.priority.list()
+statuses = db.status.list()
+
+names = ['alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 
+'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi',
+'rho']
+
+titles = '''Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
+Duis nibh purus, bibendum sed, condimentum ut, bibendum ut, risus.
+Fusce pede enim, nonummy sit amet, dapibus a, blandit eget, metus.
+Nulla risus.
+Vivamus tincidunt.
+Donec consequat convallis quam.
+Sed convallis vehicula felis.
+Aliquam laoreet, dui quis pharetra vehicula, magna justo.
+Euismod felis, eu adipiscing eros metus id tortor.
+Suspendisse et turpis.
+Aenean non felis.
+Nam egestas eros.
+Integer tellus quam, mattis ac, vestibulum sed, egestas quis, mauris.
+Nulla tincidunt diam sit amet dui.
+Nam odio mauris, dignissim vitae, eleifend eu, consectetuer id, risus.
+Suspendisse potenti.
+Donec tincidunt.
+Vestibulum gravida.
+Fusce luctus, neque id mattis fringilla, purus pede sodales pede.
+Quis ultricies urna odio sed orci.'''.splitlines()
+
+try:
+    M = N/100
+    print
+    for i in range(M):
+        print '\ruser', i*100./M,
+        sys.stdout.flush()
+        db.user.create(username=names[i%17]+str(i/17))
+
+    users = db.user.list()
+    users.remove(db.user.lookup('anonymous'))
+    print
+
+    # now create the issues
+    for i in range(N):
+        print '\rissue', i*100./N,
+        sys.stdout.flush()
+        db.issue.create(
+            title=random.choice(titles),
+            priority=random.choice(priorities),
+            status=random.choice(statuses),
+            assignedto=random.choice(users))
+    print
+
+    db.commit()
+finally:
+    db.close()
+
+# vim: set filetype=python ts=4 sw=4 et si

Roundup Issue Tracker: http://roundup-tracker.org/