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/11 19:45:14 UTC

svn commit: r1713912 - in /uima/sandbox/uima-ducc/trunk/src/main/admin: db_create db_util.py ducc_post_install

Author: challngr
Date: Wed Nov 11 18:45:13 2015
New Revision: 1713912

URL: http://svn.apache.org/viewvc?rev=1713912&view=rev
Log:
UIMA-4577 Updates to scripting.

Modified:
    uima/sandbox/uima-ducc/trunk/src/main/admin/db_create
    uima/sandbox/uima-ducc/trunk/src/main/admin/db_util.py
    uima/sandbox/uima-ducc/trunk/src/main/admin/ducc_post_install

Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/db_create
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/src/main/admin/db_create?rev=1713912&r1=1713911&r2=1713912&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/src/main/admin/db_create (original)
+++ uima/sandbox/uima-ducc/trunk/src/main/admin/db_create Wed Nov 11 18:45:13 2015
@@ -94,6 +94,9 @@ class DbCreate(DuccUtil):
         # configure the database for local system and initialize the schema
         db_node = self.ducc_properties.get("ducc.head")
         if ( dbu.configure_database(self.DUCC_HOME, db_node, self.jvm, self.database_pw)):
+            private_props_name = self.DUCC_HOME + '/resources.private/ducc.private.properties'
+
+            print 'Writing database password to', private_props_name
             ducc_site_properties = Properties();
             site_props_name = self.DUCC_HOME + '/resources/site.ducc.properties'
             ducc_site_properties.load(site_props_name)

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=1713912&r1=1713911&r2=1713912&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 Wed Nov 11 18:45:13 2015
@@ -70,6 +70,7 @@ def configure_database(DUCC_HOME, DUCC_H
     here = os.getcwd()
     os.chdir(DUCC_HOME + "/cassandra-server")
     pidfile = DUCC_HOME + '/state/cassandra.pid'
+    print 'Starting the database.  This might take a few moments if it is the first time.'
     CMD = "bin/cassandra -p "+  pidfile + " > /dev/null 2>&1";
     os.system(CMD);
     print "Database is started.  Waiting for initialization";

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=1713912&r1=1713911&r2=1713912&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 Wed Nov 11 18:45:13 2015
@@ -60,7 +60,7 @@ class PostInstall():
         print "   [-j, --jvm] <path to java executable>"
         print "        This is the full path to java command to be used to start DUCC; e.g., /usr/bin/java"
         print ""
-        print "   [-, --db-password] <root password for database>"
+        print "   [-d, --db-password] <root password for database>"
         print "        This is the password DUCC uses to manage the database."
         print ""
         print "   [-h, -? --help]"
@@ -105,24 +105,30 @@ class PostInstall():
             print 'Database is already defined.  Not configuring'
             return
 
-        db_pw = raw_input("Enter database password OR 'bypass' to disable database support:")
-        if ( db_pw == '' ):
-            print "Must enter a DB password to continue."
-            sys.exit(1);
+        if ( self.database_pw == None ):
+            db_pw = raw_input("Enter database password OR 'bypass' to disable database support:")
+            if ( db_pw == '' ):
+                print "Must enter a DB password to continue."
+                sys.exit(1);
+        else:
+            db_pw = self.database_pw
 
         if ( db_pw == 'bypass' ):
             print 'Database support will be disabled'
             self.update_property('ducc.database.host', '--disabled--', '# Database support is disabled')
             return;
-        else:
-            self.update_property('ducc.database.host', self.ducc_head, '# Database location')
             
-        dbu.configure_database(self.DUCC_HOME, self.ducc_head, self.path_to_java, db_pw)
-        private_props_name = self.DUCC_HOME + '/resources.private/ducc.private.properties'
-        private_properties = Properties()
-        private_properties.load(private_props_name)
-        private_properties.put('db_password', self.database_pw, ['#Db password']);
-        private_properties.write(private_props_name)
+        if ( dbu.configure_database(self.DUCC_HOME, self.ducc_head, self.path_to_java, db_pw) ):
+            print 'Configuring DUCC to use the database.'
+
+            self.update_property('ducc.database.host', self.ducc_head, '# Database location')
+            self.update_property('ducc.service.persistence.impl', 'org.apache.uima.ducc.database.StateServicesDb', '# Service manager persistence')
+            self.update_property('ducc.job.history.impl', 'org.apache.uima.ducc.database.HistoryManagerDb', '# History and checkpoint')
+            self.update_property('ducc.rm.persistence.impl', 'org.apache.uima.ducc.database.RmStatePersistence', '# RM state persistence')
+
+            self.ducc_private_properties.delete('db_password')
+            self.ducc_private_properties.put('db_password', db_pw, ['#Db password']);
+
 
         return
 
@@ -395,7 +401,7 @@ class PostInstall():
         keystore_properties_name = self.DUCC_HOME + '/resources.private/ducc.private.properties'
         self.ducc_private_properties = Properties()
         self.ducc_private_properties.load(keystore_properties_name)
-
+ 
         self.ducc_site_properties = Properties()
 
         py_version = sys.version_info