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 2014/07/03 17:16:25 UTC

svn commit: r1607670 - in /uima/sandbox/uima-ducc/trunk: src/main/scripts/ducc_base.py uima-ducc-examples/src/main/scripts/stop_sim

Author: burn
Date: Thu Jul  3 15:16:24 2014
New Revision: 1607670

URL: http://svn.apache.org/r1607670
Log:
UIMA-3935 Stop the broker if stopping all daemons.  Drop the --instances arg as --components handles all

Modified:
    uima/sandbox/uima-ducc/trunk/src/main/scripts/ducc_base.py
    uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/stop_sim

Modified: uima/sandbox/uima-ducc/trunk/src/main/scripts/ducc_base.py
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/scripts/ducc_base.py?rev=1607670&r1=1607669&r2=1607670&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/scripts/ducc_base.py (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/scripts/ducc_base.py Thu Jul  3 15:16:24 2014
@@ -198,7 +198,7 @@ class DuccBase:
         return self.jvm_home
         
     def version(self):
-        lines = self.popen(self.jvm, ' org.apache.uima.ducc.utils.Version')
+        lines = self.popen(self.jvm, ' org.apache.uima.ducc.common.utils.Version')
         line = lines.readline().strip()
         return "DUCC Version", line
         

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/stop_sim
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/stop_sim?rev=1607670&r1=1607669&r2=1607670&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/stop_sim (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/stop_sim Thu Jul  3 15:16:24 2014
@@ -63,11 +63,7 @@ class StopSim(DuccUtil):
         print ""
         print "Options:"
         print "   -c --component compenent name"
-        print "        The name is one of", self.default_components, "or an ID from sim.pids or the nodelist"
-        print "        that was used to start DUCC"
-        print ""
-        print "   -i --instance instancid"  
-        print "        Sends SIGINT to the indicated process, enabling orderly shutdown."
+        print "        The name is one of", self.default_components, "or an ID from sim.pids"
         print ""
         print "   -k --kill"
         print "        Sends SIGKILL to the indicated process"
@@ -84,6 +80,9 @@ class StopSim(DuccUtil):
         print "   -v, --version"
         print "        Print the current DUCC version"
         print ""
+        print "   -?,  -h, --help,"
+        print "        Print this"
+        print ""
         sys.exit(1) 
             
 
@@ -102,16 +101,15 @@ class StopSim(DuccUtil):
         components = []
         instances = []
         signal = '-INT'
+        stopbroker = False
 
         try:
-            opts, args = getopt.getopt(argv, 'c:i:kprvh?', ['component=', 'instance=', 'kill' 'pause', 'resume','nothreading', 'version'])
+            opts, args = getopt.getopt(argv, 'c:kprvh?', ['component=', 'kill' 'pause', 'resume', 'nothreading', 'version', 'help'])
         except:
             self.invalid('Invalid arguments', ' '.join(argv))
                   
         for ( o, a ) in opts:
-            if o in ( '-i', '--instance' ):
-                instances.append(a)
-            elif o in ( '-c', '--component' ):
+            if o in ( '-c', '--component' ):
                 instances.append(a)
             elif o in ( '-k', '--kill' ):
                 signal = '-KILL'
@@ -143,14 +141,21 @@ class StopSim(DuccUtil):
                     time.sleep(.1)
                     if ( signal in ('-KILL', '-INT') ):
                         pids.delete(inst)
+                        stopbroker = True
     
             else:
                 for inst in instances:
                     data = pids.get(inst)
-                    self.threadpool.invoke(self.signal_process, inst, pids.get(inst), signal)
-                    time.sleep(.1)
-                    if ( signal in ('-KILL', '-INT') ):
-                        pids.delete(inst)
+                    if ( data == None ):
+                        if ( inst == 'broker' and signal in ('-KILL', '-INT') ):
+                            stopbroker = True
+                        else:
+                            print "WARNING - No PID found for instance", inst
+                    else:
+                        self.threadpool.invoke(self.signal_process, inst, pids.get(inst), signal)
+                        time.sleep(.1)
+                        if ( signal in ('-KILL', '-INT') ):
+                            pids.delete(inst)
         except:
             self.threadpool.quit()
             print sys.exc_info()[0], "Exiting, simulator may not be properly stopped."
@@ -164,7 +169,7 @@ class StopSim(DuccUtil):
         print "Waiting " + str(sleeptime) + " seconds to broadcast agent shutdown."
         time.sleep(sleeptime)
 
-        if ( ('broker' in components) and self.automanage ):
+        if ( stopbroker and self.automanage ):
             print "Stopping broker"
             self.stop_broker()