Changeset 31400
- Timestamp:
- Apr 28, 2011, 3:49:05 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/gpc1db.py (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/gpc1db.py
r31345 r31400 34 34 def getIDsInThisDVODbForThisStage(self, dvoDb, stage): 35 35 36 self.logger.debug("Querying GPC1 for sky_ids in this DVO database: " + dvoDb)37 38 36 sql = "SELECT DISTINCT stage_id \ 39 37 FROM addRun \ … … 44 42 rs = self.stmt.executeQuery(sql) 45 43 except: 46 self.logger.exception("Can't query for sky_ids")44 self.logger.exception("Can't query for ids in DVO") 47 45 48 46 ids = [] … … 52 50 rs.close() 53 51 52 self.logger.debug("Found %d items in DVO database '%s' for stage='%s'" % (len(ids), dvoDb, stage)) 53 54 54 return ids 55 55 … … 59 59 def getImageIDsForThisStackID(self, stackID): 60 60 61 self.logger.debug("Querying GPC1 for image IDs for stack ID: " + st ackID)61 self.logger.debug("Querying GPC1 for image IDs for stack ID: " + str(stackID)) 62 62 63 63 sql = "SELECT DISTINCT CONCAT(exp_id, SUBSTR(class_id, 3, 4)) FROM ( \ … … 70 70 JOIN camRun USING(cam_id) \ 71 71 JOIN chipRun USING(chip_id) \ 72 WHERE stackRun.stack_id = " + st ackID+ ") AS a"72 WHERE stackRun.stack_id = " + str(stackID) + ") AS a" 73 73 74 74 try: … … 84 84 return imageIDs 85 85 86 ''' 87 Gets some stack-stage meta data for this sky_id # TODO this SQL could surely be improved 88 ''' 89 def getStackStageMeta(self, skyID, filter): 90 91 self.logger.debug("Querying GPC1 for stack meta data") 92 93 meta = [] 94 sql = "SELECT \ 95 stackRun.stack_id,\ 96 stackRun.skycell_id \ 97 FROM \ 98 staticskyInput, staticskyRun, stackRun, staticskyResult \ 99 WHERE staticskyRun.sky_id = staticskyInput.sky_id \ 100 AND staticskyInput.stack_id = stackRun.stack_id \ 101 AND staticskyInput.sky_id = staticskyResult.sky_id \ 102 and staticskyInput.sky_id = %d \ 103 and filter = '%s'" % (skyID, filter) 104 105 106 try: 107 rs = self.stmt.executeQuery(sql) 108 rs.first() 109 meta.append(rs.getInt(1)) 110 meta.append(rs.getString(2)) 111 except: 112 self.logger.exception("Can't query for stack meta") 113 114 return meta 86 115 ''' 87 116 Gets some camera-stage meta data for this cam_id … … 100 129 rs = self.stmt.executeQuery(sql) 101 130 rs.first() 102 except:103 self.logger.exception("Can't query for camera meta")104 finally:105 131 meta.append(rs.getInt(1)) 106 132 meta.append(rs.getString(2)) 107 133 meta.append(rs.getString(3)) 134 except: 135 self.logger.exception("Can't query for camera meta") 108 136 109 137 return meta … … 114 142 def getCameraStageSmf(self, camID): 115 143 116 self.logger.debug("Querying GPC1 for camera smf files ")144 self.logger.debug("Querying GPC1 for camera smf files with cam_id = " + str(camID)) 117 145 118 146 sql = "SELECT path_base \ … … 136 164 137 165 f=os.popen("neb-ls -p "+path+"/%smf") 138 print "neb-ls -p "+path+"/%smf"139 166 for i in f.readlines(): 140 167 files.append(i.rstrip()) … … 157 184 FROM staticskyResult \ 158 185 WHERE sky_id = %d" % skyID 186 159 187 try: 160 188 rs = self.stmt.executeQuery(sql) … … 165 193 # get path to base dir of cmf files 166 194 path = rs.getString(1) 167 path = path[0:path.rfind("/")]195 #path = path[0:path.rfind("/")] 168 196 169 197 # list all cmf files if a neb path … … 171 199 if path.startswith("neb"): 172 200 173 f=os.popen("neb-ls -p "+path+"/%cmf") 201 f=os.popen("neb-ls -p "+path+"%cmf") 202 print "neb-ls -p "+path+"%cmf" 174 203 for i in f.readlines(): 175 204 files.append(i.rstrip()) 205 print i.rstrip() 176 206 177 207 # or not a neb path 178 208 else: 179 files = glob.glob(path + " /*.cmf")209 files = glob.glob(path + "*.cmf") 180 210 181 211 return files
Note:
See TracChangeset
for help on using the changeset viewer.
