You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by bu...@apache.org on 2019/09/05 22:53:18 UTC

svn commit: r1866493 - in /uima/uima-ducc/trunk: src/main/admin/ src/main/scripts/ uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/ uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/ uima-ducc-orchestrator/src/main/java/o...

Author: burn
Date: Thu Sep  5 22:53:18 2019
New Revision: 1866493

URL: http://svn.apache.org/viewvc?rev=1866493&view=rev
Log:
UIMA-6124 Many small changes simplifying the DuccHead master/backup determination

Added:
    uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/DuccHead.java   (with props)
Removed:
    uima/uima-ducc/trunk/src/main/admin/2.2_check_ducc
    uima/uima-ducc/trunk/src/main/admin/2.2_start_ducc
    uima/uima-ducc/trunk/src/main/admin/2.2_stop_ducc
    uima/uima-ducc/trunk/src/main/admin/ducc_head_mode.py
    uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/ADuccHead.java
    uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/DuccHead.java
    uima/uima-ducc/trunk/uima-ducc-pm/src/main/java/org/apache/uima/ducc/pm/DuccHead.java
    uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/DuccHead.java
    uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/DuccHead.java
    uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/DuccHead.java
Modified:
    uima/uima-ducc/trunk/src/main/admin/autostart.py
    uima/uima-ducc/trunk/src/main/admin/check_ducc
    uima/uima-ducc/trunk/src/main/admin/ducc.py
    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
    uima/uima-ducc/trunk/src/main/scripts/ducc_base.py
    uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/IDuccHead.java
    uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java
    uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/OrchestratorComponent.java
    uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ckpt/AOrchestratorCheckpoint.java
    uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbDuccWorks.java
    uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbOrchestratorProperties.java
    uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/jd/scheduler/JdScheduler.java
    uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/java/org/apache/uima/ducc/orchestrator/jd/scheduler/test/TestSuite.java
    uima/uima-ducc/trunk/uima-ducc-pm/src/main/java/org/apache/uima/ducc/pm/ProcessManagerComponent.java
    uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/ResourceManagerComponent.java
    uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/persistence/access/PersistenceAccess.java
    uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceManagerComponent.java
    uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java
    uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/JmxHelper.java
    uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
    uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java
    uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java
    uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java

Modified: uima/uima-ducc/trunk/src/main/admin/autostart.py
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/autostart.py?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/autostart.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/autostart.py Thu Sep  5 22:53:18 2019
@@ -279,7 +279,7 @@ class AutoStart(DuccUtil):
     
     def insert(self):
         python_script = os.path.join(self.DUCC_HOME,'admin','db_autostart_insert.py')
-        node = self.get_node_name()
+        node = self.localhost
         component = 'ag'
         cmd = [ python_script, '--host', node, '--name', component]
         text = str(cmd)
@@ -329,4 +329,4 @@ class AutoStart(DuccUtil):
 if __name__ == '__main__':
     instance = AutoStart()
     instance.main(sys.argv[1:])
-    
\ No newline at end of file
+    

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=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/check_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/check_ducc Thu Sep  5 22:53:18 2019
@@ -99,9 +99,10 @@ class CheckDucc(DuccUtil):
 
                 signal = self.kill_signal
                 
-                if(self.is_reliable_backup()):
-                    if ( component == 'agent' ):
-                        continue
+                # Don't kill agents if a backup node (kill has been disabled as stop_ducc should be used)
+                if (signal != None and not self.is_active() and component == 'agent' ):
+                    print 'Ignoring agent as not the master head node'
+                    continue
                     
                 if ( component == 'orchestrator' ):
                     component = 'or'
@@ -386,8 +387,8 @@ class CheckDucc(DuccUtil):
     
                     checked[node] = node
                     self.threadpool.invoke(self.check_node, node)
-            # check backup head node(s)
-            for node in self.get_head_node_list():
+            # check head node(s)
+            for node in self.head_nodes:
                 if(not node in checked):
                     checked[node] = node
                     self.threadpool.invoke(self.check_node, node)

Modified: uima/uima-ducc/trunk/src/main/admin/ducc.py
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/ducc.py?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc.py Thu Sep  5 22:53:18 2019
@@ -42,6 +42,10 @@ class Ducc(DuccUtil):
             print 'OK'
             return 
 
+        if (not self.automanage_database):
+            print 'Database is not automanaged; not starting it.'
+            return
+
         # check for the pid to see if the DB is running.
         if ( self.db_process_alive() ) :
             print 'Database is already running.'
@@ -107,10 +111,11 @@ class Ducc(DuccUtil):
             ' -DDUCC_BROKER_CREDENTIALS_FILE=' + broker_credentials + \
             ' ' + broker_memory_opts
         os.environ['ACTIVEMQ_HOME'] = broker_home
+        os.environ['ACTIVEMQ_DATA_DIR'] = self.DUCC_HOME + '/logs/' + self.localhost
 
         print 'ACTIVEMQ_OPTS:', os.environ['ACTIVEMQ_OPTS']
         print 'ACTIVEMQ_HOME:', os.environ['ACTIVEMQ_HOME']
-        
+        print 'ACTIVEMQ_DATA_DIR:', os.environ['ACTIVEMQ_DATA_DIR']
         self.verify_limits()
         
         here = os.getcwd()
@@ -139,15 +144,14 @@ class Ducc(DuccUtil):
 
         # ducc-head needs to be in system properties before the ducc daemon reads ducc.properties
         # to insure it can be substituted properly
-        ducc_head = self.ducc_properties.get('ducc.head')
         ducc_home = self.DUCC_HOME
         CLASSPATH = os.environ['CLASSPATH']
 
         jvm_opts = []
         jvm_opts.append('-Dos.page.size=' + self.os_pagesize)
-        jvm_opts.append('-Dducc.deploy.configuration=' + self.DUCC_HOME + '/resources/ducc.properties')
-        jvm_opts.append('-Dducc.head=' + ducc_head)
-        jvm_opts.append('-Dlog4j.configuration=file://' + self.DUCC_HOME + '/resources/log4j.xml')
+        jvm_opts.append('-Dducc.deploy.configuration=' + ducc_home + '/resources/ducc.properties')
+        jvm_opts.append('-Dducc.head=' + self.ducc_head)
+        jvm_opts.append('-Dlog4j.configuration=file://' + ducc_home + '/resources/log4j.xml')
 
         service = 'org.apache.uima.ducc.common.main.DuccService'
         for c in complist:
@@ -178,7 +182,7 @@ class Ducc(DuccUtil):
 
                     return
 
-                jvm_opts.append('-Djava.library.path=' + self.DUCC_HOME) 
+                jvm_opts.append('-Djava.library.path=' + ducc_home) 
                 if ( self.agent_jvm_args != None ):
                     jvm_opts.append(self.agent_jvm_args)
 
