Changeset 32819
- Timestamp:
- Nov 25, 2011, 11:17:01 AM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/batch.py (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/batch.py
r32596 r32819 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("Running", 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("Running", 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.logger.infoPair("Batch tar 'n zip successful", "setting batch to 'processed'") 318 self.ippToPspsDb.updateProcessed(self.batchID, 1) 305 319 306 320 # delete tar file and original directory … … 308 322 shutil.rmtree(self.localOutPath) 309 323 310 # now publish to the datastore 311 Batch.publishToDatastore(self.datastore, self.batchID, self.batchName, self.subDir, tarballFile) 324 return True 312 325 313 326 ''' … … 448 461 try: 449 462 stilts.twrites(_tables, self.outputFitsPath, fmt='fits') 450 self.ippToPspsDb.updateProcessed(self.batchID, 1)451 463 except: 452 464 self.logger.exception("Could not write to FITS") … … 494 506 p = Popen(cmd, shell=True, stdout=PIPE) 495 507 p.wait() 496 # out = p.stdout.read()497 508 498 509 rowCount = self.scratchDb.getRowCount("dvoDetection") … … 507 518 ''' 508 519 Creates and publishes a batch 509 TODO all meth dds call below should throw exceptions on failure520 TODO all methods call below should throw exceptions on failure 510 521 ''' 511 522 def run(self): … … 530 541 else: 531 542 self.writeBatchManifest() 532 if int(self.doc.find("options/publishToDatastore").text): self.tarZipAndpublishToDatastore() 543 if int(self.doc.find("options/publishToDatastore").text): 544 # tar and zip ready for publication to datastore 545 if self.tarAndZip(): 546 # now publish to the datastore 547 tarballFile = Batch.getTarballFile(self.batchID) 548 Batch.publishToDatastore(self.datastore, self.batchID, self.batchName, self.subDir, tarballFile) 549 533 550 if int(self.doc.find("options/reportNulls").text): self.reportNullsInAllPspsTables(False) 534 551
Note:
See TracChangeset
for help on using the changeset viewer.
