Author: burn
Date: Tue Jun 28 21:14:26 2016
New Revision: 1750586
URL: http://svn.apache.org/viewvc?rev=1750586&view=rev
Log:
UIMA-4994 start/stop_ducc must be run from the head node; ducc_post_install &
build_duccling must be run from admin; ducc_post_install can be rerun after a
db failure
Removed:
uima/uima-ducc/trunk/src/main/admin/ducc_boot.py
Modified:
uima/uima-ducc/trunk/src/main/admin/build_duccling
uima/uima-ducc/trunk/src/main/admin/db_util.py
uima/uima-ducc/trunk/src/main/admin/ducc_install
uima/uima-ducc/trunk/src/main/admin/ducc_post_install
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
Modified: uima/uima-ducc/trunk/src/main/admin/build_duccling
URL:
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/build_duccling?rev=1750586&r1=1750585&r2=1750586&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/build_duccling (original)
+++ uima/uima-ducc/trunk/src/main/admin/build_duccling Tue Jun 28 21:14:26 2016
@@ -24,14 +24,19 @@ import glob
import shutil
import subprocess
-# simple bootstratp to establish DUCC_HOME and to set the python path so it can
-# find the common code in DUCC_HOME/admin
-# Infer DUCC_HOME from our location - no longer use a (possibly inaccurate)
environment variable
+# Start by finding DUCC_HOME and and setting the python path so it can
+# find the common code in DUCC_HOME/bin
+# Infer DUCC_HOME from our location - assume we're running from one level below
me = os.path.abspath(__file__)
ndx = me.rindex('/')
ndx = me.rindex('/', 0, ndx)
DUCC_HOME = me[:ndx] # split from 0 to ndx
+cwd = os.getcwd()
+if cwd != DUCC_HOME+'/admin':
+ print '>>> ERROR - this script must be run from the admin directory'
+ sys.exit(99)
+
sys.path.append(DUCC_HOME + '/bin')
from ducc_base import DuccBase
from properties import Properties
Modified: uima/uima-ducc/trunk/src/main/admin/db_util.py
URL:
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/db_util.py?rev=1750586&r1=1750585&r2=1750586&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/db_util.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/db_util.py Tue Jun 28 21:14:26 2016
@@ -136,15 +136,13 @@ def configure_database(DUCC_HOME, DUCC_H
print "Must enter a DB password or 'bypass' to continue."
return False
- if ( os.path.exists(DUCC_HOME + "/state/database/data") ):
- print 'Database is already defined in', DUCC_HOME + '/database', '-
not rebilding.'
- return False
-
-
if ( db_pw == 'bypass' ):
print 'Database support will be bypassed'
return True
+ if ( os.path.exists(DUCC_HOME + "/state/database/data") ):
+ print 'Database is already defined in', DUCC_HOME + '/database', '-
but will try to rebuild.'
+
update_cassandra_config(DUCC_HOME, DUCC_HEAD)
here = os.getcwd()
Modified: uima/uima-ducc/trunk/src/main/admin/ducc_install
URL:
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/ducc_install?rev=1750586&r1=1750585&r2=1750586&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_install (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_install Tue Jun 28 21:14:26 2016
@@ -261,7 +261,7 @@ if not os.path.exists(runtime):
os.makedirs(runtimeParent)
newducc = expand_tarball( tarfile, nversion, runtimeParent )
os.rename(newducc, runtime)
- print "\n", " --- Installation completed ... please run
'admin/ducc_post_install'"
+ print "\n", " --- Installation completed ... please run
'./ducc_post_install' from the admin directory"
exit(0)
#-----------------------------------------------------------------------------------------
Modified: uima/uima-ducc/trunk/src/main/admin/ducc_post_install
URL:
http://svn.apache.org/viewvc/uima/uima-ducc/trunk/src/main/admin/ducc_post_install?rev=1750586&r1=1750585&r2=1750586&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_post_install (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_post_install Tue Jun 28 21:14:26
2016
@@ -127,7 +127,7 @@ class PostInstall():
f.write(line)
return
- def configure_database(self):
+ def setup_database(self):
# for cassandra:
# in ducc_runtime/cassandra-server/conf we need to update
cassandra.yaml to establish
# the data directories and db connection addresses
@@ -135,17 +135,15 @@ class PostInstall():
# Note this is a bootstrap routine and doesn't try to use common code
that may depend on
# things being initialized correctly.
-
- if ( os.path.exists(self.DUCC_HOME + "/database/data") ):
- print 'Database is already defined. Not configuring'
- return
-
- db_pw = self.get_pw(self.database_pw)
+ # If are re-running the DB may already have been created so use the
saved password
+ db_pw = self.ducc_private_properties.get('db_password')
+ if (db_pw == None):
+ db_pw = self.get_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;
+ return True;
if ( dbu.configure_database(self.DUCC_HOME, self.ducc_head,
self.path_to_java, db_pw) ):
print 'Configuring DUCC to use the database.'
@@ -157,9 +155,10 @@ class PostInstall():
self.ducc_private_properties.delete('db_password')
self.ducc_private_properties.put('db_password', db_pw, ['#Db
password, default is randomly generated']);
-
-
- return
+
+ return True
+ else:
+ return False
# generate a random string between 8 and 16 characters long
def generate_pw(self):
@@ -387,6 +386,14 @@ class PostInstall():
def main(self, argv):
+ self.DUCC_HOME = find_ducc_home()
+ self.localhost = find_localhost()
+ cwd = os.getcwd()
+ if cwd != self.DUCC_HOME+'/admin':
+ print '>>> ERROR - this script must be run from the admin
directory'
+ sys.exit(99)
+ print 'Using DUCC HOME:', self.DUCC_HOME, '\n'
+
if ( not self.verify_permissions() ):
print
'--------------------------------------------------------------------------------'
print 'Package verificaiton fails. Most likely cause is an
unexpected UMASK unpacking the distribution.'
@@ -421,10 +428,6 @@ class PostInstall():
elif o in ('-h', '-?', '--help'):
self.usage(None)
- self.DUCC_HOME = find_ducc_home()
- self.localhost = find_localhost()
-
- print 'Using DUCC HOME:', self.DUCC_HOME, '\n'
resources = self.DUCC_HOME + '/resources'
self.site_properties_name = resources + '/site.ducc.properties'
self.ducc_properties = resources + '/ducc.properties'
@@ -473,7 +476,9 @@ class PostInstall():
self.configure_broker()
# configure the database for local system and initialize the schema
- self.configure_database()
+ if not self.setup_database():
+ print 'Database creation failed - DUCC setup incomplete'
+ sys.exit(1)
self.keytool = self.get_java_keytool(self.java_bindir)
print 'Java version:', self.get_java_version()
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=1750586&r1=1750585&r2=1750586&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/ducc_util.py (original)
+++ uima/uima-ducc/trunk/src/main/admin/ducc_util.py Tue Jun 28 21:14:26 2016
@@ -468,6 +468,9 @@ class DuccUtil(DuccBase):
return False
return True
+ def verify_head(self):
+ return ( self.localhost == self.ducc_properties.get("ducc.head"))
+
#
# Verify the viability of ducc_ling.
# Returns a tuple (viable, elevated, safe)
@@ -914,7 +917,7 @@ class DuccUtil(DuccBase):
self.default_components = ['rm', 'pm', 'sm', 'or', 'ws', 'db',
'broker']
self.default_nodefiles = [self.DUCC_HOME + '/resources/ducc.nodes']
- if ( self.localhost == self.ducc_properties.get("ducc.head")):
+ if ( self.localhost == self.ducc_properties.get("ducc.head")):
self.is_ducc_head = True
os.environ['DUCC_NODENAME'] = self.localhost # to match java code's
implicit propery so script and java match
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=1750586&r1=1750585&r2=1750586&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/start_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/start_ducc Tue Jun 28 21:14:26 2016
@@ -32,6 +32,7 @@ from local_hooks import verify_slave_nod
from local_hooks import verify_master_node
from ducc import Ducc
from ducc_util import ThreadPool
+from ducc_base import find_ducc_home
class StartDucc(DuccUtil):
@@ -220,6 +221,10 @@ class StartDucc(DuccUtil):
def main(self, argv):
+ if ( not self.verify_head() ):
+ print ">>> ERROR - this script must be run from the head node"
+ sys.exit(1);
+
if ( not self.verify_jvm() ):
sys.exit(1);
@@ -362,5 +367,11 @@ class StartDucc(DuccUtil):
return
if __name__ == "__main__":
+ # First check if ducc_post_install has been run
+ DUCC_HOME = find_ducc_home()
+ propsfile = DUCC_HOME + '/resources/site.ducc.properties'
+ if ( not os.path.exists(propsfile) ):
+ print "\n>> ERROR >> Missing site.ducc.properties -- please run
ducc_post_install\n"
+ sys.exit(99)
starter = StartDucc()
starter.main(sys.argv[1:])
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=1750586&r1=1750585&r2=1750586&view=diff
==============================================================================
--- uima/uima-ducc/trunk/src/main/admin/stop_ducc (original)
+++ uima/uima-ducc/trunk/src/main/admin/stop_ducc Tue Jun 28 21:14:26 2016
@@ -168,6 +168,10 @@ class StopDucc(DuccUtil):
def main(self, argv):
+ if ( not self.verify_head() ):
+ print ">>> ERROR - this script must be run from the head node"
+ sys.exit(1);
+
if ( len(argv) == 0 ):
self.usage(None)