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/12/02 22:34:13 UTC
svn commit: r1547196 - in
/uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts: runducc
service start_sim stop_sim
Author: challngr
Date: Mon Dec 2 21:34:13 2013
New Revision: 1547196
URL: http://svn.apache.org/r1547196
Log:
UIMA-3457 Be sure to catch and handle all interrupts or the threading can hang.
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/runducc
uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/service
uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/start_sim
uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/stop_sim
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/runducc
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/runducc?rev=1547196&r1=1547195&r2=1547196&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/runducc (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/runducc Mon Dec 2 21:34:13 2013
@@ -733,11 +733,7 @@ class RunDucc(DuccUtil):
self.queue = Queue.Queue()
self.run_batch()
-
- #if ( self.style == 'SE' ):
- # time.sleep(5)
- # service_starter.stop_services()
-
+
if ( self.watch ):
self.queue.join()
print 'All threads returned'
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/service
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/service?rev=1547196&r1=1547195&r2=1547196&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/service (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/service Mon Dec 2 21:34:13 2013
@@ -32,8 +32,8 @@ import time
import subprocess
import shutil
import signal
-from threading import *
-import Queue
+#from threading import *
+#import Queue
os.environ['DUCC_HOME'] = os.path.abspath('../..')
sys.path.append(os.environ['DUCC_HOME'] + '/admin')
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/start_sim
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/start_sim?rev=1547196&r1=1547195&r2=1547196&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/start_sim (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-examples/src/main/scripts/start_sim Mon Dec 2 21:34:13 2013
@@ -235,14 +235,14 @@ class StartSim(DuccUtil):
print " 'mem-in-GB' is the amount of simulated memory the agent will report"
print ""
print " Example:"
- print " 1 bluej290 31"
- print " 2 bluej290 31"
- print " 9 bluej291 31"
- print " 10 bluej291 31"
- print " 17 bluej292 47"
- print " 18 bluej292 47"
- print " 25 bluej293 47"
- print " 26 bluej293 47"
+ print " 1 node290 31"
+ print " 2 node290 31"
+ print " 9 node291 31"
+ print " 10 node291 31"
+ print " 17 node292 47"
+ print " 18 node292 47"
+ print " 25 node293 47"
+ print " 26 node293 47"
print ""
print " -c --components component"
print " Start the indicated component, must be one of", ' '.join(self.default_components), "or 'all'"
@@ -367,15 +367,19 @@ class StartSim(DuccUtil):
if ( (IP != None) or (memory != None) or ( pseudoname != None )) :
self.invalid("Running with a nodelist is not compatible with running a single agent.");
- if ( components.get('broker') != None ):
- self.start_broker()
+ try:
+ if ( components.get('broker') != None ):
+ self.start_broker()
+
+ if ( node_config != None ):
+ self.startAgents(node_config, instances)
+
+ for (com, com) in components.items():
+ if ( com != 'broker' ): # started separately
+ self.threadpool.invoke(self.startComponent, com, or_parms)
- if ( node_config != None ):
- self.startAgents(node_config, instances)
-
- for (com, com) in components.items():
- if ( com != 'broker' ): # started separately
- self.threadpool.invoke(self.startComponent, com, or_parms)
+ except:
+ pass
self.threadpool.quit()
self.pids.write('sim.pids')
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=1547196&r1=1547195&r2=1547196&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 Mon Dec 2 21:34:13 2013
@@ -138,21 +138,25 @@ class StopSim(DuccUtil):
pids.load('sim.pids')
self.threadpool = ThreadPool(50)
- if ( (len(components) + len(instances)) == 0 ):
- for (inst, data) in pids.items():
- self.threadpool.invoke(self.signal_process, inst, data, signal)
- # self.signal_process(inst, data, signal)
- if ( signal in ('-KILL', '-INT') ):
- pids.delete(inst)
-
- else:
- for inst in instances:
- data = pids.get(inst)
- self.threadpool.invoke(self.signal_process, inst, pids.get(inst), signal)
- #self.signal_process(inst, pids.get(inst), signal)
- if ( signal in ('-KILL', '-INT') ):
- pids.delete(inst)
+ try:
+ if ( (len(components) + len(instances)) == 0 ):
+ for (inst, data) in pids.items():
+ self.threadpool.invoke(self.signal_process, inst, data, signal)
+ if ( signal in ('-KILL', '-INT') ):
+ pids.delete(inst)
+
+ else:
+ for inst in instances:
+ data = pids.get(inst)
+ self.threadpool.invoke(self.signal_process, inst, pids.get(inst), signal)
+ if ( signal in ('-KILL', '-INT') ):
+ pids.delete(inst)
+ except:
+ self.threadpool.quit()
+ print sys.exc_info()[0], "Exiting, simulator may not be properly stopped."
+ sys.exit(1)
+
self.threadpool.quit();
pids.write('sim.pids')