IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33553 for trunk


Ignore:
Timestamp:
Mar 16, 2012, 12:04:00 PM (14 years ago)
Author:
rhenders
Message:

scratch Db now checked at start up; better user prompting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/dvo.py

    r33531 r33553  
    3434
    3535    '''
    36     def __init__(self, logger, config):
     36    def __init__(self, logger, config, scratchDbName):
    3737
    3838        # set up logging
     
    4646        self.regionsAlreadyIngested = []
    4747        self.regionsIngestedButOutOfDate = []
    48        
    49         #self.correctDvo = False
    50 
    51 
    52     '''
    53     Connects to the scratch database with the provided name, if not already connected
    54     '''
    55     def setScratchDb(self, dbName):
    56 
    57         # if we're already connected to this database, then get out of here
    58         try:
    59             if self.scratchDb.dbName == dbName: return
    60         except: pass
    61 
    62         self.scratchDb = ScratchDb(self.logger, self.config, dbName)
     48       
     49        # connect to the specified scratch database
     50        self.scratchDb = ScratchDb(self.logger, self.config, scratchDbName)
    6351        self.scratchDb.setUseFullTables(True)
    6452
    65         # decide if we are using the right DVO
     53        self.checkDvoLocation()
     54
     55    '''
     56    Checks whether scratch Db is using DVO Db specified in the config
     57    '''
     58    def checkDvoLocation(self):
     59
     60        # decide if we are using the right DVO for this scratchDb
    6661        self.correctDvo = self.scratchDb.isCorrectDvo(self.config.dvoLocation)
    6762
     63        # this scratch Db either has no DVO info ingested, or a different DVO ingested. Prompt user
    6864        if not self.correctDvo:
    6965            print "*******************************************************************************"
    70             response = raw_input("**** Wrong or no DVO in use. Do you want to reset and use '" + self.config.dvoLocation + "' (y/n)? ")
     66            self.logger.warning("Wrong or no DVO in use. Do you want to reset and use '" + self.config.dvoLocation + "'?")
     67            response = raw_input("(y/n) ")
    7168            if response == "y":
    72                 response = raw_input("**** Are you ABSOLUTELY sure you want to do this? (y/n)? ")
     69                self.logger.warning("Are you ABSOLUTELY sure you want to do this?")
     70                response = raw_input("(y/n) ")
    7371                if response == "y":
    7472                    self.resetAllTables()
     73
    7574
    7675    '''
Note: See TracChangeset for help on using the changeset viewer.