IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35077


Ignore:
Timestamp:
Jan 31, 2013, 5:47:48 PM (13 years ago)
Author:
eugene
Message:

track the boxes for which dvo detections have been ingested

Location:
branches/eam_branches/ipp-20121219/ippToPsps
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121219/ippToPsps/config/ippToPspsDbSchema.sql

    r35076 r35077  
    6262  `dec_center` float default NULL,
    6363  `box_side` float default NULL,
     64  `ingested` tinyint(1) default '0',
    6465  PRIMARY KEY  (`id`),
    6566  KEY `fk_skychunk` (`skychunk`),
  • branches/eam_branches/ipp-20121219/ippToPsps/doc/upgrade.txt

    r35076 r35077  
    11
    2 2012.01.29
     22013.0
     3
     42013.01.29
    35
    46I'm trying to re-work the operational model.  First, make sure we have correct names for concepts:
     
    3032
    3133
    32 2012.01.27
     342013.01.27
    3335
    3436remaining issues:
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/dvo.py

    r35076 r35077  
    3333
    3434    '''
    35     def __init__(self, logger, config, skychunk, scratchDbName=None):
     35    def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDbName=None):
    3636
    3737        # set up logging
     
    3939        self.config = config
    4040        self.skychunk = skychunk
     41        self.ippToPspsDb = ippToPspsDb
    4142
    4243        # set up empty lists
     
    4748        self.regionsIngestedButOutOfDate = []
    4849       
    49         # XXX use Stilts for ingest in certain cases or not?
    50         self.useStilts = 0
    51 
    5250        # connect to the specified scratch database, if a name is given, otherwise use the first version
    5351        try:
     
    5553        except: raise
    5654
     55        # we have (still) 3 modes of ingest from dvo cpt/cps/cpm files
     56        # 1) dvograbber (useFullTables == FALSE),
     57        # 2) jython/stilts (useStilts == TRUE, useFullTables == TRUE)
     58        # 3) dvopsps (useStilts == FALSE, useFullTables == TRUE)
     59        # my goal (EAM, 2013/01/31) is to migrate to only dvopsps
     60
     61        self.useStilts = 0
    5762        self.scratchDb.setUseFullTables(True)
    5863
     
    569574    includes purging detections outside sky area
    570575    '''
    571     def nativeIngestDetections(self, raCenter, decCenter, boxSize):
    572 
    573         # XXX put the skychunk below in a separate method
     576    def nativeIngestDetections(self, boxId, raCenter, decCenter, boxSize):
     577
     578        # XXX put the chunk below in a separate method
     579        # blow away existing dvoDetection table
     580
     581        # clear the 'ingested' field for all boxes
     582        self.ippToPspsDb.clearIngestedBoxes()
    574583       
    575584        # drop detections table
     
    599608        self.loadImages()
    600609
    601         # XXX blow away existing dvoDetection table?
    602 
    603610        # dvopsps -D catdir CATDIR -region .... -dbhost xx -dbname xx -dbuser xx -dbpass xx
    604611        halfSize = boxSize / 2.0
     
    625632        p.wait()
    626633
     634        self.ippToPspsDb.setIngestedBox(boxId)
     635
    627636        # update lists after attempted sync
    628637        # self.printSummary()
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/dvodetections.py

    r35076 r35077  
    2020    Constructor
    2121    '''
    22     def __init__(self, logger, config, skychunk, scratchDbName):
     22    def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDbName):
    2323
    24         super(DvoDetections, self).__init__(logger, config, skychunk, scratchDbName)
     24        super(DvoDetections, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDbName)
    2525
    2626        # declare DVO file types of interest
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/dvoobjects.py

    r35076 r35077  
    2020    Constructor
    2121    '''
    22     def __init__(self, logger, config, skychunk, scratchDbName=None):
     22    def __init__(self, logger, config, skychunk, ippToPspsDb, scratchDbName=None):
    2323
    24         super(DvoObjects, self).__init__(logger, config, skychunk, scratchDbName)
     24        super(DvoObjects, self).__init__(logger, config, skychunk, ippToPspsDb, scratchDbName)
    2525
    2626        # declare DVO file types of interest
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/ipptopspsdb.py

    r35076 r35077  
    894894           if field == 'timestamp': continue
    895895           if field == 'name': continue
     896           if field == 'ingested_det': continue
     897           if field == 'ingested_obj': continue
    896898
    897899           # get current value for this field, if any
     
    10751077
    10761078    '''
     1079    Inserts new box into box table. If it already exisits, it returns existing box id
     1080    '''
     1081    def isBoxIngested(self, id):
     1082
     1083        # set the field 'ingested' to 1 for this box
     1084        sql = "select ingested from box where id = " + str(id)
     1085        try:
     1086            rs = self.executeQuery(sql)
     1087            if not rs.next():
     1088                print "no matching boxes for ", str(id)
     1089                raise
     1090            status = rs.getInt(1)
     1091        except:
     1092            print "failed to set box ", str(id), "as ingested"
     1093            raise
     1094
     1095        return status
     1096    '''
     1097    Inserts new box into box table. If it already exisits, it returns existing box id
     1098    '''
     1099    def setIngestedBox(self, id):
     1100
     1101        # set the field 'ingested' to 1 for this box
     1102        sql = "update box set ingested = 1 where id = " + str(id)
     1103        try:
     1104            self.execute(sql)
     1105        except:
     1106            print "failed to set box ", str(id), "as ingested"
     1107            raise
     1108
     1109    '''
     1110    Inserts new box into box table. If it already exisits, it returns existing box id
     1111    '''
     1112    def clearIngestedBoxes(self):
     1113
     1114        # set the field 'ingested' to 1 for this box
     1115        sql = "update box set ingested = 0"
     1116        try:
     1117            self.execute(sql)
     1118        except:
     1119            print "failed to clear boxes as ingested"
     1120            raise
     1121
     1122    '''
    10771123    Inserts new box ids into the pending table
    10781124    '''
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/loader.py

    r35076 r35077  
    9797        except: return ret
    9898           
    99         self.dvoDetections = DvoDetections(self.logger, self.config, self.skychunk, self.scratchDb.dbName)
     99        self.dvoDetections = DvoDetections(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb.dbName)
    100100
    101101        return ret
     
    197197                            # need to work out a good boundary / region strategy in coordination with
    198198                            # impact of mysql insertion
    199                             self.dvoDetections.nativeIngestDetections(boxDim['RA'], boxDim['DEC'], boxSizeSansBorder)
     199                            if not self.ippToPspsDb.isBoxIngested(boxId):
     200                                self.dvoDetections.nativeIngestDetections(boxId, boxDim['RA'], boxDim['DEC'], boxSizeSansBorder)
     201
    200202                            useFullTables = 1
    201203               
     
    215217                        break
    216218                    self.logger.infoPair("processed","ok")
     219
    217220            if abort or not self.checkClientStatus(): abort = True
    218221            elif numAttempts > 1 and not self.waitForPollTime():  break
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/objectbatch.py

    r35076 r35077  
    5454
    5555       try:
    56            self.dvoObjects = DvoObjects(self.logger, self.config, self.skychunk, self.scratchDb.dbName)
     56           self.dvoObjects = DvoObjects(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb.dbName)
    5757       except:
    5858           self.logger.errorPair("Unable to create instance of", "DvoObjects")
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/queue.py

    r35076 r35077  
    3232
    3333        try:
    34             self.dvoObjects = DvoObjects(self.logger, self.config, self.skychunk)
     34            self.dvoObjects = DvoObjects(self.logger, self.config, self.skychunk, self.ippToPspsDb)
    3535        except:
    3636            self.exitProgram("Unable to create instance of DvoObject")
     
    6464
    6565                # for object batches, get full list of stuff from Dvo
     66                # XXX : need to fix 'dvo.setSkyArea' or this may not return the full list for a parallel dvo
    6667                if batchType == "OB":
    6768                    self.dvoObjects.setSkyArea(
  • branches/eam_branches/ipp-20121219/ippToPsps/test/fulltest.sh

    r35076 r35077  
    2929set mkdummy      = 0
    3030set initscratch  = 0
    31 set camqueue     = 0
     31set camqueue     = 1
    3232set initbatch    = 0
    33 set cambatch     = 0
    34 set stackqueue   = 1
    35 set stackbatch   = 1
    36 set objectqueue  = 1
    37 set objectbatch  = 1
     33set cambatch     = 1
     34set stackqueue   = 0
     35set stackbatch   = 0
     36set objectqueue  = 0
     37set objectbatch  = 0
    3838
    3939set OUTDIR = "testdata"
Note: See TracChangeset for help on using the changeset viewer.