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 2015/11/13 19:54:15 UTC

svn commit: r1714252 - in /uima/sandbox/uima-ducc/trunk/src/main: admin/check_ducc admin/db_loader admin/db_util.py admin/ducc_post_install admin/ducc_util.py admin/stop_ducc resources/cassandra.yaml resources/database.log.config

Author: challngr
Date: Fri Nov 13 18:54:15 2015
New Revision: 1714252

URL: http://svn.apache.org/viewvc?rev=1714252&view=rev
Log:
UIMA-4577 Scripting and config updates.

Removed:
    uima/sandbox/uima-ducc/trunk/src/main/resources/database.log.config
Modified:
    uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc
    uima/sandbox/uima-ducc/trunk/src/main/admin/db_loader
    uima/sandbox/uima-ducc/trunk/src/main/admin/db_util.py
    uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install
    uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py
    uima/sandbox/uima-ducc/trunk/src/main/admin/stop_ducc
    uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra.yaml

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc?rev=1714252&r1=1714251&r2=1714252&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/check_ducc Fri Nov 13 18:54:15 2015
@@ -350,7 +350,10 @@ class CheckDucc(DuccUtil):
         self.threadpool.quit()
 
         if ( self.kill_signal != None ):
+            print 'Stopping broker'
             self.stop_broker()
+            print 'Stopping database'
+            self.db_stop()
                 
         if ( len(self.pids) == 0):
             if ( os.path.exists(self.pid_file) ):

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/db_loader
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/db_loader?rev=1714252&r1=1714251&r2=1714252&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/db_loader (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/db_loader Fri Nov 13 18:54:15 2015
@@ -55,7 +55,7 @@ class DbLoader(DuccUtil):
         print '         Specifies the DUCC_HOME of the DUCC runtime to be moved into the database.'
         print '    -o dburl'
         print '         Specifies the database URL to contact to store the items.'
-        print '    --noarchive'
+        print '    --no-archive'
         print '         Suppresses archival of the input files.'
         print ''
         print 'Notes:'

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/db_util.py
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/db_util.py?rev=1714252&r1=1714251&r2=1714252&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/db_util.py (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/db_util.py Fri Nov 13 18:54:15 2015
@@ -26,6 +26,24 @@ def manual_config(DUCC_HOME, DUCC_HEAD):
     print ''
     print 'Note that one occurance of DUCC_HEAD will be quoted: you must preserve these quotes, e.g. as "' + DUCC_HEAD + '".'
 
+def update_cassandra_config(DUCC_HOME, DUCC_HEAD):
+    # Read cassandra.yaml and change the things necessary to configure it correctly
+    config = DUCC_HOME + '/cassandra-server/conf/cassandra.yaml'
+    f = open(config)
+    lines = []
+    for line in f:
+        if ( line.startswith('listen_address:') ):
+            line = line.strip();
+            print 'Database host is configured at', line
+            if ( not DUCC_HEAD in line ):
+                print 'Must reconfigure listen_address to', DUCC_HEAD
+                parts = line.strip().split(':')
+                old = parts[1].strip()
+                ch_head = "sed -i.bak s'/" + old + "/" + DUCC_HEAD + "'/ " + config
+                os.system(ch_head)
+        
+
+
 def configure_database(DUCC_HOME, DUCC_HEAD, java, db_pw):
     # for cassandra:
     # in ducc_runtime/cassandra-server/conf we need to update cassandra.yaml to establish
@@ -50,22 +68,7 @@ def configure_database(DUCC_HOME, DUCC_H
         print 'Database support will be bypassed'
         return True
         
-    config =  DUCC_HOME + '/cassandra-server/conf/cassandra.yaml'
-    esc_home = DUCC_HOME.replace("/", "\/")    # for sed
-
-    # must configure the database node to be the same as the ducc head, and the database location
-    # to be DUCC_HEAD
-    ch_head = "sed -i.bak s'/DUCC_HEAD/" + DUCC_HEAD + "'/ " + config
-    if ( execute(ch_head) != 0 ):
-        print 'Could not configure', config + '.  You may need to recover it from', config+'.bak.'
-        manual_config(DUCC_HOME, DUCC_HEAD)
-        return False
-
-    ch_home = "sed -i.bak s'/DUCC_HOME/" + esc_home + "'/ " + config
-    if ( execute(ch_home) != 0):
-        print 'Could not configure', config + '.  You may need to recover it from', config+'.bak.'
-        manual_config(DUCC_HOME, DUCC_HEAD)
-        return False
+    update_cassandra_config(DUCC_HOME, DUCC_HEAD)
 
     here = os.getcwd()
     os.chdir(DUCC_HOME + "/cassandra-server")

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install?rev=1714252&r1=1714251&r2=1714252&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install Fri Nov 13 18:54:15 2015
@@ -310,7 +310,7 @@ class PostInstall():
         for f in spot_checked_directories:
             if ( not os.path.exists(f) ):
                 print 'ERROR: Directory', f, 'cannot be found.'
-                ret = false
+                ret = False
                 continue
 
             stat = os.stat(f)

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py?rev=1714252&r1=1714251&r2=1714252&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_util.py Fri Nov 13 18:54:15 2015
@@ -50,6 +50,8 @@ sys.path.append(DUCC_HOME + '/bin')
 from ducc_base import DuccBase
 from properties import Properties
 
+import db_util as dbu
+
 global use_threading
 use_threading = True
 
@@ -234,6 +236,7 @@ class DuccUtil(DuccBase):
 
         print 'Starting database'
         dbnode = self.ducc_properties.get('ducc.state.database.url')
+        dbu.update_cassandra_config(self.DUCC_HOME, dbnode)
 
         max_attempts = 5
         attempt = 0

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/stop_ducc
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/stop_ducc?rev=1714252&r1=1714251&r2=1714252&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/stop_ducc (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/stop_ducc Fri Nov 13 18:54:15 2015
@@ -39,6 +39,7 @@ class StopDucc(DuccUtil):
             return
 
         if ( component == 'db' ):
+            print 'Stopping database'
             self.db_stop()
             return
 
@@ -240,6 +241,7 @@ class StopDucc(DuccUtil):
                     print "Stopping broker"
                     self.stop_broker()                
 
+                print "Stopping database"
                 self.db_stop()
 
                 if ( os.path.exists(self.pid_file) ):

Modified: uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra.yaml
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra.yaml?rev=1714252&r1=1714251&r2=1714252&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra.yaml (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/resources/cassandra.yaml Fri Nov 13 18:54:15 2015
@@ -108,12 +108,12 @@ partitioner: org.apache.cassandra.dht.Mu
 # the configured compaction strategy.
 # If not set, the default directory is $CASSANDRA_HOME/data/data.
 data_file_directories:
-    - DUCC_HOME/database/data
+    - DUCC/data
 
 # commit log.  when running on magnetic HDD, this should be a
 # separate spindle than the data directories.
 # If not set, the default directory is $CASSANDRA_HOME/data/commitlog.
-commitlog_directory: DUCC_HOME/database/commitlog
+commitlog_directory: DUCC/commitlog
 
 # policy for data disk failures:
 # die: shut down gossip and client transports and kill the JVM for any fs errors or
@@ -228,7 +228,7 @@ counter_cache_save_period: 7200
 
 # saved caches
 # If not set, the default directory is $CASSANDRA_HOME/data/saved_caches.
-saved_caches_directory: DUCC_HOME/database/saved_caches
+saved_caches_directory: DUCC/saved_caches
 
 # commitlog_sync may be either "periodic" or "batch." 
 #