[CalendarServer-changes] [1761] CalendarClientSimulator/trunk/src/multisim.py

source_changes at macosforge.org source_changes at macosforge.org
Mon Aug 6 12:36:08 PDT 2007


Revision: 1761
          http://trac.macosforge.org/projects/calendarserver/changeset/1761
Author:   cdaboo at apple.com
Date:     2007-08-06 12:36:07 -0700 (Mon, 06 Aug 2007)

Log Message:
-----------
Handle process resource limit issues.

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

Modified: CalendarClientSimulator/trunk/src/multisim.py
===================================================================
--- CalendarClientSimulator/trunk/src/multisim.py	2007-08-06 18:27:58 UTC (rev 1760)
+++ CalendarClientSimulator/trunk/src/multisim.py	2007-08-06 19:36:07 UTC (rev 1761)
@@ -19,6 +19,7 @@
 ##
 from os import P_NOWAIT
 from random import randint
+import resource
 import time
 import signal
 import os
@@ -100,6 +101,15 @@
             usage()
             raise ValueError
 
+    # Check resource limits for the number of processes we need to create
+    soft, hard = resource.getrlimit(resource.RLIMIT_NPROC)
+    if count > soft - 25:
+        if count > hard - 25:
+            print "Number of processes requested: %d is greater than the hard resource limit: %d" % (count, hard)
+            raise ValueError
+        else:
+            resource.setrlimit(resource.RLIMIT_NPROC, count)
+    
     pids = []
     for i in range(1, count + 1):
         cmd = [

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


More information about the calendarserver-changes mailing list