IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 4, 2011, 11:51:03 AM (15 years ago)
Author:
rhenders
Message:

yet more logginf improvments; now using one, and only one, name for batches: P2, ST and IN

File:
1 edited

Legend:

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

    r32021 r32033  
    4949        self.doc = doc
    5050        self.fits = fits
    51         if self.fits is not None:
    52             self.header = self.fits.getPrimaryHeader()
     51        if self.fits: self.header = self.fits.getPrimaryHeader()
    5352
    5453        # set up logging
     
    9291        # create a new batch
    9392        self.batchID = self.ippToPspsDb.createNewBatch(
    94                 self.getPspsBatchType(),
     93                self.batchType,
    9594                self.id,
    9695                survey,
     
    10099        # get local storage location from config
    101100        self.batchName = "B%08d" % self.batchID
    102         self.subDir = self.doc.find("localOutPath").text + "/" + self.getPspsBatchType() + "/" + dvoName
     101        self.subDir = self.doc.find("localOutPath").text + "/" + self.batchType + "/" + dvoName
    103102        self.localOutPath = self.subDir + "/" + self.batchName
    104103        if not os.path.exists(self.localOutPath): os.makedirs(self.localOutPath)
     
    111110        if not self.useFullTables: self.scratchDb.createDvoTables()
    112111
    113         self.everythingOK = True
    114 
    115     '''
    116     Destructor
    117     '''
    118     def __del__(self):
    119 
    120         self.logger.debug("Batch destructor")
    121 
    122     '''
    123     Prints metadata to the log
    124     '''
    125     def printMe(self):
    126 
     112        # dump stuff to the log
     113        self.logger.infoTitle("New " + self.batchType + " batch")
    127114        self.logger.infoPair("Batch name", self.batchName)
    128115        self.logger.infoPair("Survey", self.survey)
     
    130117        self.logger.infoPair("DVO location", self.dvoLocation)
    131118        self.logger.infoPair("Use full DVO tables?", "%d" % self.useFullTables)
     119
     120        if self.fits:
     121            self.logger.infoPair("Input FITS file", self.fits.getOriginalPath())
     122            self.logger.infoPair("Input FITS primary header", "%s cards found" % self.fits.getPrimaryHeaderCardCount())
     123
    132124        self.logger.infoPair("Output path", self.localOutPath)
     125
     126        self.everythingOK = True
     127
     128    '''
     129    Destructor
     130    '''
     131    def __del__(self):
     132
     133        self.logger.debug("Batch destructor")
    133134
    134135    '''
     
    169170        # batch information
    170171        root.attrib['name'] = self.batchName
    171         root.attrib['type'] = self.getPspsBatchType()
     172        root.attrib['type'] = self.batchType
    172173        root.attrib['timestamp'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    173174        if self.survey != "":
     
    253254            self.logger.error("Don't know this survey: '" + self.survey + "'")
    254255            return "NA"
    255 
    256     '''
    257     Gets PSPS friendly batch type TODO only use PSPS batch names, P2, ST etc
    258     '''
    259     def getPspsBatchType(self):
    260 
    261         if self.batchType == "init": return "IN"
    262         elif self.batchType == "detection": return "P2"
    263         elif self.batchType == "stack": return "ST"
    264         else: self.logger.error("Don't know this batch type: " + self.survey)
    265256
    266257    '''
     
    465456            return
    466457
    467         self.printMe()
    468458        self.createEmptyPspsTables()
    469459        self.importIppTables()
     
    475465
    476466        self.logger.infoPair("Batch......", "complete")
    477         self.logger.infoSeparator()
    478 
    479 
     467
     468
Note: See TracChangeset for help on using the changeset viewer.