Ignore:
Timestamp:
30/04/09 17:36:03 (11 years ago)
Author:
cbyrom
Message:

Adjust logging and output of error in ingest scripts.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/branches/ingestAutomation-upgrade/OAIBatch/oai_document_ingester.py

    r5153 r5243  
    77''' 
    88import os, sys, logging 
     9# annoyingly, an import (CSML file, I think) sets the logging config during imports - so set this 
     10# here to get there first - since you can only set the config once 
     11logging.basicConfig(level=logging.DEBUG, 
     12                    format='%(asctime)s %(filename)s:%(lineno)d %(levelname)s %(message)s') 
    913from time import strftime 
    1014import ndg.common.src.lib.fileutilities as FileUtilities 
     
    1620        - including running the various transforms and parsings to get all doc types and spatiotemporal  
    1721        data in the correct form in the DB 
     22        @return outMessage: string summary of ingest outcome 
    1823        ''' 
    19          
    2024 
    2125        def processDataCentre(self, dataCentre): 
     
    2327                self._no_files_ingested = 0 
    2428                self._no_problem_files = 0 
     29                self._error_messages = '' 
    2530                self.dataCentre = dataCentre 
    2631                 
     
    6065                numfilesproc = self._convertAndIngestFiles(self.originals_dir, self.discovery_dir) 
    6166                 
     67                outMessage = "OAI Document ingest processing complete:" 
    6268                logging.info("oai_document_ingest processing complete:") 
    6369                if self._no_problem_files == 0: 
     
    7076                logging.info(self.lineSeparator) 
    7177                logging.info("INFO: Number of files processed = %s" %numfilesproc) 
     78                outMessage += 'Number of files processed = %s' %numfilesproc 
    7279                logging.info("INFO: Number of files ingested = %s" %self._no_files_ingested) 
     80                outMessage += 'Number of files ingestest = %s' %self._no_files_ingested 
     81                if self._error_messages: 
     82                        outMessage += 'Errors: %s' %self._error_messages  
    7383                logging.info(self.lineSeparator) 
    7484                print "Script finished running." 
     85                return outMessage 
    7586 
    7687         
Note: See TracChangeset for help on using the changeset viewer.