You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by ch...@apache.org on 2013/09/23 22:44:50 UTC

svn commit: r1525694 - in /uima/sandbox/uima-ducc/trunk/src/main/admin: check_ducc ducc.py ducc_util.py start_ducc

Author: challngr
Date: Mon Sep 23 20:44:49 2013
New Revision: 1525694

URL: http://svn.apache.org/r1525694
Log:
UIMA-3296 startup scripting verifies limits.

Modified:
    uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc
    uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py
    uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py
    uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc?rev=1525694&r1=1525693&r2=1525694&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc Mon Sep 23 20:44:49 2013
@@ -36,6 +36,7 @@ class CheckDucc(DuccUtil):
         self.check_clock_skew(checkdate)
         self.verify_jvm()
         self.verify_duccling()
+        self.verify_limits()
         return
 
 

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py?rev=1525694&r1=1525693&r2=1525694&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc.py Mon Sep 23 20:44:49 2013
@@ -86,6 +86,9 @@ class Ducc(DuccUtil):
                 if ( not self.check_clock_skew(localdate) ):
                     return
 
+                if ( not self.verify_limits() ):
+                    return
+
                 if ( not single_user ) :
                     dok = self.verify_duccling()
                     if ( not dok ):

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py?rev=1525694&r1=1525693&r2=1525694&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py Mon Sep 23 20:44:49 2013
@@ -234,6 +234,36 @@ class DuccUtil(DuccBase):
         CMD = self.duccling + ' -v >' + self.DUCC_HOME + '/state/duccling.version'
         os.system(CMD)
 
+    def verify_limits(self):
+        ret = True
+        (softnproc , hardnproc)  = resource.getrlimit(resource.RLIMIT_NPROC)
+        (softnfiles, hardnfiles)  = resource.getrlimit(resource.RLIMIT_NOFILE)
+        
+        if ( softnproc < hardnproc ):
+            try:
+                resource.setrlimit(resource.RLIMIT_NPROC, (hardnproc, hardnproc))
+            except:
+                print 'NOTOK: could not set soft RLIMIT_NPROC up to the hard limit'
+                ret = False
+
+        if ( softnfiles < hardnfiles ):
+            try:
+                resource.setrlimit(resource.RLIMIT_NOFILE, (hardnfiles, hardnfiles))
+            except:
+                print 'NOTOK: could not set soft RLIMIT_NOFILES up to the hard limit'
+                ret = False
+
+        (softnproc , hardnproc)  = resource.getrlimit(resource.RLIMIT_NPROC)
+        (softnfiles, hardnfiles)  = resource.getrlimit(resource.RLIMIT_NOFILE)
+        
+        if ( softnproc < 20000 ):
+            print 'WARN: Soft limit RLIMIT_NPROC is too small (< 20000).  DUCC may be unable to create sufficient threads.'
+
+        if ( softnproc < 8192 ):
+            print 'WARN: Soft limit RLIMIT_NOFILES is too small (< 8192).  DUCC may be unable to open sufficient files or sockets.'
+
+        return ret
+
     def verify_jvm(self):
         jvm = self.java()
         CMD = jvm + ' -version > /dev/null 2>&1'

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc?rev=1525694&r1=1525693&r2=1525694&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/start_ducc Mon Sep 23 20:44:49 2013
@@ -28,7 +28,6 @@ from ducc_util import DuccUtil
 from ducc_base  import DuccProperties
 from local_hooks import verify_slave_node
 from local_hooks import verify_master_node
-from local_hooks import verify_master_node
 from ducc        import Ducc
 
 class StartDucc(DuccUtil):
@@ -318,6 +317,10 @@ class StartDucc(DuccUtil):
         if ( not ok ):
             sys.exit(1)
                 
+        if ( not self.verify_limits() ):
+            print "Limits too low to run DUCC"
+            sys.exit(1)
+        
         # activeMQ needs to be started externally before starting any DUCC processes
         if ( self.automanage and ('broker' in components) ):
             if ( self.is_amq_active() ):