IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33160


Ignore:
Timestamp:
Jan 26, 2012, 12:23:08 PM (14 years ago)
Author:
rhenders
Message:

method to check we are ingesting the correct DVO; method to calculate total DVO file-size ingested

File:
1 edited

Legend:

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

    r33155 r33160  
    196196            rs.first()
    197197            if rs.getInt(1) > 0:
    198                 self.logger.errorPair("Already imported up-to-date version of",  path)
     198                self.logger.debugPair("Already imported up-to-date version of",  path)
    199199                return True
    200200            else:
     
    219219        self.execute(sql)
    220220       
     221    '''
     222    Gets total size of DVO files imported to this database
     223    Counts only cpm and cpt files
     224    '''
     225    def getTotalSizeOfIngestedDvoFiles(self):
     226
     227        sql = "SELECT SUM(size) FROM " + self.dvoDoneTable + " where path LIKE '%cpm' OR path LIKE '%cpt'"
     228        try:
     229            rs = self.executeQuery(sql) 
     230            rs.first()
     231            size = rs.getLong(1)
     232        except:
     233            self.logger.errorPair("Unable to get total ingested DVO size", sql)
     234
     235        return size
     236
     237    '''
     238    Checks whether DVO files we have ingested are form the DVO path provided
     239    '''
     240    def isThisDvoCurrentlyIngested(self, path):
     241
     242        sql = "SELECT path FROM " + self.dvoDoneTable + " where path LIKE '%Images.dat'"
     243        try:
     244            rs = self.executeQuery(sql) 
     245            rs.first()
     246
     247            head,tail = os.path.split(rs.getString(1))
     248
     249            if head == path:
     250                self.logger.infoPair("Already ingested stuff from DVO at", path)
     251                return True
     252            else:
     253                self.logger.errorPair("DVO does not match. We have", head)
     254                return False
     255
     256        except:
     257            self.logger.errorPair("No DVO files ingested for this path", path)
     258            return False
     259
    221260    '''
    222261    Checks whether the astrometric solution is ok for this chip
Note: See TracChangeset for help on using the changeset viewer.