IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 28, 2015, 8:28:32 PM (11 years ago)
Author:
eugene
Message:

merge changes from trunk

File:
1 edited

Legend:

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

    r37763 r38052  
    401401        # XXX EAM 2014072 : Is this still a problem?
    402402        sql = "UPDATE " + pspsTableName + " SET psfFlux = 1e20 WHERE psfFlux <= 0.0"
    403         self.scratchDb.execute(sql)
    404        
     403        try: self.scratchDb.execute(sql)
     404        except:
     405            self.logger.infoPair("failed sql",sql)
     406            raise
    405407        sql = "UPDATE " + pspsTableName + " SET apFlux = 1e20 WHERE apFlux <= 0.0"
    406         self.scratchDb.execute(sql)
    407 
     408        try: self.scratchDb.execute(sql)
     409        except:
     410            self.logger.infoPair("failed sql",sql)
     411            raise
    408412        sql = "UPDATE " + pspsTableName + " SET kronFlux = 1e20 WHERE kronFlux <= 0.0"
    409         self.scratchDb.execute(sql)
    410 
     413        try: self.scratchDb.execute(sql)
     414        except:
     415            self.logger.infoPair("failed sql",sql)
     416            raise
    411417        # we don't delete these anymore
    412418        results['NULLINSTFLUX'] = 0;
     
    604610               AND b.imageID = " + str(imageID)
    605611
    606         self.scratchDb.execute(sql)
    607 
     612        try: self.scratchDb.execute(sql)
     613        except:
     614            self.logger.InfoPair("failed sql",sql)
     615            raise
    608616    '''
    609617    Updates table and generates pspsuniqueids
     
    611619
    612620    def updatePspsUniqueIDs(self,table, ota):
    613         sql = "UPDATE "+table+" join (select @r:=@r+1 rownum, objID from \
    614         (select @r:=0) r, "+table+" t) as foo using (objID) set \
    615         uniquePspsP2id = ((" +str(self.batchID)+ "*1000000000 ) \
    616         + (" +str(ota) + "*10000000  )+rownum)"
     621        #sql = "UPDATE "+table+" join (select @r:=@r+1 rownum, objID from \
     622        #(select @r:=0) r, "+table+" t) as foo using (objID) set \
     623        #uniquePspsP2id = ((" +str(self.batchID)+ "*1000000000 ) \
     624        #+ (" +str(ota) + "*10000000  )+rownum)"
     625        sql = "UPDATE "+table+" set uniquePspsP2id = (("+str(self.batchID)+"*1000000000 ) + (" +str(ota) + "*10000000  )+ row)"
    617626        try: self.scratchDb.execute(sql)
    618627        except:
     
    647656        #self.logger.info("successful populate ");
    648657        # now add DVO IDs
     658        self.logger.infoPair("Adding 'row' column to ", "Detection_"+chipname)
     659        #detection has a primary index, so don't add, use this one
     660        self.scratchDb.addRowCountColumnNoKey("Detection_"+chipname, "row")
    649661        self.updateDvoIDs("Detection_" + chipname, self.imageIDs[chipname])
    650662        #self.logger.info("updated dvoids")
    651663        results['NULLOBJID'] = self.scratchDb.reportAndDeleteRowsWithNULLS("Detection_" + chipname, "objID")
    652664        #self.logger.info("deleted nulls")
     665
     666        ota = x*10+y
     667
     668
    653669        self.logger.info("add psps unique p2 ids")
    654         ota = x*10+y
    655670        self.updatePspsUniqueIDs("Detection_" + chipname, ota)
     671        self.logger.infoPair("Dropping 'row' column from ", "Detection_"+chipname)
     672        self.scratchDb.dropColumn("Detection_"+chipname,"row")
    656673        self.updateImageID("Detection_" + chipname, x, y)
    657674        #self.logger.info("updateImageId")
Note: See TracChangeset for help on using the changeset viewer.