@@ -198,7 +202,7 @@ class Ducc(DuccUtil):
                 
             if ( c == 'ws' ):
                 here = os.getcwd()
-                os.chdir(self.DUCC_HOME + '/webserver')
+                os.chdir(ducc_home + '/webserver')
                 if ( self.ws_jvm_args != None ):
                     jvm_opts.append(self.ws_jvm_args)
                 self.add_to_classpath(ducc_home + '/webserver/lib/*')

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=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_util.py Thu Sep  5 22:53:18 2019
@@ -30,6 +30,7 @@ import resource
 import time
 import platform
 import httplib
+import socket
 
 from threading import *
 import traceback
@@ -196,7 +197,8 @@ class DuccUtil(DuccBase):
         merger = DUCC_HOME + '/admin/ducc_props_manager'
         CMD = [merger, '--merge', base_props, '--with', site_props, '--to', run_props]
         CMD = ' '.join(CMD)
-        print 'Merging', base_props, 'with', site_props, 'into', run_props
+        #print 'Merging', base_props, 'with', site_props, 'into', run_props
+        print 'Merging site properties into ducc.properties'
         os.system(CMD)
 
     def check_properties(self):
@@ -506,6 +508,7 @@ class DuccUtil(DuccBase):
                     return True
         return False        
 
+    # Set ACTIVEMQ_DATA_DIR the same as in start_broker to put the logs & pid with the daemon logs
     def stop_broker(self):
 
         broker_host = self.localhost
@@ -518,7 +521,8 @@ class DuccUtil(DuccBase):
         CMD = CMD + ' --jmxurl service:jmx:rmi:///jndi/rmi://' + broker_host + ':' + broker_jmx + '/jmxrmi' 
         CMD = CMD + ' ' + broker_name
         CMD = 'JAVA_HOME=' + self.java_home() + ' ' + CMD
-        print '--------------------', CMD
+        CMD = 'ACTIVEMQ_DATA_DIR=' + self.DUCC_HOME + '/logs/' + self.localhost + ' ' + CMD
+        print 'CMD:', CMD
         lines = self.ssh(broker_host, True, CMD)
         for l in lines:
             pass       # throw away junk from ssh
@@ -581,9 +585,6 @@ class DuccUtil(DuccBase):
         for line in lines:
             if(node in line):
                 return True
-        print 'not found: ', node
-        for line in lines:
-            print line
         if(verbosity):
             print 'ssh not operational - unexpected results from:', ssh_cmd
             for line in lines:
@@ -715,138 +716,26 @@ class DuccUtil(DuccBase):
             return False
         return True
     
