IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 6, 2013, 3:16:35 PM (13 years ago)
Author:
eugene
Message:

upgrade to ippToPsps (see doc/upgrade.txt): adds native dvo to mysql ingest operations, adds autogen configuration & installation, splits out global config information from new "skychunk" information (current region on the sky being processed), adds test suites

Location:
trunk/ippToPsps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps

  • trunk/ippToPsps/jython

    • Property svn:ignore
      •  

        old new  
        11*.class
         2Makefile
         3Makefile.in
  • trunk/ippToPsps/jython/ipptopspsdb.py

    r34661 r35097  
    1717    Constructor
    1818    '''
    19     def __init__(self, logger, config):
    20         super(IppToPspsDb, self).__init__(logger, config, "ipptopspsdatabase")
     19    def __init__(self, logger, config, skychunk):
     20        if (config.test):
     21            dbType = "ipptopspsdatabase_test"
     22        else:
     23            dbType = "ipptopspsdatabase"
     24        super(IppToPspsDb, self).__init__(logger, config, dbType)
     25
     26        self.skychunk = skychunk
    2127
    2228        self.MAX_FAILS = 5
     
    2935        sql = "SELECT DISTINCT batch_id \
    3036               FROM batch \
    31                WHERE timestamp > '" + self.config.epoch + "' \
     37               WHERE timestamp > '" + self.skychunk.epoch + "' \
    3238               AND batch_type = '" + batchType + "' \
    33                AND dvo_db = '" + self.config.dvoLabel + "' \
     39               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    3440               AND merged = 1 \
    3541               AND " + column + " = 0"
     
    5460        sql = "SELECT DISTINCT batch_id \
    5561               FROM batch \
    56                WHERE timestamp > '" + self.config.epoch + "' \
     62               WHERE timestamp > '" + self.skychunk.epoch + "' \
    5763               AND batch_type = '" + batchType + "' \
    58                AND dvo_db = '" + self.config.dvoLabel + "' \
     64               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    5965               AND purged = 1 \
    6066               AND " + column + " = 0"
     
    8086        sql = "SELECT DISTINCT batch_id \
    8187               FROM batch \
    82                WHERE timestamp > '" + self.config.epoch + "' \
     88               WHERE timestamp > '" + self.skychunk.epoch + "' \
    8389               AND batch_type = '" + batchType + "' \
    84                AND dvo_db = '" + self.config.dvoLabel + "' \
     90               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    8591               AND (loaded_to_ODM = -1 OR merge_worthy = 1) \
    8692               AND " + column + " = 0"
     
    148154        sql = "SELECT DISTINCT batch_id \
    149155               FROM batch \
    150                WHERE timestamp > '" + self.config.epoch + "' \
     156               WHERE timestamp > '" + self.skychunk.epoch + "' \
    151157               AND batch_type = '" + batchType + "' \
    152                AND dvo_db = '" + self.config.dvoLabel + "' \
     158               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    153159               AND processed = 1\
    154160               AND loaded_to_datastore != 1 \
     
    177183        sql = "SELECT batch_id \
    178184               FROM batch \
    179                WHERE timestamp > '" + self.config.epoch + "' \
    180                AND dvo_db = '" + self.config.dvoLabel + "' \
     185               WHERE timestamp > '" + self.skychunk.epoch + "' \
     186               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    181187               AND loaded_to_datastore = 1 \
    182188               AND batch_type = '" + batchType + "' \
     
    206212        sql = "SELECT batch_id \
    207213               FROM batch \
    208                WHERE timestamp > '" + self.config.epoch + "' \
    209                AND dvo_db = '" + self.config.dvoLabel + "' \
     214               WHERE timestamp > '" + self.skychunk.epoch + "' \
     215               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    210216               AND loaded_to_datastore = 1 \
    211217               AND batch_type = '" + batchType + "' \
     
    235241        sql = "SELECT batch_id \
    236242               FROM batch \
    237                WHERE timestamp > '" + self.config.epoch + "' \
    238                AND dvo_db = '" + self.config.dvoLabel + "' \
     243               WHERE timestamp > '" + self.skychunk.epoch + "' \
     244               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    239245               AND merge_worthy = 1 \
    240246               AND batch_type = '" + batchType + "' \
     
    262268        sql = "SELECT DISTINCT batch_id \
    263269               FROM batch \
    264                WHERE timestamp > '" + self.config.epoch + "' \
    265                AND dvo_db = '" + self.config.dvoLabel + "' \
     270               WHERE timestamp > '" + self.skychunk.epoch + "' \
     271               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    266272               AND " + column + " = " + str(value)
    267273
     
    288294               FROM batch \
    289295               WHERE batch_type = '" + batchType + "' \
    290                AND timestamp > '" + self.config.epoch + "' \
    291                AND dvo_db = '" + self.config.dvoLabel + "' \
     296               AND timestamp > '" + self.skychunk.epoch + "' \
     297               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    292298               AND processed = 1 \
    293299               AND loaded_to_datastore = 1 \
     
    315321               FROM batch \
    316322               WHERE batch_type = '" + batchType + "' \
    317                AND timestamp > '" + self.config.epoch + "' \
    318                AND dvo_db = '" + self.config.dvoLabel + "' \
     323               AND timestamp > '" + self.skychunk.epoch + "' \
     324               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    319325               AND " + column + " = " + str(value)
    320326
     
    387393               WHERE batch_type = '" + batchType + "' \
    388394               AND processed = 1 \
    389                AND timestamp > '" + self.config.epoch + "' \
    390                AND dvo_db = '" + self.config.dvoLabel + "' \
     395               AND timestamp > '" + self.skychunk.epoch + "' \
     396               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    391397               AND timestamp BETWEEN now() - INTERVAL " + interval + " AND now()"
    392398
     
    412418               WHERE batch_type = '" + batchType + "' \
    413419               AND loaded_to_datastore = 1 \
    414                AND timestamp > '" + self.config.epoch + "' \
    415                AND dvo_db = '" + self.config.dvoLabel + "' \
     420               AND timestamp > '" + self.skychunk.epoch + "' \
     421               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    416422               ORDER BY timestamp DESC LIMIT 1"
    417423
     
    511517               WHERE stage_id = " + str(stage_id) + " \
    512518               AND batch_type = '" + batchType + "' \
    513                AND dvo_db = '" + self.config.dvoLabel + "' \
     519               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    514520               AND batch_type != 'IN' \
    515521               AND timestamp BETWEEN now() - INTERVAL 12 HOUR AND now()"
     
    554560               WHERE stage_id = " + str(stage_id) + " \
    555561               AND batch_type = '" + batchType + "' \
    556                AND timestamp > '" + self.config.epoch + "' \
    557                AND dvo_db = '" + self.config.dvoLabel + "' \
     562               AND timestamp > '" + self.skychunk.epoch + "' \
     563               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    558564               AND batch_type != 'IN' \
    559565               AND processed = 1"
     
    579585               WHERE stage_id = " + str(stage_id) + " \
    580586               AND batch_type = '" + batchType + "' \
    581                AND timestamp > '" + self.config.epoch + "' \
    582                AND dvo_db = '" + self.config.dvoLabel + "' \
     587               AND timestamp > '" + self.skychunk.epoch + "' \
     588               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    583589               AND processed = -1"
    584590
     
    602608               FROM batch \
    603609               WHERE batch_type = '" + batchType + "' \
    604                AND timestamp > '" + self.config.epoch + "' \
    605                AND dvo_db = '" + self.config.dvoLabel + "' \
     610               AND timestamp > '" + self.skychunk.epoch + "' \
     611               AND dvo_db = '" + self.skychunk.dvoLabel + "' \
    606612               AND processed = -1 \
    607613               GROUP BY stage_id HAVING numoccur >= " + str(self.MAX_FAILS)
     
    634640        batchID = -1;
    635641
    636         if self.config.force or \
     642        if self.skychunk.force or \
    637643            (not self.alreadyProcessed(batchType, stageID) \
    638644            and not self.processingNow(batchType, stageID) \
     
    650656                       '" + batchType + "', \
    651657                       " + str(stageID) + ", \
    652                        '" + self.config.survey + "', \
    653                        '" + self.config.dvoLabel + "', \
    654                        '" + self.config.datastoreProduct + "' \
     658                       '" + self.skychunk.survey + "', \
     659                       '" + self.skychunk.dvoLabel + "', \
     660                       '" + self.skychunk.datastoreProduct + "' \
    655661                       )"
    656662            self.logger.infoPair("heather:","sql")
     
    749755
    750756    '''
    751     Sets the config field for this client
    752     '''
    753     def setConfigForThisClient(self, config, host, pid):
    754 
    755         self.execute("UPDATE clients SET config = '" + config + "' \
     757    Sets the skychunk field for this client
     758    '''
     759    def setSkychunkForThisClient(self, skychunk, host, pid):
     760
     761        self.execute("UPDATE clients SET skychunk = '" + skychunk + "' \
    756762                WHERE host = '" + host + "' \
    757763                AND pid = " + str(pid))
    758     '''
    759     Sets the config field for a set of loader clients
    760     '''
    761     def setConfigForLoaders(self, config, ids):
     764
     765    '''
     766    Sets the skychunk field for a set of loader clients
     767    '''
     768    def setSkychunkForLoaders(self, skychunk, ids):
    762769
    763770        for id in ids:
    764             self.execute("UPDATE clients SET config = '" + config + "' \
     771            self.execute("UPDATE clients SET skychunk = '" + skychunk + "' \
    765772                    WHERE type = 'loader.py' \
    766773                    AND id = " + str(id))
     
    796803    '''
    797804    def insertClient(self, type, host, pid):
    798         self.execute("INSERT INTO clients (timestamp, type, host, pid, config) VALUES (now(), '" + type + "', '" + host + "', " + str(pid) + ", '" + self.config.name + "')")
     805        self.execute("INSERT INTO clients (timestamp, type, host, pid, skychunk) VALUES (now(), '" + type + "', '" + host + "', " + str(pid) + ", '" + self.skychunk.name + "')")
    799806
    800807    '''
     
    831838        try:
    832839            rs = self.executeQuery(sql)
    833             rs.first()
     840            if rs.first() is False:  return False
    834841            if rs.getInt(1) == 1: return True
    835842            else: return False
     
    840847
    841848    '''
    842     Returns a list of available configs
    843     '''
    844     def getActiveConfigList(self):
     849    Returns a list of available skychunks
     850    '''
     851    def getActiveSkychunkList(self):
    845852       
    846         sql = "SELECT DISTINCT name FROM config WHERE active = 1 ORDER BY name"
    847 
    848         configs = []
    849         try:
    850             rs = self.executeQuery(sql)
    851             while (rs.next()): configs.append(rs.getString(1))
    852         except:
    853             self.logger.errorPair("Can't get config names", sql)
     853        sql = "SELECT DISTINCT name FROM skychunk WHERE active = 1 ORDER BY name"
     854
     855        skychunks = []
     856        try:
     857            rs = self.executeQuery(sql)
     858            while (rs.next()): skychunks.append(rs.getString(1))
     859        except:
     860            self.logger.errorPair("Can't get skychunk names", sql)
    854861        finally:
    855862            rs.close()
    856863
    857         return configs
    858 
    859     '''
    860     Prompts user for info about a new or existing config and lets them neter the various details
    861     '''
    862     def editConfig(self):
     864        return skychunks
     865
     866    '''
     867    Prompts user for info about a new or existing skychunk and lets them neter the various details
     868    '''
     869    def editSkychunk(self):
    863870
    864871       print " ********************************************************************"
    865        print " *              Config editor"
     872       print " *              Skychunk editor"
    866873       print " *"
    867        response = raw_input(" * Name for new config, or existing config to edit? ")
     874       response = raw_input(" * Name for new skychunk, or existing skychunk to edit? ")
    868875       if response == "": return
    869        self.config.name = response
    870 
    871        # attempt to insert new config, if it already exists then carry on with update
    872        sql = "INSERT INTO config (name) VALUES ('" + self.config.name + "')"
     876       self.skychunk.name = response
     877
     878       # attempt to insert new skychunk, if it already exists then carry on with update
     879       sql = "INSERT INTO skychunk (name) VALUES ('" + self.skychunk.name + "')"
    873880       try:       
    874881           self.execute(sql)
    875882       except: pass
    876883
    877        # for each column in the config table
    878        sql = "SHOW COLUMNS FROM config"
     884       # for each column in the skychunk table
     885       sql = "SHOW COLUMNS FROM skychunk"
    879886       rs = self.executeQuery(sql)
    880887       while (rs.next()):
     
    887894           if field == 'timestamp': continue
    888895           if field == 'name': continue
     896           if field == 'ingested_det': continue
     897           if field == 'ingested_obj': continue
    889898
    890899           # get current value for this field, if any
    891900           try:
    892                rs2 = self.executeQuery("SELECT " + field + " FROM config WHERE name = '" + self.config.name + "'")
     901               rs2 = self.executeQuery("SELECT " + field + " FROM skychunk WHERE name = '" + self.skychunk.name + "'")
    893902               rs2.first()
    894903               default = rs2.getString(1)
     
    907916               if type.find("varchar") != -1 or type.find("timestamp") != -1: quotes = "'"
    908917               else: quotes = ""
    909                self.execute("UPDATE config SET " + field + " = " + quotes + response + quotes + " WHERE name = '" + self.config.name + "'")
     918               self.execute("UPDATE skychunk SET " + field + " = " + quotes + response + quotes + " WHERE name = '" + self.skychunk.name + "'")
    910919       
    911920       print " *"
     
    913922
    914923    '''
    915     Returns config for this client
    916     '''
    917     def getConfigForThisClient(self, host, pid):
    918 
    919         sql = "SELECT config \
     924    Returns skychunk for this client
     925    '''
     926    def getSkychunkForThisClient(self, host, pid):
     927
     928        sql = "SELECT skychunk \
    920929               FROM clients \
    921930               WHERE host = '" + host + "' \
     
    925934            rs = self.executeQuery(sql)
    926935            rs.first()
    927             self.config.name = rs.getString(1)
    928         except:
    929             self.logger.errorPair("No config set for", "%s (pid=%d)" % (host, pid))
    930             self.config.isLoaded = False
     936            self.skychunk.name = rs.getString(1)
     937        except:
     938            self.logger.errorPair("No skychunk set for", "%s (pid=%d)" % (host, pid))
     939            self.skychunk.isLoaded = False
    931940            return False
    932941
     
    934943
    935944    '''
    936     Reads config from the database and populates Config object
    937     '''
    938     def readConfig(self, host, pid):
    939 
    940         # first get config defined for this client
    941         if not self.getConfigForThisClient(host, pid): return False
    942 
    943         # now load that config
     945    Reads skychunk from the database and populates Skychunk object
     946    '''
     947    def readSkychunk(self, host, pid):
     948
     949        # first get skychunk defined for this client
     950        if not self.getSkychunkForThisClient(host, pid): return False
     951
     952        # now load that skychunk
    944953        sql = "SELECT \
    945954        datastore_product \
     
    964973        ,queue_ST \
    965974        ,queue_OB \
    966         FROM config \
    967         WHERE name = '" + self.config.name + "'"
    968 
    969         self.config.batchTypes = []
    970         try:
    971             rs = self.executeQuery(sql)
     975        ,parallel \
     976        FROM skychunk \
     977        WHERE name = '" + self.skychunk.name + "'"
     978
     979        self.skychunk.batchTypes = []
     980        try:
     981            rs = self.executeQuery(sql)
     982
    972983            rs.first()
    973             self.config.datastoreProduct = rs.getString(1)
    974             self.config.datastoreType = rs.getString(2)
    975             if rs.getInt(3) == 1: self.config.datastorePublishing = True
    976             else: self.config.datastorePublishing = False
    977             self.config.dvoLabel = rs.getString(4)
     984            self.skychunk.datastoreProduct = rs.getString(1)
     985            self.skychunk.datastoreType = rs.getString(2)
     986            if rs.getInt(3) == 1: self.skychunk.datastorePublishing = True
     987            else: self.skychunk.datastorePublishing = False
     988            self.skychunk.dvoLabel = rs.getString(4)
    978989
    979990            # if dvoLabel is null is can break queries, so set to something
    980             if not self.config.dvoLabel: self.config.dvoLabel = "none"
    981             self.config.dvoLocation = rs.getString(5)
    982             self.config.minRa = rs.getDouble(6)
    983             self.config.maxRa = rs.getDouble(7)
    984             self.config.minDec = rs.getDouble(8)
    985             self.config.maxDec = rs.getDouble(9)
    986 
    987             self.config.boxSize = rs.getDouble(10)
    988             self.config.halfBox = self.config.boxSize/2.0
    989             self.config.boxSizeWithBorder = self.config.boxSize + (self.config.BORDER * 2)
    990 
    991             self.config.basePath = rs.getString(11)
    992             self.config.dataRelease = rs.getInt(12)
    993             self.config.deleteLocal = rs.getInt(13)
    994             self.config.deleteDatastore = rs.getInt(14)
    995             self.config.deleteDxLayer = rs.getInt(15)
    996             self.config.epoch = rs.getString(16)
    997             self.config.survey = rs.getString(17)
    998             self.config.pspsSurvey = rs.getString(18)
    999             if rs.getInt(19) == 1: self.config.batchTypes.append("P2")
    1000             if rs.getInt(20) == 1: self.config.batchTypes.append("ST")
    1001             if rs.getInt(21) == 1: self.config.batchTypes.append("OB")
    1002             self.config.force = False # TODO
    1003             self.config.test = False # TODO
    1004             self.config.isLoaded = True
    1005         except:
    1006             self.logger.errorPair("Could not read config with name", self.config.name)
    1007             self.config.isLoaded = False
    1008 
    1009         return self.config.isLoaded
     991            if not self.skychunk.dvoLabel: self.skychunk.dvoLabel = "none"
     992            self.skychunk.dvoLocation = rs.getString(5)
     993            self.skychunk.minRa = rs.getDouble(6)
     994            self.skychunk.maxRa = rs.getDouble(7)
     995            self.skychunk.minDec = rs.getDouble(8)
     996            self.skychunk.maxDec = rs.getDouble(9)
     997
     998            self.skychunk.boxSize = rs.getDouble(10)
     999            self.skychunk.halfBox = self.skychunk.boxSize/2.0
     1000            self.skychunk.boxSizeWithBorder = self.skychunk.boxSize + (self.skychunk.BORDER * 2)
     1001
     1002            self.skychunk.basePath = rs.getString(11)
     1003            self.skychunk.dataRelease = rs.getInt(12)
     1004
     1005            self.skychunk.deleteLocal = rs.getInt(13)
     1006            self.skychunk.deleteDatastore = rs.getInt(14)
     1007            self.skychunk.deleteDxLayer = rs.getInt(15)
     1008
     1009            self.skychunk.epoch = rs.getString(16)
     1010
     1011            self.skychunk.survey = rs.getString(17)
     1012            self.skychunk.pspsSurvey = rs.getString(18)
     1013
     1014            if rs.getInt(19) == 1: self.skychunk.batchTypes.append("P2")
     1015            if rs.getInt(20) == 1: self.skychunk.batchTypes.append("ST")
     1016            if rs.getInt(21) == 1: self.skychunk.batchTypes.append("OB")
     1017
     1018            self.skychunk.force = True # TODO
     1019            self.skychunk.parallel = False # TODO
     1020
     1021            if rs.getInt(22) == 1: self.skychunk.parallel = True
     1022
     1023            if self.skychunk.parallel: print "USING parallel"
     1024            self.skychunk.isLoaded = True
     1025        except:
     1026            self.logger.errorPair("Could not read skychunk with name", self.skychunk.name)
     1027            self.skychunk.isLoaded = False
     1028
     1029        return self.skychunk.isLoaded
    10101030
    10111031    '''
     
    10151035
    10161036        sql = "SELECT id FROM box \
    1017                WHERE config  = '" + self.config.name + "' \
     1037               WHERE skychunk  = '" + self.skychunk.name + "' \
    10181038               AND ra_center = " + str(ra) + " \
    10191039               AND dec_center = " + str(dec) + " \
    1020                AND box_side = " + str(self.config.boxSize)
     1040               AND box_side = " + str(self.skychunk.boxSize)
    10211041
    10221042        id = -1
     
    10341054    '''
    10351055    def removeAllBoxes(self):
    1036         self.execute("DELETE FROM box WHERE config = '" + self.config.name + "'")
     1056        self.execute("DELETE FROM box WHERE skychunk = '" + self.skychunk.name + "'")
    10371057
    10381058    '''
     
    10471067
    10481068            sql = "INSERT INTO box \
    1049                    (config, ra_center, dec_center, box_side) \
     1069                   (skychunk, ra_center, dec_center, box_side) \
    10501070                   VALUES \
    1051                    ('" + self.config.name + "', " + str(ra) + ", " + str(dec) + ", " + str(self.config.boxSize) + ")"
     1071                   ('" + self.skychunk.name + "', " + str(ra) + ", " + str(dec) + ", " + str(self.skychunk.boxSize) + ")"
    10521072
    10531073            self.execute(sql)
     
    10551075
    10561076        return id
     1077
     1078    '''
     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
    10571121
    10581122    '''
     
    10881152               FROM box \
    10891153               JOIN pending ON (id = box_id) \
    1090                WHERE config = '" + self.config.name + "' \
     1154               WHERE skychunk = '" + self.skychunk.name + "' \
    10911155               AND batch_type = '" + batchType + "' \
    10921156               AND ra_center NOT IN \
    10931157               (SELECT ra_center \
    10941158                FROM stripe \
    1095                 WHERE config = '" + self.config.name + "') \
     1159                WHERE skychunk = '" + self.skychunk.name + "') \
    10961160               GROUP BY ra_center LIMIT 1"
     1161
     1162        # XXX print "sql: ", sql               
    10971163
    10981164        try:
     
    11061172                   FROM box \
    11071173                   JOIN pending ON (id = box_id) \
    1108                    WHERE config = '" + self.config.name + "' \
     1174                   WHERE skychunk = '" + self.skychunk.name + "' \
    11091175                   AND batch_type = '" + batchType + "' \
    11101176                   GROUP BY ra_center \
     
    11261192               WHERE ra_center = " + str(raCenter) + " \
    11271193               AND batch_type = '" + batchType + "' \
    1128                AND config = '" + self.config.name + "' \
     1194               AND skychunk = '" + self.skychunk.name + "' \
    11291195               ORDER BY dec_center DESC"
    11301196
     
    11591225        # now insert new stripe entry
    11601226        sql = "INSERT INTO stripe \
    1161                (client_id, config, ra_center) \
    1162                SELECT clients.id, clients.config, " + str(raCenter) + " \
     1227               (client_id, skychunk, ra_center) \
     1228               SELECT clients.id, clients.skychunk, " + str(raCenter) + " \
    11631229               FROM clients \
    11641230               WHERE host = '" + host + "' \
     
    11881254
    11891255    '''
    1190     Returns ids for pending items for this config
     1256    Returns ids for pending items for this skychunk
    11911257    '''
    11921258    def getPendingIds(self, batchType):
     
    11951261               FROM pending \
    11961262               JOIN box ON (box_id = id) \
    1197                WHERE config = '" + self.config.name + "' \
     1263               WHERE skychunk = '" + self.skychunk.name + "' \
    11981264               AND batch_type = '" + batchType + "'"
    11991265
     
    12041270            rs.close()
    12051271        except:
    1206             self.logger.errorPair("Can't get pending ids for this config", sql)
     1272            self.logger.errorPair("Can't get pending ids for this skychunk", sql)
    12071273
    12081274        return ids
     
    12351301               WHERE stage_id = " + str(stageID) + " \
    12361302               AND batch_type = '" + batchType + "' \
    1237                AND config = '" + self.config.name + "'"
     1303               AND skychunk = '" + self.skychunk.name + "'"
    12381304
    12391305        self.execute(sql)
    12401306
    12411307    '''
    1242     Writes density-plot data to file for pending stuff over sky for given config
     1308    Writes density-plot data to file for pending stuff over sky for given skychunk
    12431309    '''
    12441310    def createPendingDensityPlotData(self, batchType, DATFILE):
     
    12461312        sql = "SELECT id, ra_center, dec_center \
    12471313               FROM box \
    1248                WHERE config = '" + self.config.name + "' \
     1314               WHERE skychunk = '" + self.skychunk.name + "' \
    12491315               ORDER BY ra_center, dec_center"
    12501316
     
    12991365    def getItemsInThisThisBox(self, ra, dec):
    13001366
    1301         halfSide = self.config.boxSize/2.0
     1367        halfSide = self.skychunk.boxSize/2.0
    13021368        minRa =  ra-halfSide
    13031369        maxRa = ra+halfSide
     
    13281394               FROM stripe \
    13291395               JOIN clients ON (client_id = id) \
    1330                WHERE clients.config = '" + self.config.name + "' \
     1396               WHERE clients.skychunk = '" + self.skychunk.name + "' \
    13311397               ORDER BY host, started"
    13321398
Note: See TracChangeset for help on using the changeset viewer.