IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31861


Ignore:
Timestamp:
Jul 11, 2011, 3:44:09 PM (15 years ago)
Author:
rhenders
Message:

removed dodgy cross-database querying method getUnprocessedIDsForThisStage(); added method to return a list of processed IDs instead

File:
1 edited

Legend:

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

    r31858 r31861  
    5959    TODO
    6060    '''
    61     def getUnprocessedIDsForThisStage(self, dvoDb, batchType, startDate):
    62 
    63         if batchType == "P2": # TODO define these someplace
    64 
    65             stage = "cam"
    66             sql = "SELECT DISTINCT stage_id \
    67                    FROM gpc1.addRun \
    68                    WHERE stage = '" + stage + "' \
    69                    AND dvodb = '" + dvoDb + "' \
    70                    AND state = 'full' \
    71                    AND stage_id NOT IN "
    72 
    73         elif batchType == "ST":
    74 
    75             stage = "staticsky"
    76             sql = "SELECT DISTINCT stack_id \
    77                    FROM gpc1.staticskyInput \
    78                    JOIN gpc1.addRun ON(gpc1.staticskyInput.sky_id = gpc1.addRun.stage_id) \
    79                    WHERE stage = '" + stage + "' \
    80                    AND dvodb = '" + dvoDb + "' \
    81                    AND state = 'full' \
    82                    AND stack_id NOT IN "
    83 
    84         sql = sql + "(SELECT stage_id \
    85               FROM batch \
    86               WHERE batch_type = '" + batchType + "' \
    87               AND timestamp > '" + startDate + "' \
    88               AND loaded_to_datastore)"
     61    def getProcessedIDsForThisStage(self, batchType, startDate):
     62
     63        sql = "SELECT stage_id \
     64               FROM batch \
     65               WHERE batch_type = '" + batchType + "' \
     66               AND timestamp > '" + startDate + "' \
     67               AND loaded_to_datastore"
    8968
    9069        ids = []
     
    9473                ids.append(rs.getInt(1))
    9574        except:
    96             self.logger.exception("Can't query for ids in DVO")
     75            self.logger.exception("Can't query for processed ids in ipptopsps Db")
    9776
    9877        rs.close()
    9978
    100         self.logger.debug("Found %d unprocessed items in DVO database '%s' for stage='%s'" % (len(ids), dvoDb, stage))
     79        self.logger.debug("Found %d processed and published items for batchType='%s'" % (len(ids), batchType))
    10180
    10281        return ids
Note: See TracChangeset for help on using the changeset viewer.