Author: challngr Date: Wed Dec 2 18:25:53 2015 New Revision: 1717663 URL: http://svn.apache.org/viewvc?rev=1717663&view=rev Log: UIMA-4577 db_loader starts and stops the db for you to do the load
Modified: uima/sandbox/uima-ducc/trunk/src/main/admin/db_loader 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=1717663&r1=1717662&r2=1717663&view=diff ============================================================================== --- uima/sandbox/uima-ducc/trunk/src/main/admin/db_loader (original) +++ uima/sandbox/uima-ducc/trunk/src/main/admin/db_loader Wed Dec 2 18:25:53 2015 @@ -35,7 +35,7 @@ from ducc_util import DuccUtil class DbLoader(DuccUtil): def __init__(self): - DuccUtil.__init__(self) + DuccUtil.__init__(self, True) def usage(self, *args): if ( args[0] != None ): @@ -44,7 +44,7 @@ class DbLoader(DuccUtil): print '' print 'Usage:' print '' - print 'db_loader -i in -o out [--no-archive]' + print 'db_loader -i in [--no-archive]' print '' print 'Where:' print ' -d' @@ -53,8 +53,7 @@ class DbLoader(DuccUtil): print ' the database are not overwritten.' print ' -i in' 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 '' print ' --no-archive' print ' Suppresses archival of the input files.' print '' @@ -83,8 +82,6 @@ class DbLoader(DuccUtil): in_home = a elif o in ('-d'): drop = True - elif o in ('-o'): - out_url = a elif o in ('--no-archive'): archive = False else: @@ -93,9 +90,12 @@ class DbLoader(DuccUtil): if ( in_home == None ): self.usage("Missing input DUCC_HOME") + + out_url = self.ducc_properties.get('ducc.database.host') if ( out_url == None ): - self.usage("Missing database URL"); + self.usage("Cannot find 'ducc.database.host' in your properties file."); + self.db_start() if ( not self.db_alive(3) ): print "Database is not running or cannot be contacted." @@ -116,6 +116,9 @@ class DbLoader(DuccUtil): print 'CLASSPATH', os.environ['CLASSPATH'] print 'Executing', CMD os.system(CMD) + + + self.db_stop() if __name__ == "__main__": console = DbLoader()