[CalendarServer-changes] [1870] CalendarClientSimulator/trunk/src

source_changes at macosforge.org source_changes at macosforge.org
Thu Sep 13 11:03:56 PDT 2007


Revision: 1870
          http://trac.macosforge.org/projects/calendarserver/changeset/1870
Author:   cdaboo at apple.com
Date:     2007-09-13 11:03:55 -0700 (Thu, 13 Sep 2007)

Log Message:
-----------
New options to allow distributed clients to each control their own range of users.

Modified Paths:
--------------
    CalendarClientSimulator/trunk/src/calendarclient.py
    CalendarClientSimulator/trunk/src/multisim.py

Modified: CalendarClientSimulator/trunk/src/calendarclient.py
===================================================================
--- CalendarClientSimulator/trunk/src/calendarclient.py	2007-09-11 17:58:08 UTC (rev 1869)
+++ CalendarClientSimulator/trunk/src/calendarclient.py	2007-09-13 18:03:55 UTC (rev 1870)
@@ -434,9 +434,12 @@
         return data
 
     def generateInviteAttendees(self):
+        # Randonly invite anywhere betweem 1 and 10 attendees.
+        # Pick attendees out of a pool of 100 users which this user is in.
         num_attendees = randint(1, 10)
         my_num = int(self.user[4:])
-        attendee_list = ["user%02d" % i for i in xrange(1,99)if i != my_num]
+        offset = (my_num / 100) * 100
+        attendee_list = ["user%02d" % i for i in xrange(offset + 1, offset + 99)if i != my_num]
         random_list = sample(attendee_list, num_attendees)
         attendees = ["/principals/users/%s/" % (attendee,) for attendee in random_list]
         

Modified: CalendarClientSimulator/trunk/src/multisim.py
===================================================================
--- CalendarClientSimulator/trunk/src/multisim.py	2007-09-11 17:58:08 UTC (rev 1869)
+++ CalendarClientSimulator/trunk/src/multisim.py	2007-09-13 18:03:55 UTC (rev 1870)
@@ -32,6 +32,7 @@
     print """Usage: simulate [options]
 Options:
     --number          number of users to simulate [10]
+    --startat         user number to start at
     --server          URL for server (e.g. https://caldav.example.com:8443) [Required]
     --user            user id for user to login as [user%02d]
     --password        password for user [user%02d]
@@ -49,6 +50,7 @@
 if __name__ == '__main__':
 
     count = 5
+    startat = 1
     server = None
     user = "user%02d"
     password = "user%02d"
@@ -62,6 +64,7 @@
     
     options, args = getopt.getopt(sys.argv[1:], "h", [
         "number=",
+        "startat=",
         "server=",
         "interval=",
         "eventsperday=",
@@ -78,6 +81,8 @@
             sys.exit(0)
         elif option == "--number":
             count = int(value)
+        elif option == "--startat":
+            startat = int(value)
         elif option == "--server":
             server = value
         elif option == "--user":
@@ -111,7 +116,7 @@
             resource.setrlimit(resource.RLIMIT_NPROC, count)
     
     pids = []
-    for i in range(1, count + 1):
+    for i in range(startat, count + startat):
         cmd = [
             "python",
             "./simulate.py",

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20070913/d0f83cc3/attachment.html


More information about the calendarserver-changes mailing list