IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 27, 2013, 5:58:25 AM (14 years ago)
Author:
eugene
Message:

enable test mode from command-line (-test, after jython module); add parallel dvo option; make database selection more consistent and variable on test/not-test

Location:
branches/eam_branches/ipp-20121219/ippToPsps/jython
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/detectionbatch.py

    r35060 r35063  
    927927    def importIppTables(self, filter=""):
    928928
    929        if self.config.test: regex = "XY33.psf"
    930        else : regex = ".*.psf"
     929       ## if self.config.test: regex = "XY33.psf"
     930       ## else : regex = ".*.psf"
     931       regex = ".*.psf"
    931932 
    932        # XXX EAM NOTE : this is fragile : requires PS1_V_
     933       # XXX EAM NOTE : this is fragile : requires PS1_V4
    933934       columns = "IPP_IDET X_PSF Y_PSF X_PSF_SIG Y_PSF_SIG PSF_INST_MAG PSF_INST_MAG_SIG PEAK_FLUX_AS_MAG PSF_MAJOR PSF_MINOR PSF_THETA EXT_NSIGMA PSF_QF MOMENTS_XX MOMENTS_XY MOMENTS_YY AP_MAG KRON_FLUX KRON_FLUX_ERR FLAGS FLAGS2 SKY SKY_SIGMA EXT_NSIGMA PSF_QF_PERFECT PSF_CHISQ"
    934935
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/dvo.py

    r35042 r35063  
    3333
    3434    '''
    35     def __init__(self, logger, config, scratchDbName="ipptopsps_test_scratch"):
     35    def __init__(self, logger, config, scratchDbName=None):
    3636
    3737        # set up logging
     
    4949        self.useStilts = 0
    5050
    51         # connect to the specified scratch database
     51        # connect to the specified scratch database, if a name is given, otherwise use the first version
    5252        try:
    53             self.scratchDb = ScratchDb(self.logger, self.config, scratchDbName)
     53            self.scratchDb = ScratchDb(self.logger, self.config, '1', scratchDbName)
    5454        except: raise
    5555
     
    617617        cmd += " " + str(decCenter+halfSize)
    618618
     619        if self.config.parallel:
     620            cmd += " -parallel"
     621
    619622        self.logger.infoPair("Running dvopsps", cmd)
    620623        p = Popen(cmd, shell=True, stdout=PIPE)
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/dvoobjects.py

    r35056 r35063  
    6767        cmd += " -cpt " + region
    6868
     69        if self.config.parallel:
     70            cmd += " -parallel"
     71
    6972        self.logger.infoPair("Running dvopsps", cmd)
    7073        p = Popen(cmd, shell=True, stdout=PIPE)
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/gpc1db.py

    r35057 r35063  
    2121    '''
    2222    def __init__(self, logger, config):
    23         super(Gpc1Db, self).__init__(logger, config, "gpc1database")
     23        # define database type
     24        if (config.test):
     25            dbType = "gpc1database_test"
     26        else:
     27            dbType = "gpc1database"
     28
     29        super(Gpc1Db, self).__init__(logger, config, dbType)
    2430
    2531    '''
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/ipptopsps.py

    r34970 r35063  
    2222    '''
    2323    def __init__(self, argv, logToStdout=1, logToFile=0):
     24
     25        testmode = False
     26        for arg in sys.argv:
     27            if arg == "-test":
     28                testmode = True
     29                sys.argv.remove(arg)
     30            if arg == "-t":
     31                testmode = True
     32                sys.argv.remove(arg)
    2433
    2534        # are the arsg ok? all programs require a config name
     
    5160        # set up config object
    5261        self.config = Config(self.PROGNAME, CONFIGNAME, self.configDir)
     62        self.config.test = testmode
     63
     64        if self.config.test: print "using test mode"
     65        else: print "not using test mode"
     66
    5367        self.logger = self.config.getLogger(self.HOST, self.PID, logToStdout, logToFile)
    5468
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/ipptopspsdb.py

    r35003 r35063  
    1818    '''
    1919    def __init__(self, logger, config):
    20         super(IppToPspsDb, self).__init__(logger, config, "ipptopspsdatabase")
     20        if (config.test):
     21            dbType = "ipptopspsdatabase_test"
     22        else:
     23            dbType = "ipptopspsdatabase"
     24        super(IppToPspsDb, self).__init__(logger, config, dbType)
    2125
    2226        self.MAX_FAILS = 5
     
    965969        ,queue_ST \
    966970        ,queue_OB \
     971        ,parallel \
    967972        FROM config \
    968973        WHERE name = '" + self.config.name + "'"
     
    10061011            if rs.getInt(20) == 1: self.config.batchTypes.append("ST")
    10071012            if rs.getInt(21) == 1: self.config.batchTypes.append("OB")
     1013
    10081014            self.config.force = True # TODO
    1009             self.config.test = False # TODO
     1015            self.config.parallel = False # TODO
     1016
     1017            if rs.getInt(22) == 1: self.config.parallel = True
     1018
     1019            if self.config.parallel: print "USING parallel"
    10101020            self.config.isLoaded = True
    10111021        except:
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/loader.py

    r35056 r35063  
    3434        super(Loader, self).__init__(argv, 1, 1)
    3535
    36         # create gpc1 database objects
     36        if self.config.parallel:
     37            print "PARALLEL dvo"
     38        else:
     39            print "SERIAL dvo"
     40
     41        # connect to the gpc1 database
    3742        self.gpc1Db = Gpc1Db(self.logger, self.config)
    3843
    39         # XXX this is really bad: need to get these from config... (see this code:)
    40         ## XX # open config and grab database parameters
    41         ## XX if not dbName: self.dbName = config.getDbName(dbType)
    42         ## XX else: self.dbName = dbName
    43 
    4444        # connect to scratch database
    45         scratchDbs = ['ipptopsps_test_scratch', 'ipptopsps_test_scratch2', 'ipptopsps_test_scratch3']
    46         for dbName in scratchDbs:
    47             self.scratchDb = ScratchDb(self.logger, self.config, dbName)
    48             if self.scratchDb.anyOtherConnections():
    49                 self.logger.errorPair("This scratch Db is already in use", dbName)
     45        scratchDbs = ['1', '2', '3']
     46        for dbVersion in scratchDbs:
     47            self.scratchDb = ScratchDb(self.logger, self.config, dbVersion)
     48            if not self.config.test and self.scratchDb.anyOtherConnections():
     49                self.logger.errorPair("This scratch Db is already in use", self.scratchDb.dbName)
    5050                self.scratchDb.disconnect()
    5151                continue
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/scratchdb.py

    r35042 r35063  
    1919    Constructor
    2020    '''
    21     def __init__(self, logger, config, dbName=None):
    22         super(ScratchDb, self).__init__(logger, config, "localdatabase", dbName)
     21    def __init__(self, logger, config, dbVersion, dbName=None):
     22
     23        # create gpc1 database objects
     24        if (config.test):
     25            dbType = "localdatabase_test"
     26        else:
     27            dbType = "localdatabase"
     28
     29        if not dbName:
     30            dbName = config.getDbName(dbType)
     31            dbName += dbVersion
     32
     33        super(ScratchDb, self).__init__(logger, config, dbType, dbName)
    2334
    2435        self.dvoDoneTable = "dvoDone"
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/setupScratchDb.py

    r34990 r35063  
    2626
    2727        try:
    28             self.scratchDb = ScratchDb(self.logger, self.config, argv[2])
     28            self.scratchDb = ScratchDb(self.logger, self.config, '0', argv[2])
    2929        except:
    3030            self.exitProgram("Could not connect to a scratch Db")
Note: See TracChangeset for help on using the changeset viewer.