IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33672


Ignore:
Timestamp:
Apr 3, 2012, 4:23:54 PM (14 years ago)
Author:
rhenders
Message:

some reorganization of run() method

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/batch.py

    r33557 r33672  
    1010import logging
    1111from subprocess import call, PIPE, Popen
     12from java.lang import *
     13from java.sql import *
     14from xml.etree.ElementTree import ElementTree, Element, tostring
    1215
    1316from scratchdb import ScratchDb
     
    1518from ipptopspsdb import IppToPspsDb
    1619from fits import Fits
    17 
    18 from java.lang import *
    19 from java.sql import *
    20 from xml.etree.ElementTree import ElementTree, Element, tostring
    2120
    2221'''
     
    6968                return
    7069
    71         # if no fits file, and this is not an IN batch, then get out of here
    72         else:
    73            if batchType != "IN":
    74                logger.errorPair("Could not read FITS for id", "%d" % id)
    75                return
    76 
    7770        self.scratchDb.setUseFullTables(self.useFullTables)
    7871
     
    306299            return False
    307300
    308         # only now can we report that the batch has successfully processed
    309         self.ippToPspsDb.updateProcessed(self.batchID, 1)
    310 
    311301        # delete tar file and original directory
    312302        os.remove(tarPath)
     
    420410      self.logger.infoPair("Done. Imported", "%d tables" % count)
    421411      self.indexIppTables()
     412
     413      return True
    422414
    423415    '''
     
    519511
    520512        if not self.everythingOK:
    521             self.logger.error("Aborting this batch due to (hopefully) previously reported errors")
     513            self.logger.errorPair("Aborting this batch", "could not initialize")
    522514            self.ippToPspsDb.updateProcessed(self.batchID, -1)
    523515            return
    524516
    525517        if not self.createEmptyPspsTables():
    526             self.logger.error("Aborting this batch due to (hopefully) previously reported errors")
     518            self.logger.errorPair("Aborting this batch", "could not create empty PSPS tables")
    527519            self.ippToPspsDb.updateProcessed(self.batchID, -1)
    528520            return
    529521
    530         self.importIppTables()
     522        if not self.importIppTables():
     523            self.logger.errorPair("Aborting this batch", "could not import IPP tables")
     524            self.ippToPspsDb.updateProcessed(self.batchID, -1)
     525            return
     526
    531527        if not self.populatePspsTables():
    532528            self.logger.errorPair("Aborting this batch", "unable to populate PSPS tables")
    533529            self.ippToPspsDb.updateProcessed(self.batchID, -1)
    534         else:
    535             if not self.exportPspsTablesToFits():
    536                 self.logger.errorPair("Aborting this batch", "unable to export tables to FITS file")
    537             else:
    538                 if self.writeBatchManifest():
    539                     if self.config.datastorePublishing:
    540                         # tar and zip ready for publication to datastore
    541                         if self.tarAndZip():
    542                             # now publish to the datastore
    543                             tarballFile = Batch.getTarballFile(self.batchID)
    544                             Batch.publishToDatastore(
    545                                     self.datastore,
    546                                     self.batchID,
    547                                     self.batchName,
    548                                     self.subDir,
    549                                     tarballFile)
     530            return
     531
     532        if not self.exportPspsTablesToFits():
     533            self.logger.errorPair("Aborting this batch", "unable to export tables to FITS file")
     534            self.ippToPspsDb.updateProcessed(self.batchID, -1)
     535            return
     536   
     537        if self.writeBatchManifest():
     538            if self.config.datastorePublishing:
     539
     540                # tar and zip ready for publication to datastore
     541                if self.tarAndZip():
     542
     543                    # only now can we report that the batch has successfully processed
     544                    self.ippToPspsDb.updateProcessed(self.batchID, 1)
     545                   
     546                    # now publish to the datastore
     547                    tarballFile = Batch.getTarballFile(self.batchID)
     548                    Batch.publishToDatastore(
     549                            self.datastore,
     550                            self.batchID,
     551                            self.batchName,
     552                            self.subDir,
     553                            tarballFile)
    550554
    551555from datastore import Datastore
Note: See TracChangeset for help on using the changeset viewer.