- Timestamp:
- Dec 2, 2011, 11:45:13 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20111122/ippToPsps/jython/batch.py
r32596 r32852 286 286 Publishes this batch to the datastore 287 287 ''' 288 def tar ZipAndpublishToDatastore(self):288 def tarAndZip(self): 289 289 290 290 # set up filenams and paths … … 295 295 296 296 # tar directory 297 p = Popen("tar -cvf " + tarPath + "\298 -C " + self.subDir + " \299 " + self.batchName, shell=True, stdout=PIPE)297 cmd = "tar -cvf " + tarPath + " -C " + self.subDir + " " + self.batchName 298 self.logger.infoPair("Creating tar archive", cmd) 299 p = Popen(cmd, shell=True, stdout=PIPE) 300 300 p.wait() 301 301 302 if p.returncode != 0: 303 self.logger.errorPair("tar command", "failed") 304 return False 305 302 306 # zip tar archive 303 p = Popen("gzip -c " + tarPath + " > " + tarballPath, shell=True, stdout=PIPE) 307 cmd = "gzip -c " + tarPath + " > " + tarballPath 308 self.logger.infoPair("Compressing tar archive", cmd) 309 p = Popen(cmd, shell=True, stdout=PIPE) 304 310 p.wait() 311 312 if p.returncode != 0: 313 self.logger.errorPair("gzip command", "failed") 314 return False 315 316 # only now can we report that the batch has successfully processed 317 self.ippToPspsDb.updateProcessed(self.batchID, 1) 305 318 306 319 # delete tar file and original directory … … 308 321 shutil.rmtree(self.localOutPath) 309 322 310 # now publish to the datastore 311 Batch.publishToDatastore(self.datastore, self.batchID, self.batchName, self.subDir, tarballFile) 323 return True 312 324 313 325 ''' … … 448 460 try: 449 461 stilts.twrites(_tables, self.outputFitsPath, fmt='fits') 450 self.ippToPspsDb.updateProcessed(self.batchID, 1)451 462 except: 452 463 self.logger.exception("Could not write to FITS") … … 494 505 p = Popen(cmd, shell=True, stdout=PIPE) 495 506 p.wait() 496 # out = p.stdout.read()497 507 498 508 rowCount = self.scratchDb.getRowCount("dvoDetection") … … 507 517 ''' 508 518 Creates and publishes a batch 509 TODO all meth dds call below should throw exceptions on failure519 TODO all methods call below should throw exceptions on failure 510 520 ''' 511 521 def run(self): … … 530 540 else: 531 541 self.writeBatchManifest() 532 if int(self.doc.find("options/publishToDatastore").text): self.tarZipAndpublishToDatastore() 542 if int(self.doc.find("options/publishToDatastore").text): 543 # tar and zip ready for publication to datastore 544 if self.tarAndZip(): 545 # now publish to the datastore 546 tarballFile = Batch.getTarballFile(self.batchID) 547 Batch.publishToDatastore(self.datastore, self.batchID, self.batchName, self.subDir, tarballFile) 548 533 549 if int(self.doc.find("options/reportNulls").text): self.reportNullsInAllPspsTables(False) 534 550
Note:
See TracChangeset
for help on using the changeset viewer.
