Author: burn
Date: Wed Jun 29 20:15:19 2016
New Revision: 1750712

URL: http://svn.apache.org/viewvc?rev=1750712&view=rev
Log:
UIMA-4994 Also restrict check_ducc to head-only; ignore domain part of node 
names

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

Modified: uima/uima-ducc/trunk/src/main/admin/check_ducc
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/check_ducc?rev=1750712&r1=1750711&r2=1750712&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/check_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/check_ducc Wed Jun 29 20:15:19 2016
@@ -196,6 +196,8 @@ class CheckDucc(DuccUtil):
     
     def main(self, argv):
 
+        self.verify_head()
+
         try:
             opts, args = getopt.getopt(argv, 'cikn:opqx:h?v', 
['configuration', 'nodelist=', 'int', 'quit', 'kill', 'pids', 'verbose', 
'nothreading', ])
         except:

Modified: uima/uima-ducc/trunk/src/main/admin/ducc_util.py
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/ducc_util.py?rev=1750712&r1=1750711&r2=1750712&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_util.py Wed Jun 29 20:15:19 2016
@@ -468,8 +468,13 @@ class DuccUtil(DuccBase):
             return False
         return True
 
+    # Exit if this is not the head node.  Ignore the domain as uname sometimes 
drops it.
     def verify_head(self):
-        return ( self.localhost == self.ducc_properties.get("ducc.head"))
+        head = self.ducc_properties.get("ducc.head").split('.')[0]
+        local = self.localhost.split('.')[0]
+        if local != head:
+            print ">>> ERROR - this script must be run from the head node"
+            sys.exit(1);
 
     #
     # Verify the viability of ducc_ling.

Modified: uima/uima-ducc/trunk/src/main/admin/start_ducc
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/start_ducc?rev=1750712&r1=1750711&r2=1750712&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/start_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/start_ducc Wed Jun 29 20:15:19 2016
@@ -221,9 +221,7 @@ class StartDucc(DuccUtil):
     
     def main(self, argv):
 
-        if ( not self.verify_head() ):
-            print ">>> ERROR - this script must be run from the head node"
-            sys.exit(1);
+        self.verify_head()
 
         if ( not self.verify_jvm() ):
             sys.exit(1);

Modified: uima/uima-ducc/trunk/src/main/admin/stop_ducc
URL: 
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/stop_ducc?rev=1750712&r1=1750711&r2=1750712&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/stop_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/stop_ducc Wed Jun 29 20:15:19 2016
@@ -168,9 +168,7 @@ class StopDucc(DuccUtil):
     
     def main(self, argv):
 
-        if ( not self.verify_head() ):
-            print ">>> ERROR - this script must be run from the head node"
-            sys.exit(1);
+        self.verify_head()
 
         if ( len(argv) == 0 ):
             self.usage(None)
@@ -210,7 +208,7 @@ class StopDucc(DuccUtil):
             elif ( o == '-v' ) :
                 print self.version()
                 sys.exit(0)
-            elif ( o == '-h'):
+            elif o in ( '-h', '--help' ):
                self.usage(None)
             elif ( o == '-?'):
                self.usage(None)


Reply via email to