IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 6, 2013, 3:16:35 PM (13 years ago)
Author:
eugene
Message:

upgrade to ippToPsps (see doc/upgrade.txt): adds native dvo to mysql ingest operations, adds autogen configuration & installation, splits out global config information from new "skychunk" information (current region on the sky being processed), adds test suites

Location:
trunk/ippToPsps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps

  • trunk/ippToPsps/jython

    • Property svn:ignore
      •  

        old new  
        11*.class
         2Makefile
         3Makefile.in
  • trunk/ippToPsps/jython/setupScratchDb.py

    r33787 r35097  
    22
    33import sys
     4import os
     5import socket
    46import stilts
    57from java.lang import *
    68from java.sql import *
    79
    8 
    9 from ipptopsps import IppToPsps
     10from config import Config
    1011from scratchdb import ScratchDb
     12from ipptopspsdb import IppToPspsDb
    1113
    1214'''
    1315SetupScratchDb class
    1416'''
    15 class SetupScratchDb(IppToPsps):
     17class 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'
     23
     24    ## XXX note that setupScratchDb.py fails if there are no valid
     25    ## entries in the config table (or if it is passed a non-existent
     26    ## config) This is because ipptopsps.__init__ calls
     27    ## checkClientStatus, which calls refreshConfig, which calls
     28    ## readConfig, which attempts to select the matching entry from
     29    ## the config table.  if the select returns 0 rows, the code
     30    ## crashes.  even if it were not to crash (eg, if it returned
     31    ## False), checkClientStatus would enter a waiting loop until the
     32    ## config existed.
     33   
     34    ## since a scratchDb is needed to do basically anything, it seems
     35    ## like 'setupScratchDb' should not be dependent on the details of
     36    ## the configs, etc.
     37
     38    ## what are the options?  I think this is a problem of poor
     39    ## factoring / dependencies, esp for 'config.py'.  there are two
     40    ## (or more) aspects to 'config.py' : management of the dynamic
     41    ## 'config' information (basically, the regions / dvodbs of
     42    ## interest) and manipulation of the static / system configuration
     43    ## information.
     44
     45    ## these concepts should probably be split and the more general
     46    ## part (settings & logger) placed in one module and the rest elsewhere.
     47
     48    ## as for setupScratchDb.py, it looks like it only uses the static
     49    ## settings info and the logger functions, so it should not be a
     50    ## child of the ipptopsps class
    1651
    1752    '''
     
    1954    '''
    2055    def __init__(self, argv):
    21         super(SetupScratchDb, self).__init__(argv)
     56        # set up config object
     57        self.config = Config()
    2258
    23         if len(argv) < 3:
     59        if len(argv) < 2:
    2460            self.printUsage()
    2561            self.exitProgram("incorrect args")
    2662
     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
    2771        try:
    28             self.scratchDb = ScratchDb(self.logger, self.config, argv[2])
     72            self.scratchDb = ScratchDb(self.logger, self.config, argv[1])
    2973        except:
    3074            self.exitProgram("Could not connect to a scratch Db")
    3175            raise
    32 
    3376
    3477    def run(self):
     
    4285        # install IN tables
    4386        self.logger.infoPair("Installing", "initialization tables")
    44         tables = stilts.treads("../config/IN/tables.vot")
     87        tablepath = self.config.configDir + "tables.IN.vot"
     88        tables = stilts.treads(tablepath)
     89
    4590        for table in tables:
     91            # EAM TEST I/O
     92            self.logger.infoPair("Creating IN table: ", table.name)
    4693            self.logger.debug("Creating IN table: " + table.name)
    4794            table.write(self.scratchDb.url + '#' + table.name)
    4895
    49     '''
    50     Overrides base-class version
    51     '''
     96        # create basic DVO tables
     97        self.logger.infoPair("Installing", "initialization tables")
     98        self.scratchDb.createDvoTables()
     99
    52100    def printUsage(self):
    53         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
    54107
    55108'''
     
    61114    setupScratchDb.exitProgram("completed")
    62115except: pass
    63 
    64 
Note: See TracChangeset for help on using the changeset viewer.