-    # determine if string represent an integer
-    def is_int(self,string):
-        result = True
-        try:
-            number = int(string)
-        except:
-            result = False
-        return result
-    
-    # transform hostname into ip address
-    def get_ip_address(self,hostname):
-        label = 'get_ip_address'
-        result = None
-        try:
-            # get virtual ip address from keepalived.conf
-            result = self.get_virtual_ipaddress()
-            if(result == None):
-                # get virtual ip address from nameserver
-                p = subprocess.Popen(['/usr/bin/nslookup', hostname], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-                output, err = p.communicate()
-                #print hostname, output, err
-                name = None
-                for line in output.splitlines():
-                    tokens = line.split()
-                    if(len(tokens) == 2):
-                        t0 = tokens[0]
-                        t1 = tokens[1]
-                        if(t0 == 'Address:'):
-                            if(name != None):
-                                result = t1
-                                break
-                        elif(t0 == 'Name:'):
-                            name = t1
-        except Exception as e:
-            print e
-        debug(label, str(result))
-        return result
-    
-    # get ducc.head.reliable.list
-    def get_head_node_list(self):
-        head_node_list = []
-        # add ducc.head.reliable.list node(s)
-        ducc_head_list = self.ducc_properties.get("ducc.head.reliable.list")
-        if(ducc_head_list != None):
-            ducc_head_nodes = ducc_head_list.split()
-            if(len(ducc_head_nodes)== 0):
-                pass
-            elif(len(ducc_head_nodes)== 1):
-                print '>>> ERROR - "ducc.head.reliable.list" missing or invalid.'
-                sys.exit(1);
-            else:
-                head_node_list = ducc_head_nodes
-        return head_node_list
-    
-    # get all possible hostnames & ip addresses for a head node
-    def get_head_node_list_variations(self):
-        # start with ducc.head.reliable.list node(s)
-        head_node_list = self.get_head_node_list()
-        # add ducc.head node
-        ducc_head = self.ducc_properties.get("ducc.head")
-        if(ducc_head == None):
-            print '>>> ERROR - "ducc.head" missing or invalid.'
-            sys.exit(1);
-        ducc_head_nodes = ducc_head.split()
-        if(len(ducc_head_nodes) != 1):
-            print '>>> ERROR - "ducc.head" missing or invalid.'
-            sys.exit(1);
-        head_node = ducc_head_nodes[0]
-        if(not head_node in head_node_list):
-            head_node_list.append(head_node)
-        # add short names
-        list = head_node_list
-        for node in list:
-            short_name = node.split('.')[0]
-            if(not self.is_int(short_name)):
-                if(not short_name in head_node_list):
-                    head_node_list.append(short_name)
-        # add ip addresses
-        list = head_node_list
-        for node in list:
-            ip = self.get_ip_address(node)
-            if(ip != None):
-                if(not ip in head_node_list):
-                    head_node_list.append(ip)
-        #
-        debug('head_node_list: ', head_node_list)
-        return head_node_list
-    
-    # drop domain and whitespace
-    def normalize(self,name):
-        result = name
-        if(name != None):
-            result = name
-            result = result.strip()
-            result = result.split('.')[0]
-        return result
-    
-    # get current host's name
-    def get_node_name(self):
-        node_name = 'unknown'
-        cmd = '/bin/hostname'
-        resp = self.popen(cmd)
-        lines = resp.readlines()
-        if(len(lines)== 1):
-            name = lines[0]
-            node_name = self.normalize(name)
-        debug('node_name: ', node_name)
-        return node_name
-    
+    # Check if the node's name or ip matches one of the head nodes
     def is_head_node(self):
-        retVal = False
-        head_node_list = self.get_head_node_list_variations()
-        node = self.get_node_name()
-        if(node in head_node_list):
-            retVal = True
-        return retVal
+        head_node_list = self.head_nodes
+        node = self.localhost
+        if (node in head_node_list):
+            return True
+        node_ip = socket.gethostbyname(node)
+        for hnode in head_node_list:
+            if socket.gethostbyname(hnode) == node_ip:
+                return True
+        return False
     
-    # Exit if this is not the head node.  Ignore the domain as uname sometimes drops it.
+    # Exit if this is not a head node
     # Also check that ssh to this node works
     # Also restrict operations to the userid that installed ducc
     def verify_head(self):
-        head_node_list = self.get_head_node_list_variations()
-        node = self.get_node_name()
-        if(node in head_node_list):
-            pass
-        else:
-            ip = self.get_ip_address(node)
-            if(ip in head_node_list):
-                pass
-            else:
-                print ">>> ERROR - "+node+" not configured as head node."
-                sys.exit(1);
+        node = self.localhost
+        if (not self.is_head_node()):
+            print ">>> ERROR - " + node + " is not one of the configured head nodes " + str(self.head_nodes)
+            sys.exit(1);
         if(self.ssh_operational(node)):
             text = "ssh is operational to "+node
             #print text
@@ -1146,16 +1035,17 @@ class DuccUtil(DuccBase):
     def clean_shutdown(self):
         DUCC_JVM_OPTS = ' -Dducc.deploy.configuration=' + self.DUCC_HOME + "/resources/ducc.properties "
         DUCC_JVM_OPTS = DUCC_JVM_OPTS + ' -DDUCC_HOME=' + self.DUCC_HOME
-        DUCC_JVM_OPTS = DUCC_JVM_OPTS + ' -Dducc.head=' + self.ducc_properties.get('ducc.head')
+        DUCC_JVM_OPTS = DUCC_JVM_OPTS + ' -Dducc.head=' + self.ducc_head
         self.spawn(self.java(), DUCC_JVM_OPTS, 'org.apache.uima.ducc.common.main.DuccAdmin', '--killAll')
 
     def ducc_admin(self,option,target):
         DUCC_JVM_OPTS = ' -Dducc.deploy.configuration=' + self.DUCC_HOME + "/resources/ducc.properties "
         DUCC_JVM_OPTS = DUCC_JVM_OPTS + ' -DDUCC_HOME=' + self.DUCC_HOME
-        DUCC_JVM_OPTS = DUCC_JVM_OPTS + ' -Dducc.head=' + self.ducc_properties.get('ducc.head')
+        DUCC_JVM_OPTS = DUCC_JVM_OPTS + ' -Dducc.head=' + self.ducc_head
         java_class = 'org.apache.uima.ducc.common.main.DuccAdmin'
         cmd = self.java()+' '+DUCC_JVM_OPTS+' '+java_class+' '+option+' '+target
-        print cmd
+        debug('ducc_admin', cmd)
+        print 'ducc_admin: ', option, target
         self.spawn(self.java(), DUCC_JVM_OPTS, java_class, option, target)
         
     def get_os_pagesize(self):
@@ -1367,102 +1257,24 @@ class DuccUtil(DuccBase):
         use_threading = False
 
     def installed(self):
-        head = self.ducc_properties.get('ducc.head')
+        head = self.ducc_head
         if ( head == '<head-node>' ):
             return False
         return True
 
-    keepalived_conf = '/etc/keepalived/keepalived.conf'
-
-    def get_virtual_ipaddress(self):
-        state = 0
-        vip = None
-        if ( os.path.exists(self.keepalived_conf) ):
-            with open(self.keepalived_conf) as f:
-                for line in f:
-                    tokens = line.split(' ')
-                    if(tokens == None):
-                        pass
-                    elif(len(tokens) == 0):
-                        pass
-                    elif(tokens[0] == '!'):
-                        pass
-                    else:
-                        for token in tokens:
-                            token = token.strip()
-                            if(len(token) == 0):
-                                continue
-                            elif(token == '#'):
-                                break
-                            if(state == 0):
-                                if(token == 'virtual_ipaddress'):
-                                    state = 1
-                            elif(state == 1):
-                                if(token == '{'):
-                                    state = 2
-                            elif(state == 2):
-                                vip = token
-                                state = 3
-                            elif(state == 3):
-                                if(token == '}'):
-                                    state = 4
-                            else:
-                                pass
-        return vip
-
-    # eligible when keepalived config comprises the ip
-    def is_reliable_eligible(self, ip):
-        retVal = False
-        if ( os.path.exists(self.keepalived_conf) ):
-            with open(self.keepalived_conf) as f:
-                for line in f:
-                    if ip in line:
-                        retVal = True
-                        break
-        return retVal
-    
-    def is_valid_ip_address(self,address):
-        retVal = False
-        try:
-            list = address.split('.')
-            for item in list:
-                int(item)
-            retVal = True
-        except Exception as e:
-            pass
-        return retVal
-    
-    # master when current node keepalived answers for head node ip
-    # backup when current node keepalived does not answer for head ip, but is capable in config
-    # unspecified otherwise
-    def get_reliable_state(self):
-        label = 'get_reliable_state'
-        result = 'unspecified'
-        try:
-            ducc_head = self.ducc_properties.get('ducc.head')
-            if(self.is_valid_ip_address(ducc_head)):
-                head_ip = ducc_head
-            else:
-                head_ip = self.get_ip_address(ducc_head)
-            # Check if "reliable" ... i.e. ducc.head is the virtual ip in the keepalived conf file
-            # If so check if this node is connected to the virtual ip   
-            if(self.is_reliable_eligible(head_ip)):
-                text = 'cmd: ', '/sbin/ip', 'addr', 'list'
-                debug(label, text)
-                p = subprocess.Popen(['/sbin/ip', 'addr', 'list'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-                output, err = p.communicate()
-                text = "output: "+output
-                debug(label, text)
-                if(head_ip in output):
-                    result = 'master'
-                else:
-                    result = 'backup'
-        except Exception as e:
-            print e
-        return result
-    
-    def is_reliable_backup(self):
-        return self.get_reliable_state() == 'backup'
+    # Check if not reliable or if this is the currently active head node
+    # If reliable test if the ducc.head's IP address is one of our addresses
+    def is_active(self):
+        label = 'is_active'
+        if (not self.reliable):
+            return True
+        text = 'cmd: ', '/sbin/ip', 'addr', 'list'
+        debug(label, text)
+        p = subprocess.Popen(['/sbin/ip', 'addr', 'list'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        output, err = p.communicate()
+        debug(label, "output: "+output)
+        head_ip = socket.gethostbyname(self.ducc_head)
+        return (head_ip in output)
     
     def db_normalize_component(self,component):
         com = component
@@ -1515,6 +1327,7 @@ class DuccUtil(DuccBase):
         text = out
         debug(label,text)
     
+    # Line format is: <host>.<component>=<state>
     def _db_get_tuple(self,line):
         retVal = None
         try:
@@ -1562,24 +1375,28 @@ class DuccUtil(DuccBase):
         self.local_components = ['rm', 'pm', 'sm', 'or', 'ws', 'broker']
         self.default_nodefiles = [self.DUCC_HOME + '/resources/ducc.nodes']
 
-        if ( self.localhost == self.ducc_properties.get("ducc.head")):
-            self.is_ducc_head = True
+        # Get the only head node, or if  a "reliable" installation the virtual head node & all head nodes
+        self.ducc_head = self.ducc_properties.get('ducc.head')
+        ducc_head_list = self.ducc_properties.get('ducc.head.reliable.list')
+        if (ducc_head_list != None and len(string.strip(ducc_head_list)) != 0):
+            self.reliable = True
+            self.head_nodes = ducc_head_list.split()
+            if (len(self.head_nodes) <= 1):
+                print '>>> ERROR - "ducc.head.reliable.list" must be empty or have more than one entry'
+                sys.exit(1);
+        else:
+            self.reliable = False
+            self.head_nodes = [ self.ducc_head ]
 
         os.environ['DUCC_NODENAME'] = self.localhost    # to match java code's implicit property so script and java match
 
-        dbhost = self.get_db_host()
-        if ( dbhost == None ):
-            dbhost = self.ducc_properties.get('ducc.head')
-        if ( dbhost == None ):
-            dbhost = 'localhost'
-
-
         manage_database = self.ducc_properties.get('ducc.database.automanage')
         self.automanage_database = False
         if (manage_database in ('t', 'true', 'T', 'True')) :
             self.automanage_database = True     
-
-        if(manage_database):
+            dbhost = self.get_db_host()
+            if ( dbhost == None ):
+                dbhost = self.ducc_head
             dir_db_state = self.DUCC_HOME + '/state/database/'+dbhost
             self.makedirs(dir_db_state)
             self.db_pidfile = dir_db_state+ '/cassandra.pid'
@@ -1587,8 +1404,8 @@ class DuccUtil(DuccBase):
             self.makedirs(dir_db_logs)
             self.db_logfile = dir_db_logs + '/' + dbhost + '.cassandra.console'
         
-        self.pid_file_agents  = self.DUCC_HOME + '/state/agents/ducc.pids'
-        self.pid_file_daemons  = self.DUCC_HOME + '/state/daemons/'+self.get_node_name()+'/ducc.pids'
+        #self.pid_file_agents  = self.DUCC_HOME + '/state/agents/ducc.pids'
+        #self.pid_file_daemons  = self.DUCC_HOME + '/state/daemons/'+self.localhosty+'/ducc.pids'
         self.set_classpath()
         self.os_pagesize = self.get_os_pagesize()
         self.update_properties()

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=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/start_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/start_ducc Thu Sep  5 22:53:18 2019
@@ -28,7 +28,6 @@ import traceback
 
 from ducc_util import DuccUtil
 from properties import Properties
-from local_hooks import verify_slave_node
 from local_hooks import verify_master_node
 from ducc        import Ducc
 from ducc_util import ThreadPool
@@ -244,11 +243,6 @@ class StartDucc(DuccUtil):
         nodefiles = []
         components = []
         or_parms = self.ducc_properties.get('ducc.orchestrator.start.type')
-        #if(not self.is_reliable_backup()):
-        #    self.pids_agents = Properties()
-        #    self.pids_agents.load_if_exists(self.pid_file_agents)
-        #self.pids_daemons = Properties()
-        #self.pids_daemons.load_if_exists(self.pid_file_daemons)
         
         try:
             opts, args = getopt.getopt(argv, 'c:mn:sh?v', ['component=', 'help', 'nodelist=', 'cold', 'warm', 'nothreading'])
@@ -311,8 +305,8 @@ class StartDucc(DuccUtil):
 
         self.verify_required_directories()
 
+        # If this fails local_hooks.py should report the reason
         if ( not verify_master_node(self.ducc_properties) ):
-            print 'FAIL: Cannot run javac to run java verification'
             return
 
         # make sure all the nodefiles exist and are readable
@@ -340,9 +334,13 @@ class StartDucc(DuccUtil):
         if ( not self.verify_limits() ):
             print "Limits too low to run DUCC"
             sys.exit(1)
-        
-        if ( self.automanage_database ):
-            if ( 'db' in components ):
+
+        is_active_head_node = self.is_active();
+
+        if ( self.automanage_database and 'db' in components ):
+            if (not is_active_head_node):
+                print 'DB can only be automanaged from the active head node'
+            else:
                 try:
                     if ( not self.db_start() ):
                         print "Failed to start or connect to the database."
@@ -377,7 +375,7 @@ class StartDucc(DuccUtil):
             print 'ActiveMQ broker is required but cannot be found on', self.broker_host + ':' + self.broker_port
             sys.exit(1)
 
-        ducc = Ducc()
+        #ducc = Ducc()
     
         self.threadpool = ThreadPool(n_nodes + 5)      # a few more for the head processes
         #self.pidlock = threading.Lock()
@@ -394,8 +392,8 @@ class StartDucc(DuccUtil):
                         sys.exit(1)
                     # give 'or' a small head start
                     time.sleep(2)
-        
-        if(self.is_reliable_backup()):
+
+        if (not is_active_head_node):
             print '********** "backup" head node -> not starting agents'
         else:
             if n_nodes > 0:
@@ -425,12 +423,6 @@ class StartDucc(DuccUtil):
                         sys.exit(1)
 
         self.threadpool.quit()
-
-        #if(not self.is_reliable_backup()):
-        #    if ( len(self.pids_agents) > 0 ):
-        #        self.pids_agents.write(self.pid_file_agents)
-        #if ( len(self.pids_daemons) > 0 ):
-        #    self.pids_daemons.write(self.pid_file_daemons)
         return
 
 if __name__ == "__main__":

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=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/stop_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/stop_ducc Thu Sep  5 22:53:18 2019
@@ -29,7 +29,7 @@ features =  [ 'stop_ducc from head node
 
 import sys
 
-version_min = [2, 7]
+version_min = [2, 6]
 version_info = sys.version_info
 version_error = False
 if(version_info[0] < version_min[0]):
@@ -308,11 +308,11 @@ class StopDucc(DuccUtil):
     def head(self):
         text = str(self.args.head)
         debug(self._mn(),text)
-        # get list of tuples from DB: 
-        # [ host, component, state ]
+        # get list of tuples from DB:  [ host, component, state ]
+        # exclude non-automanged br & db & exclude db if not the active/master node
         db_list = self.get_db_list()
         list = []
-        this_node = self.get_node_name()
+        this_node = self.localhost
         for item in db_list:
             node = item[0]
             component = item[1]
@@ -321,6 +321,8 @@ class StopDucc(DuccUtil):
             if(component == self.n_db):
                 if(not self.automanage_database):
                     continue
+                if (not self.is_active()):
+                    continue
             if(component == self.n_br):
                 if(not self.automanage_broker):
                     continue
@@ -381,7 +383,7 @@ class StopDucc(DuccUtil):
         for c in self.args.component:
             parts = c.split('@')
             if len(parts) == 1:
-                dn = self.get_node_name()
+                dn = self.localhost
                 dc = parts[0]
             elif len(parts) == 2:
                 dn = parts[1]
@@ -436,11 +438,20 @@ class StopDucc(DuccUtil):
     
     # validate user specified list
     def validate_list(self,list):
+        is_backup = not self.is_active()
         for item in list:
             node = item[0]
             component = item[1]
             self.validate_automanage(component)
             self.validate_db(node, component)
+            if (component == 'ag' and is_backup):
+                msg = 'cannot stop agents from the backup node.'
+                output(msg)
+                self._exit()
+            if (component == 'db' and is_backup):
+                msg = 'cannot stop database from the backup node.'
+                output(msg)
+                self._exit()
     
     # in: tuples of (component,pid,user) and a desired component
     # out: the pid of the desired component, if found 
@@ -459,12 +470,11 @@ class StopDucc(DuccUtil):
         return pid
     
     def acct_stop(self,node,component):
-        print 'db_acct_stop: '+component+'@'+node
+        print 'db_acct: Stopped '+component+'@'+node
         self.db_acct_stop(node,component)
         
     # target=kill
     def kill(self,count,tid,node,component,signal):
-        self.acct_stop(node,component)
         verbosity=False
         ssh = self.ssh_operational(node,verbosity)
         state = 'state=pending'
@@ -484,6 +494,7 @@ class StopDucc(DuccUtil):
                     process='pid='+str(pid)+' '
             else:
                 state='state=find DUCC process failed'
+            self.acct_stop(node,component)
         else:
             state = 'state=ssh failure'
         msg = pfx+process+state
@@ -512,7 +523,7 @@ class StopDucc(DuccUtil):
     def filter_remote_head(self,list):
         list_remote_head = []
         list_remainder = []
-        this_node = self.get_node_name()
+        this_node = self.localhost
         for item in list:
             node = item[0]
             com = item[1]
@@ -534,58 +545,41 @@ class StopDucc(DuccUtil):
         if(len(list_remote_head)>0):
             signal = self.sig15
             self.kill_threads(list_remote_head, signal)
-        # update database + build admin string
-        admin = ''
+        # stop the local daemons
         stop_db = False
         stop_broker = False
-        # pass 1 remove db,br
+        # pass 1 - stop all but broker & database 
         for item in list:
             node = item[0]
             com = item[1]
+            state = item[2]
+            if (item[2] == 'Stop'):
+                print 'WARN: '+com+' already recorded as stopped'
             # Use the short names for DB recording but the external long names for DuccAdmin
-            self.acct_stop(node,com)
             component = self.longname[com]
             if(component == self.c_broker):
                 stop_broker = True
                 continue
-            elif(component == self.c_database):
+            if(component == self.c_database):
                 stop_db = True
                 continue
-            else:
-                admin = admin+component+'@'+node+' '
-        # issue command
-        admin = admin.split()
-        for item in admin:
+            item = component+'@'+node
             if(qflag):
-                print 'quiesce: '+item
                 self.ducc_admin('--quiesce',item)
             else:
-                print 'stop: '+item
                 self.ducc_admin('--stop',item)
-        # stop broker
+            self.acct_stop(node,com)
+
+        # Finally stop broker & database if requested
+        node = self.localhost
         if(stop_broker):
-            print 'stop: broker'
+            print 'Stopping: broker'
             self.stop_broker()
-        # stop database
+            self.acct_stop(node,self.c_br)
         if(stop_db):
-            print 'stop: database'
+            print 'Stopping: database'
             self.db_stop()
-    
-    # only agent component allowed
-    def agent_only(self,list):
-        for item in list:
-            component = item[1]
-            if(component != self.n_ag):
-                'invalid component='+component
-                self._exit()
-            
-    # if this command is not running from a head node, 
-    # then complain and exit
-    def enforce_location_limits(self,list):
-        if(not self.is_head_node()):
-            msg = 'cannot run from non-head node.'
-            output(msg)
-            self._exit()
+            self.acct_stop(node,self.c_db)
     
     # multi-thread lock to obtain thread id
     lock_tid = Lock()
@@ -609,6 +603,9 @@ class StopDucc(DuccUtil):
     
     # main
     def main(self,argv):
+        if(not self.is_head_node()):
+            output('Must be run from a head node.')
+            self._exit()
         self.get_args()
         self.threads_prep()
         # get list of nodes+daemons
@@ -626,10 +623,9 @@ class StopDucc(DuccUtil):
             self._help()
         text = str(list)
         debug(self._mn(),text)
-        # disallow br/db unless DUCC managed
+        # disallow br & db unless DUCC managed and db & agents if not the master
         self.validate_list(list)
-        # allow only from head node, except for stop of local agent
-        self.enforce_location_limits(list)
+    
         # perform action
         if(self.args.kill):
             signal = self.sig9

Modified: uima/uima-ducc/trunk/src/main/scripts/ducc_base.py
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/scripts/ducc_base.py?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/scripts/ducc_base.py (original)
+++ uima/uima-ducc/trunk/src/main/scripts/ducc_base.py Thu Sep  5 22:53:18 2019
@@ -37,8 +37,10 @@ def find_ducc_home():
     DUCC_HOME = me[:ndx]          # split from 0 to ndx
     return DUCC_HOME
 
+# Get the name of the node --- note that some os.uname's return the fullname 
 def find_localhost():
-    return os.uname()[1]                
+    name = os.uname()[1]
+    return name.split('.')[0]
 
 def which(file):
     for p in os.environ["PATH"].split(":"):

Added: uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/DuccHead.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/DuccHead.java?rev=1866493&view=auto
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/DuccHead.java (added)
+++ uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/DuccHead.java Thu Sep  5 22:53:18 2019
@@ -0,0 +1,192 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+*/
+package org.apache.uima.ducc.common.head;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.uima.ducc.common.utils.DuccLogger;
+import org.apache.uima.ducc.common.utils.DuccPropertiesResolver;
+
+public class DuccHead implements IDuccHead {
+
+  private static IDuccHead instance = new DuccHead();
+  
+  public static IDuccHead getInstance() {
+    return instance;
+  }
+  
+  private DuccLogger logger = null;
+
+  private AtomicBoolean isActive = new AtomicBoolean(true);
+
+  private String duccHeadIp = "unknown";
+
+  private boolean reliable = false;
+  
+  /*
+   * create instance of this class
+   */
+  public DuccHead() {
+    logger = DuccLogger.getLogger(DuccHead.class);
+    init();
+  }
+
+  /*
+   * initialize
+   */
+  private void init() {
+    String location = "init";
+
+    // Assume reliable if alternative head nodes specified
+    // If the keepalived configuration is incorrect it will always be "backup"
+    DuccPropertiesResolver dpr = DuccPropertiesResolver.getInstance();
+    reliable = dpr.getProperty(DuccPropertiesResolver.ducc_head_reliable_list).trim().length() > 0;
+
+    if (reliable) {
+      String duccHead = dpr.getProperty(DuccPropertiesResolver.ducc_head);
+      try {
+        InetAddress inetAddress = InetAddress.getByName(duccHead);
+        duccHeadIp = inetAddress.getHostAddress();
+      } catch (UnknownHostException e) {
+        logger.error(location, null, "No IP address found for: " + duccHead);
+      }
+      isActive.set(isVirtualMaster());
+    }
+
+    logger.info(location, null, "Initial state: ", reliable ? (isActive.get() ? "MASTER" : "BACKUP") : "not reliable (single head node)");
+  }
+
+  /* 
+   * true if a "reliable" installation, i.e. multiple head nodes
+   */
+  public boolean isReliable() {
+    return reliable;
+  }
+
+  /*
+   * true if this node is currently in charge 
+   * i.e. is the only head node or is the master in a multi-head installation
+   */
+  public boolean isActive() {
+    return isActive.get();
+  }
+
+  /*
+   * get ducc head mode state { result expected is "master" or "backup" or "unspecified"}
+   */
+  @Override
+  public String get_ducc_head_mode() {
+    return !isReliable() ? "unspecified" : (isActive() ? "master" : "backup");
+  }
+
+  /*
+   * true if "master" or "backup"
+   */
+  @Override
+  public boolean is_ducc_head_reliable() {
+    return isReliable();
+  }
+
+  /*
+   * true if "master"
+   */
+  @Override
+  public boolean is_ducc_head_master() {
+    return isReliable() && isActive();
+  }
+
+  /*
+   * true if "master" or single-head-node
+   */
+  @Override
+  public boolean is_ducc_head_virtual_master() {
+    return isActive();
+  }
+
+  /*
+   * true if "backup"
+   */
+  @Override
+  public boolean is_ducc_head_backup() {
+    return !isActive();
+  }
+
+  /*
+   * Check if a transition has occurred. 
+   * Called when a daemon receives a publication that it should act on or ignore. 
+   * This is the only place the master/backup state is updated after initialization.
+   */
+  @Override
+  public DuccHeadTransition transition() {
+    if (!reliable) {
+      return DuccHeadTransition.unspecified;
+    }
+    boolean prev = isActive.get();
+    boolean curr = isVirtualMaster();
+    if (curr == prev) {
+      return curr ? DuccHeadTransition.master_to_master : DuccHeadTransition.backup_to_backup;
+    } else {
+      isActive.set(curr);
+      logger.info("transition", null, "Switching to", curr ? "MASTER" : "BACKUP");
+      return curr ? DuccHeadTransition.backup_to_master : DuccHeadTransition.master_to_backup;
+    }
+  }
+
+  /*
+   * For a reliable installation check if the virtual IP address currently belongs to this node
+   */
+  private boolean isVirtualMaster() {
+    String[] cmd = { "/sbin/ip", "addr", "list" };
+    String result = runCmd(cmd);
+    return result.contains(duccHeadIp);
+  }
+
+  /*
+   * execute a system command
+   */
+  private String runCmd(String[] command) {
+    String location = "runCmd";
+    String retVal = null;
+    try {
+      ProcessBuilder pb = new ProcessBuilder(command);
+      Process p = pb.start();
+      InputStream pOut = p.getInputStream();
+      InputStreamReader isr = new InputStreamReader(pOut);
+      BufferedReader br = new BufferedReader(isr);
+      String line;
+      StringBuffer sb = new StringBuffer();
+      while ((line = br.readLine()) != null) {
+        sb.append(line);
+        logger.debug(location, null, line);
+      }
+      retVal = sb.toString();
+      int rc = p.waitFor();
+      logger.debug(location, null, rc);
+    } catch (Exception e) {
+      logger.error(location, null, e);
+    }
+    return retVal;
+  }
+
+}

Propchange: uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/DuccHead.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/IDuccHead.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/IDuccHead.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/IDuccHead.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/head/IDuccHead.java Thu Sep  5 22:53:18 2019
@@ -41,7 +41,6 @@ public interface IDuccHead {
 	};
 	
 	public String get_ducc_head_mode();
-	public boolean is_ducc_head_unspecified();
 	public boolean is_ducc_head_reliable();
 	public boolean is_ducc_head_master();
 	public boolean is_ducc_head_virtual_master();

Modified: uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccPropertiesResolver.java Thu Sep  5 22:53:18 2019
@@ -82,7 +82,9 @@ public class DuccPropertiesResolver {
     }
     
     public static final String ducc_head = "ducc.head";
-    
+
+    public static final String ducc_head_reliable_list = "ducc.head.reliable.list";    
+
     public static final String ducc_security_home = "ducc.security.home";
     
     public static final String ducc_private_resources = "ducc.private.resources";

Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/OrchestratorComponent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/OrchestratorComponent.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/OrchestratorComponent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/OrchestratorComponent.java Thu Sep  5 22:53:18 2019
@@ -40,6 +40,7 @@ import org.apache.uima.ducc.common.boot.
 import org.apache.uima.ducc.common.component.AbstractDuccComponent;
 import org.apache.uima.ducc.common.crypto.Crypto;
 import org.apache.uima.ducc.common.crypto.CryptoException;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead.DuccHeadState;
 import org.apache.uima.ducc.common.head.IDuccHead.DuccHeadTransition;

Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ckpt/AOrchestratorCheckpoint.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ckpt/AOrchestratorCheckpoint.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ckpt/AOrchestratorCheckpoint.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/ckpt/AOrchestratorCheckpoint.java Thu Sep  5 22:53:18 2019
@@ -20,12 +20,12 @@ package org.apache.uima.ducc.orchestrato
 
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.internationalization.Messages;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.DuccPropertiesResolver;
 import org.apache.uima.ducc.common.utils.id.DuccId;
-import org.apache.uima.ducc.orchestrator.DuccHead;
 import org.apache.uima.ducc.orchestrator.OrchestratorCommonArea;
 
 public abstract class AOrchestratorCheckpoint {

Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbDuccWorks.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbDuccWorks.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbDuccWorks.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbDuccWorks.java Thu Sep  5 22:53:18 2019
@@ -20,12 +20,12 @@ package org.apache.uima.ducc.orchestrato
 
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.persistence.or.ITypedProperties;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.id.DuccId;
 import org.apache.uima.ducc.database.DbDuccWorks;
-import org.apache.uima.ducc.orchestrator.DuccHead;
 
 /**
  * Class for logging purposes only.

Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbOrchestratorProperties.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbOrchestratorProperties.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbOrchestratorProperties.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/database/OrDbOrchestratorProperties.java Thu Sep  5 22:53:18 2019
@@ -20,11 +20,11 @@ package org.apache.uima.ducc.orchestrato
 
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.id.DuccId;
 import org.apache.uima.ducc.database.DbOrchestratorProperties;
-import org.apache.uima.ducc.orchestrator.DuccHead;
 
 /**
  * Class for logging purposes only.

Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/jd/scheduler/JdScheduler.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/jd/scheduler/JdScheduler.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/jd/scheduler/JdScheduler.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/main/java/org/apache/uima/ducc/orchestrator/jd/scheduler/JdScheduler.java Thu Sep  5 22:53:18 2019
@@ -31,11 +31,11 @@ import org.apache.uima.ducc.common.NodeI
 import org.apache.uima.ducc.common.SizeBytes;
 import org.apache.uima.ducc.common.db.DbQuery;
 import org.apache.uima.ducc.common.db.IDbMachine;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.TimeStamp;
 import org.apache.uima.ducc.common.utils.id.DuccId;
-import org.apache.uima.ducc.orchestrator.DuccHead;
 import org.apache.uima.ducc.orchestrator.OrchestratorCommonArea;
 import org.apache.uima.ducc.orchestrator.ReservationFactory;
 import org.apache.uima.ducc.orchestrator.StateManager;

Modified: uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/java/org/apache/uima/ducc/orchestrator/jd/scheduler/test/TestSuite.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/java/org/apache/uima/ducc/orchestrator/jd/scheduler/test/TestSuite.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/java/org/apache/uima/ducc/orchestrator/jd/scheduler/test/TestSuite.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-orchestrator/src/test/java/org/apache/uima/ducc/orchestrator/jd/scheduler/test/TestSuite.java Thu Sep  5 22:53:18 2019
@@ -29,11 +29,11 @@ import java.util.Random;
 
 import org.apache.uima.ducc.common.NodeIdentity;
 import org.apache.uima.ducc.common.SizeBytes;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.main.DuccService;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.id.DuccId;
-import org.apache.uima.ducc.orchestrator.DuccHead;
 import org.apache.uima.ducc.orchestrator.ckpt.OrchestratorCheckpoint;
 import org.apache.uima.ducc.orchestrator.jd.scheduler.JdHostProperties;
 import org.apache.uima.ducc.orchestrator.jd.scheduler.JdReservation;

Modified: uima/uima-ducc/trunk/uima-ducc-pm/src/main/java/org/apache/uima/ducc/pm/ProcessManagerComponent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-pm/src/main/java/org/apache/uima/ducc/pm/ProcessManagerComponent.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-pm/src/main/java/org/apache/uima/ducc/pm/ProcessManagerComponent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-pm/src/main/java/org/apache/uima/ducc/pm/ProcessManagerComponent.java Thu Sep  5 22:53:18 2019
@@ -28,6 +28,7 @@ import org.apache.uima.ducc.common.NodeI
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties.DaemonName;
 import org.apache.uima.ducc.common.component.AbstractDuccComponent;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead.DuccHeadState;
 import org.apache.uima.ducc.common.head.IDuccHead.DuccHeadTransition;
@@ -237,7 +238,7 @@ implements ProcessManager {
       
       
 		DuccHeadTransition dh_transition = getDuccHead().transition();
-		logger.info(methodName, jobid, dh_transition);
+		//logger.info(methodName, jobid, dh_transition);
 		switch(dh_transition) {
 		case master_to_backup:
 			stateChange(EventType.SWITCH_TO_BACKUP);

Modified: uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/ResourceManagerComponent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/ResourceManagerComponent.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/ResourceManagerComponent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/ResourceManagerComponent.java Thu Sep  5 22:53:18 2019
@@ -37,6 +37,7 @@ import org.apache.uima.ducc.common.admin
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties.DaemonName;
 import org.apache.uima.ducc.common.component.AbstractDuccComponent;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead.DuccHeadTransition;
 import org.apache.uima.ducc.common.main.DuccService;

Modified: uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/persistence/access/PersistenceAccess.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/persistence/access/PersistenceAccess.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/persistence/access/PersistenceAccess.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-rm/src/main/java/org/apache/uima/ducc/rm/persistence/access/PersistenceAccess.java Thu Sep  5 22:53:18 2019
@@ -20,6 +20,7 @@ package org.apache.uima.ducc.rm.persiste
 
 import java.util.Map;
 
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.persistence.rm.IDbJob;
 import org.apache.uima.ducc.common.persistence.rm.IDbShare;
@@ -28,7 +29,6 @@ import org.apache.uima.ducc.common.persi
 import org.apache.uima.ducc.common.persistence.rm.RmPersistenceFactory;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.id.DuccId;
-import org.apache.uima.ducc.rm.DuccHead;
 import org.apache.uima.ducc.rm.scheduler.SchedConstants;
 
 public class PersistenceAccess implements IPersistenceAccess {

Modified: uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceManagerComponent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceManagerComponent.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceManagerComponent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-sm/src/main/java/org/apache/uima/ducc/sm/ServiceManagerComponent.java Thu Sep  5 22:53:18 2019
@@ -36,6 +36,7 @@ import org.apache.uima.ducc.common.boot.
 import org.apache.uima.ducc.common.component.AbstractDuccComponent;
 import org.apache.uima.ducc.common.crypto.Crypto;
 import org.apache.uima.ducc.common.db.DbHelper;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead.DuccHeadTransition;
 import org.apache.uima.ducc.common.main.DuccService;

Modified: uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/WebServerComponent.java Thu Sep  5 22:53:18 2019
@@ -30,6 +30,7 @@ import org.apache.uima.ducc.common.boot.
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties.DaemonName;
 import org.apache.uima.ducc.common.component.AbstractDuccComponent;
 import org.apache.uima.ducc.common.config.CommonConfiguration;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead.DuccHeadTransition;
 import org.apache.uima.ducc.common.internationalization.Messages;

Modified: uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/JmxHelper.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/JmxHelper.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/JmxHelper.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/helper/JmxHelper.java Thu Sep  5 22:53:18 2019
@@ -73,7 +73,7 @@ public abstract class JmxHelper {
 			logger.debug(location, jobid, id);
 		}
 		catch(Exception e) {
-			logger.error(location, jobid, e);
+			logger.warn(location, jobid, e.toString(), "failed to connect to", url);
 			throw e;
 		}
 		
@@ -103,6 +103,8 @@ public abstract class JmxHelper {
 			o = mbsc.getAttribute(new ObjectName("java.lang:type=Runtime"), "Name");
 		} 
 		catch(Exception e) {
+		  // TODO this happens every time?? because of the later disconnect ??
+		  logger.debug("getJmxData", jobid, this.getClass().getSimpleName(), "Failed to get Jmx data containing the PID -", e.toString());
 			connect();
 			mbsc = getMBSC();
 			o = mbsc.getAttribute(new ObjectName("java.lang:type=Runtime"), "Name");

Modified: uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandler.java Thu Sep  5 22:53:18 2019
@@ -49,6 +49,7 @@ import org.apache.uima.ducc.common.SizeB
 import org.apache.uima.ducc.common.SizeBytes.Type;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties.DaemonName;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.internationalization.Messages;
 import org.apache.uima.ducc.common.jd.files.IWorkItemState;
@@ -88,7 +89,6 @@ import org.apache.uima.ducc.transport.ev
 import org.apache.uima.ducc.ws.DuccDaemonsData;
 import org.apache.uima.ducc.ws.DuccData;
 import org.apache.uima.ducc.ws.DuccDataHelper;
-import org.apache.uima.ducc.ws.DuccHead;
 import org.apache.uima.ducc.ws.DuccMachinesData;
 import org.apache.uima.ducc.ws.MachineInfo;
 import org.apache.uima.ducc.ws.authentication.DuccAsUser;
@@ -3402,6 +3402,9 @@ public class DuccHandler extends DuccAbs
 	private void handleDuccServletClusterReliableStatus(String target,Request baseRequest,HttpServletRequest request,HttpServletResponse response)
 	throws IOException, ServletException
 	{
+	  if (!dh.is_ducc_head_reliable()) {   // Omit label if not reliable
+	    return;
+	  }
 		String methodName = "handleDuccServletClusterReliableStatus";
 		duccLogger.trace(methodName, null, messages.fetch("enter"));
 		StringBuffer sb = new StringBuffer();
@@ -3424,6 +3427,9 @@ public class DuccHandler extends DuccAbs
 	private void handleDuccServletClusterReliableLabel(String target,Request baseRequest,HttpServletRequest request,HttpServletResponse response)
 	throws IOException, ServletException
 	{
+	  if (!dh.is_ducc_head_reliable()) {   // Omit label if not reliable
+	    return;
+	  }
 		String methodName = "handleDuccServletClusterReliableLabel";
 		duccLogger.trace(methodName, null, messages.fetch("enter"));
 		StringBuffer sb = new StringBuffer();

Modified: uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerClassic.java Thu Sep  5 22:53:18 2019
@@ -43,6 +43,7 @@ import org.apache.uima.ducc.common.SizeB
 import org.apache.uima.ducc.common.SizeBytes.Type;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties.DaemonName;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.internationalization.Messages;
 import org.apache.uima.ducc.common.utils.ComponentHelper;
@@ -69,7 +70,6 @@ import org.apache.uima.ducc.transport.ev
 import org.apache.uima.ducc.ws.Distiller;
 import org.apache.uima.ducc.ws.DuccDaemonsData;
 import org.apache.uima.ducc.ws.DuccData;
-import org.apache.uima.ducc.ws.DuccHead;
 import org.apache.uima.ducc.ws.DuccMachinesData;
 import org.apache.uima.ducc.ws.DuccMachinesDataHelper;
 import org.apache.uima.ducc.ws.Info;
@@ -1495,15 +1495,16 @@ public class DuccHandlerClassic extends
 				else {
 					status = DuccHandlerUtils.down();
 				}
-				if(DuccPropertiesHelper.isDatabaseAutomanaged()) {
+				// Get DB host list or wsName if the DB host is the same 
+				hostName = useWS(wsHostName, databaseHelper.getHostListString());
+				if(DuccPropertiesHelper.isDatabaseAutomanaged() && hostName.equals(wsHostName)) {
 					bootTime = getTimeStamp(DuccCookies.getDateStyle(request),databaseHelper.getStartTime());
-					hostName = useWS(wsHostName, databaseHelper.getHostListString());
 					hostIP = useWS(wsHostName, hostName, wsHostIP);
 					pid = ""+databaseHelper.getPID();
 				}
 				else {
+				  // Not automanaged or not on the same node as the WS
 					bootTime = "-";
-					hostName = useWS(wsHostName, databaseHelper.getHostListString());
 					String[] hostList = hostName.split("\\s+");
 					String[] ipList = InetHelper.getIP(hostList);
 					StringBuffer sbuf = new StringBuffer();

Modified: uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerJsonFormat.java Thu Sep  5 22:53:18 2019
@@ -43,6 +43,7 @@ import org.apache.uima.ducc.common.SizeB
 import org.apache.uima.ducc.common.SizeBytes.Type;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties;
 import org.apache.uima.ducc.common.boot.DuccDaemonRuntimeProperties.DaemonName;
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.internationalization.Messages;
 import org.apache.uima.ducc.common.utils.ComponentHelper;
@@ -71,7 +72,6 @@ import org.apache.uima.ducc.transport.ev
 import org.apache.uima.ducc.ws.Distiller;
 import org.apache.uima.ducc.ws.DuccDaemonsData;
 import org.apache.uima.ducc.ws.DuccData;
-import org.apache.uima.ducc.ws.DuccHead;
 import org.apache.uima.ducc.ws.DuccMachinesData;
 import org.apache.uima.ducc.ws.DuccMachinesDataHelper;
 import org.apache.uima.ducc.ws.Info;

Modified: uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java
URL: http://svn.apache.org/viewvc/uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java?rev=1866493&r1=1866492&r2=1866493&view=diff
==============================================================================
--- uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java (original)
+++ uima/uima-ducc/trunk/uima-ducc-web/src/main/java/org/apache/uima/ducc/ws/server/DuccHandlerViz.java Thu Sep  5 22:53:18 2019
@@ -24,11 +24,11 @@ import javax.servlet.ServletException;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import org.apache.uima.ducc.common.head.DuccHead;
 import org.apache.uima.ducc.common.head.IDuccHead;
 import org.apache.uima.ducc.common.internationalization.Messages;
 import org.apache.uima.ducc.common.utils.DuccLogger;
 import org.apache.uima.ducc.common.utils.id.DuccId;
-import org.apache.uima.ducc.ws.DuccHead;
 import org.apache.uima.ducc.ws.server.nodeviz.NodeViz;
 import org.eclipse.jetty.server.Request;