- Timestamp:
- Nov 8, 2011, 2:44:12 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110906
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippToPsps/jython/batch.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110906
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110906/ippToPsps/jython/batch.py
r32332 r32630 39 39 ippToPspsDb, 40 40 id, 41 batchID, 41 42 batchType, 42 43 fits): … … 53 54 self.logger.debug("Batch class constructor") 54 55 55 # check FITS file is ok - TODO could be neater56 if self.fits:57 self.header = self.fits.getPrimaryHeader()58 if not self.header: return59 60 56 # set up class variables 61 57 self.id = id 58 self.batchID = batchID 62 59 self.gpc1Db = gpc1Db 63 60 self.ippToPspsDb = ippToPspsDb 64 61 self.batchType = batchType; 65 62 self.pspsVoTableFilePath = "../config/" + batchType + "/tables.vot" 63 64 # check FITS file is ok 65 if self.fits: 66 self.header = self.fits.getPrimaryHeader() 67 68 # now check that the fits header is readable 69 if not self.header: 70 logger.errorPair("Could not read FITS for id", "%d" % id) 71 return 72 73 # if no fits file, and this is not an IN batch, then get out of here 74 else: 75 if batchType != "IN": 76 logger.errorPair("Could not read FITS for id", "%d" % id) 77 return 66 78 67 79 # get info from config … … 88 100 89 101 # create datastore object 90 self.datastore = Datastore(self.logger, self.doc) 91 92 # create a new batch 93 self.batchID = self.ippToPspsDb.createNewBatch( 94 self.batchType, 95 self.id, 96 self.survey, 97 self.dvoGpc1Label, 98 self.datastore.product) 102 self.datastore = Datastore(self.logger, self.doc, self.ippToPspsDb) 99 103 100 104 # get local storage location from config … … 247 251 248 252 outPath = self.localOutPath + "/BatchManifest.xml" 249 tmpPath = "./tmp.xml"253 tmpPath = self.localOutPath + "/tmp.xml" 250 254 self.logger.infoPair("Creating manifest", outPath) 251 255 root = Element('manifest') … … 263 267 else: root.attrib['maxObjId'] = str(self.maxObjID) 264 268 265 # get md5sum266 #p = Popen("md5sum " + self.outputFitsPath, shell=True, stdout=PIPE)267 #p.wait()268 #out = p.stdout.read()269 #md5sum = out[0:out.rfind(" ")]270 271 # get file size272 #fileSize = os.path.getsize(self.outputFitsPath)273 274 269 # file information 275 270 child = Element('file') 276 271 root.append(child) 277 272 child.attrib['name'] = self.outputFitsFile 278 #child.attrib['bytes'] = str(fileSize)279 #child.attrib['md5'] = md5sum280 273 281 274 # now create doc and write to file … … 316 309 317 310 # now publish to the datastore 318 Batch.publishToDatastore(self.datastore, self. ippToPspsDb, self.batchID, self.batchName, self.subDir, tarballFile)311 Batch.publishToDatastore(self.datastore, self.batchID, self.batchName, self.subDir, tarballFile) 319 312 320 313 ''' … … 322 315 ''' 323 316 @staticmethod 324 def publishToDatastore(datastore, ippToPspsDb, batchID, batchName, subDir, tarballFile): 325 326 if datastore.publish(batchName, subDir, tarballFile, "tgz"): 327 ippToPspsDb.updateLoadedToDatastore(batchID, 1) 328 else: 329 ippToPspsDb.updateLoadedToDatastore(batchID, -1) 330 317 def publishToDatastore(datastore, batchID, batchName, subDir, tarballFile): 318 datastore.publish(batchName, subDir, tarballFile, "tgz") 331 319 332 320 '''
Note:
See TracChangeset
for help on using the changeset viewer.
