IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 6, 2013, 3:16:35 PM (13 years ago)
Author:
eugene
Message:

upgrade to ippToPsps (see doc/upgrade.txt): adds native dvo to mysql ingest operations, adds autogen configuration & installation, splits out global config information from new "skychunk" information (current region on the sky being processed), adds test suites

Location:
trunk/ippToPsps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps

  • trunk/ippToPsps/jython

    • Property svn:ignore
      •  

        old new  
        11*.class
         2Makefile
         3Makefile.in
  • trunk/ippToPsps/jython/batch.py

    r33787 r35097  
    3030                 logger,
    3131                 config,
     32                 skychunk,
    3233                 gpc1Db,
    3334                 ippToPspsDb,
     
    3940                 useFullTables):
    4041
     42        # print "starting the batch"
     43
     44        # self.printline = 0
     45        # self.testprint()
     46
    4147        self.readHeader = False
    4248        self.config = config
     49        self.skychunk = skychunk
    4350        self.fits = fits
    4451        self.useFullTables = useFullTables
     
    4855        self.logger.infoSeparator()
    4956        self.logger.debug("Batch class constructor")
     57
     58        # self.testprint()
    5059
    5160        # set up class variables
     
    5665        self.scratchDb = scratchDb
    5766        self.batchType = batchType;
    58         self.pspsVoTableFilePath = "../config/" + batchType + "/tables.vot"
     67        self.pspsVoTableFilePath = self.config.configDir + "tables." + batchType + ".vot"
     68
     69        # self.testprint()
    5970
    6071        # check FITS file is ok
     
    6475            # now check that the fits header is readable
    6576            if not self.header:
    66                 logger.errorPair("Could not read FITS for id", "%d" % id)
     77                logger.errorPair("Could not read FITS PHU for id", "%d" % id)
    6778                raise
    6879
     
    7283        self.tablesToExport = []
    7384
    74         if self.config.survey != "":
    75             self.surveyID = self.scratchDb.getSurveyID(self.config.survey)
     85        if self.skychunk.survey != "":
     86            self.surveyID = self.scratchDb.getSurveyID(self.skychunk.survey)
    7687        else:
    7788            self.surveyID = -1;
    7889       
    7990        # create datastore object
    80         self.datastore = Datastore(self.logger, self.config, self.ippToPspsDb)
    81 
    82         # get local storage location from config
     91        self.datastore = Datastore(self.logger, self.skychunk, self.ippToPspsDb)
     92
     93        # get local storage location from skychunk
    8394        self.batchName = Batch.getNameFromID(self.batchID)
    8495        self.subDir = Batch.getSubDir(
    85                 self.config.basePath,
     96                self.skychunk.basePath,
    8697                self.batchType,
    87                 self.config.dvoLabel)
     98                self.skychunk.dvoLabel)
    8899
    89100        self.localOutPath = Batch.getOutputPath(
    90                 self.config.basePath,
     101                self.skychunk.basePath,
    91102                self.batchType,
    92                 self.config.dvoLabel,
     103                self.skychunk.dvoLabel,
    93104                self.batchID)
    94105
    95106        if not os.path.exists(self.localOutPath): os.makedirs(self.localOutPath)
     107
     108        # self.testprint()
    96109
    97110        # store today's date
     
    112125            self.logger.infoPair("Input FITS primary header", "%s cards found" % self.fits.getPrimaryHeaderCardCount())
    113126
     127        # self.testprint()
     128
    114129        self.logger.infoPair("Output path", self.localOutPath)
    115130
    116131   
     132    def testprint(self):
     133      print "here ", self.printline
     134      self.printline += 1
     135
    117136    '''
    118137    Static method to generated batch name from batch ID
     
    232251        root.attrib['type'] = self.batchType
    233252        root.attrib['timestamp'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    234         root.attrib['survey'] = self.config.pspsSurvey
     253        root.attrib['survey'] = self.skychunk.pspsSurvey
    235254
    236255        # min/max object IDs
     
    273292        # set up filenams and paths
    274293        tarFile = Batch.getTarFile(self.batchID)
    275         tarPath = Batch.getTarPath(self.config.basePath, self.batchType, self.config.dvoLabel, self.batchID)
     294        tarPath = Batch.getTarPath(self.skychunk.basePath, self.batchType, self.skychunk.dvoLabel, self.batchID)
    276295        tarballFile = Batch.getTarballFile(self.batchID)
    277         tarballPath = Batch.getTarballPath(self.config.basePath, self.batchType, self.config.dvoLabel, self.batchID)
     296        tarballPath = Batch.getTarballPath(self.skychunk.basePath, self.batchType, self.skychunk.dvoLabel, self.batchID)
    278297
    279298        # tar directory
     
    376395      self.logger.infoPair("Importing tables with filter", filter)
    377396
     397      # print "trying to read ", self.fits.getPath()
     398
    378399      try:
    379400          tables = stilts.treads(self.fits.getPath())
     
    385406      for table in tables:
    386407
     408          # print "import smf table ", table
    387409          match = re.match(filter, table.name)
    388410          if not match: continue
    389411          self.logger.debugPair("Reading IPP table", table.name)
    390412          table = stilts.tpipe(table, cmd='explodeall')
     413
     414          # print "read smf table ", table
    391415
    392416          # drop any previous tables before import
     
    398422          table = stilts.tpipe(table, cmd='replaceval -Infinity null *')
    399423          table = stilts.tpipe(table, cmd='replaceval Infinity null *')
     424          # print "cleaned up values ", table
    400425
    401426          try:
    402427              table.write(self.scratchDb.url + '#' + table.name)
     428              # print "wrote to mysql ", table
    403429              self.scratchDb.killLastConnectionID()
    404430              count = count + 1
     
    488514
    489515        # TODO path to DVO prog hardcoded temporarily
    490         cmd = "../src/dvograbber " + self.config.settingsPath + " " + self.scratchDb.dbName + " " + self.config.dvoLocation
     516        cmd = "../src/dvograbber " + self.config.settingsPath + " " + self.scratchDb.dbName + " " + self.skychunk.dvoLocation
    491517        self.logger.infoPair("Running DVO", cmd)
    492518        p = Popen(cmd, shell=True, stdout=PIPE)
     
    504530    '''
    505531    Creates and publishes a batch
    506     TODO all methods call below should throw exceptions on failure
     532    TODO all method calls below should throw exceptions on failure
    507533    '''
    508534    def run(self):
    509535
     536        # this is badly named : it creates the tables and then fills in
     537        # the ImageMeta tables for each ota (alterPspsTables)
    510538        if not self.createEmptyPspsTables():
    511539            self.logger.errorPair("Aborting this batch", "could not create empty PSPS tables")
     
    513541            raise
    514542
     543        # for P2/ST, this reads the detection tables from the CMF/SMF file(s)
     544        # for OB, this imports object data from DVO
    515545        if not self.importIppTables():
    516546            self.logger.errorPair("Aborting this batch", "could not import IPP tables")
     
    529559   
    530560        if self.writeBatchManifest():
    531             if self.config.datastorePublishing:
     561            if self.skychunk.datastorePublishing:
    532562
    533563                # tar and zip ready for publication to datastore
Note: See TracChangeset for help on using the changeset viewer.