You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by de...@apache.org on 2016/08/11 14:48:53 UTC

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

Author: degenaro
Date: Thu Aug 11 14:48:53 2016
New Revision: 1755999

URL: http://svn.apache.org/viewvc?rev=1755999&view=rev
Log:
UIMA-5052 check_ducc should complain if ssh is not viable

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

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=1755999&r1=1755998&r2=1755999&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/check_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/check_ducc Thu Aug 11 14:48:53 2016
@@ -75,7 +75,16 @@ class CheckDucc(DuccUtil):
 
         messages.append((' '))
         messages.append(('Checking', node, '...'))
-
+        
+        if(self.ssh_operational(node)):
+            text = "ssh is operational to "+node
+            #print text
+        else:
+            text = "ssh is NOT operational to "+node
+            print text
+            messages.append((spacer, text))
+            return messages
+            
         response = self.find_ducc_process(node)   # a tuple, (True|False, proclist)
         if ( not response[0] ):
             messages.append((spacer, "No response."))

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=1755999&r1=1755998&r2=1755999&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_util.py Thu Aug 11 14:48:53 2016
@@ -355,6 +355,18 @@ class DuccUtil(DuccBase):
         if ( showpid ) :
             print 'PID', ducc.pid
 
+    def ssh_operational(self, node):
+        is_operational = True
+        cmd = '/bin/hostname'
+        resp = self.popen('ssh -o BatchMode=yes -o ConnectTimeout=10', node, cmd)
+        line = resp.readline().strip()     
+        ssh_errors = self.ssh_ok(node, line)
+        if ( ssh_errors != None ):
+            is_operational = False
+#           for m in ssh_errors:
+#                print m
+        return is_operational
+
     # like popen, only it spawns via ssh
     # Skip use of ssh?
     # NOTE: Current callers always have do_wait True
@@ -487,6 +499,13 @@ class DuccUtil(DuccBase):
         if local != head:
             print ">>> ERROR - this script must be run from the head node"
             sys.exit(1);
+        node = head
+        if(self.ssh_operational(node)):
+            text = "ssh is operational to "+node
+            #print text
+        else:
+            print ">>> ERROR - this script cannot ssh to head node"
+            sys.exit(1);
 
     #
     # Verify the viability of ducc_ling.