- Timestamp:
- Jan 31, 2013, 4:13:09 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20121219/ippToPsps/jython/setupScratchDb.py
r35073 r35076 2 2 3 3 import sys 4 import os 5 import socket 4 6 import stilts 5 7 from java.lang import * 6 8 from java.sql import * 7 9 8 9 from ipptopsps import IppToPsps 10 from config import Config 10 11 from scratchdb import ScratchDb 12 from ipptopspsdb import IppToPspsDb 11 13 12 14 ''' 13 15 SetupScratchDb class 14 16 ''' 15 class SetupScratchDb(IppToPsps): 17 class SetupScratchDb(object): 18 19 ## XXX EAM : 2013.01.31 - i have changed the 'config.py' concept 20 ## to only include the global static information (from 21 ## settings.xml), and stripped out the dynamic information to a 22 ## new entity called 'skychunk' 16 23 17 24 ## XXX note that setupScratchDb.py fails if there are no valid … … 47 54 ''' 48 55 def __init__(self, argv): 49 super(SetupScratchDb, self).__init__(argv) 56 # set up config object 57 self.config = Config() 50 58 51 if len(argv) < 3:59 if len(argv) < 2: 52 60 self.printUsage() 53 61 self.exitProgram("incorrect args") 54 62 63 # some class constants 64 self.HOST = socket.gethostname() 65 self.PID = os.getpid() 66 67 # XXX Shouldn't config set up logger? 68 # (not yet, since we set HOST & PID with program...) 69 self.logger = self.config.getLogger(self.HOST, self.PID, 1, 0) 70 55 71 try: 56 self.scratchDb = ScratchDb(self.logger, self.config, '0', argv[2])72 self.scratchDb = ScratchDb(self.logger, self.config, argv[1]) 57 73 except: 58 74 self.exitProgram("Could not connect to a scratch Db") 59 75 raise 60 61 76 62 77 def run(self): … … 70 85 # install IN tables 71 86 self.logger.infoPair("Installing", "initialization tables") 72 if self.configDir is None: 73 tables = stilts.treads("../config/tables.IN.vot") 74 else: 75 tablepath = self.configDir + "tables.IN.vot" 76 tables = stilts.treads(tablepath) 87 tablepath = self.config.configDir + "tables.IN.vot" 88 tables = stilts.treads(tablepath) 77 89 78 90 for table in tables: … … 86 98 self.scratchDb.createDvoTables() 87 99 88 '''89 Overrides base-class version90 '''91 100 def printUsage(self): 92 super(SetupScratchDb, self).printUsage("<scratchdb_name>") 101 # write message to log or stdout if no logger set up 102 msg = os.path.basename(sys.argv[0]) + " <scratchdb_version> " 103 try: 104 self.logger.errorPair("Usage:", msg) 105 except: 106 print "*** Usage: " + msg 93 107 94 108 ''' … … 100 114 setupScratchDb.exitProgram("completed") 101 115 except: pass 102 103
Note:
See TracChangeset
for help on using the changeset viewer.
