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/gpc1db.py

    r34884 r35097  
    2121    '''
    2222    def __init__(self, logger, config):
    23         super(Gpc1Db, self).__init__(logger, config, "gpc1database")
     23        # define database type
     24        if (config.test):
     25            dbType = "gpc1database_test"
     26        else:
     27            dbType = "gpc1database"
     28
     29        super(Gpc1Db, self).__init__(logger, config, dbType)
    2430
    2531    '''
     
    9399           
    94100        try:
     101            # XXX EAM : test output
     102            self.logger.infoPair("sql for dvo items:", sql)
    95103            rs = self.executeQuery(sql)
    96104            while (rs.next()):
     
    112120        self.logger.debug("Querying GPC1 for image IDs for stack ID: " + str(stackID))
    113121
     122        # JOIN stackInputSkyfile shoule use stack_id as well as warp_id, right? (maybe not -- the join to warp is first)
    114123        sql = "SELECT DISTINCT CONCAT(exp_id, SUBSTR(class_id, 3, 4)) FROM ( \
    115124               SELECT DISTINCT exp_id,class_id \
     
    226235        if path.startswith("neb"):
    227236
     237            # XXX EAM : this should just use the name (path.smf) instead of a wildcard, right?
    228238            f=os.popen("neb-ls -p "+path+"%smf")
    229239            for i in f.readlines():
     
    234244            files = glob.glob(path + ".smf")
    235245
     246        # XXX EAM : test output
     247        self.logger.infoPair("smf files:", files)
    236248        if len(files) < 1: return None
    237249
     
    290302
    291303
     304        # print "staring stack stage cmf"
     305
    292306        # get single path base for the directory containing all cmf files, one of which is hopefully for our stack_id
    293307        try:
    294308            rs = self.executeQuery(sql)
    295309            rs.first()
     310        except:
     311            self.logger.errorPair("Can't query for stack cmfs", "stack_id = %d" % stackID)
     312            return None
     313
     314        try:
    296315            pathBase = rs.getString(1)
     316        except:
     317            self.logger.errorPair("No stack cmf files found for stack_id = %d" % stackID)
     318            return None
     319
     320        # find the files (are they in nebulous or in the filesystem?)
     321        files = []
     322        if pathBase.startswith("neb"):
     323            # XXX EAM : this should just use the name (path.smf) instead of a wildcard, right?
     324            f=os.popen("neb-ls -p " + pathBase + "%cmf")
     325            for i in f.readlines():
     326                files.append(i.rstrip())
     327
     328        # or not a neb path
     329        else:
     330            files = glob.glob(pathBase + ".cmf")
     331
     332        # print "stack cmf files:", files
     333        if len(files) < 1: return None
     334
     335        # if we get here, then the cmf is readable, now check the stack_id
     336        fits = Fits(self.logger, self.config, files[0])
     337        return fits
     338
     339        # XXX validate the file?
     340        # if fits.getPrimaryHeaderValue("STK_ID") == str(stackID):
    297341
    298342            # now find and loop through all cmf files at this path_base
    299             files=os.popen("neb-ls " + pathBase + "%cmf")
    300             for i in files.readlines():
    301 
    302                 nebPath = i.rstrip()
    303 
    304                 # now attempt to run 'neb-ls -p' to actually read this cmf file
    305                 try:
    306                     self.logger.debug("Trying to neb-ls -p on '" + nebPath + "'")
    307                     paths=os.popen("neb-ls -p " + nebPath)
    308                     path = paths.readline().rstrip()
    309                     if len(path) < 1:
    310                        self.logger.debug("zero length path - skipping")
    311                        raise
    312 
    313                     # if we get here, then the cmf is readable, now check the stack_id
    314                     fits = Fits(self.logger, self.config, path)
    315                     if fits.getPrimaryHeaderValue("STK_ID") == str(stackID):
    316                         # we have the right file!
    317                         self.logger.debug("SUCCESS!: %s == %s"% (fits.getPrimaryHeaderValue("STK_ID"), str(stackID)))
    318                         return fits
    319                     else:
    320                         # this is not the correct file
    321                         self.logger.debug("STACK ID: %s != %s"% (fits.getPrimaryHeaderValue("STK_ID"), str(stackID)))
    322 
    323                 # an exception here means that nebulous could not read this file, so we just skip it
    324                 except:
    325                     self.logger.debug("NEB FAILED SKIPPING")
    326                     pass
    327 
    328         except:
    329             self.logger.errorPair("Can't query for stack cmfs", "stack_id = %d" % stackID)
    330 
    331         self.logger.errorPair("Couldn't find stack cmf for", "stack_id = %d" % stackID)
    332         return None
     343
     344            ## XXX the code below was needed when we ingested from staticsky (N files per run)
     345            ## XXX ingesting from skycal solves this problem (1 file per run)
     346            ## files=os.popen("neb-ls " + pathBase + "%cmf")
     347            ## for i in files.readlines():
     348            ##     nebPath = i.rstrip()
     349            ##
     350            ##     # now attempt to run 'neb-ls -p' to actually read this cmf file
     351            ##     try:
     352            ##         self.logger.debug("Trying to neb-ls -p on '" + nebPath + "'")
     353            ##         paths=os.popen("neb-ls -p " + nebPath)
     354            ##         path = paths.readline().rstrip()
     355            ##         if len(path) < 1:
     356            ##            self.logger.debug("zero length path - skipping")
     357            ##            raise
     358            ##
     359            ##         print "starint stack stage cmf 3"
     360            ##
     361            ##         # if we get here, then the cmf is readable, now check the stack_id
     362            ##         fits = Fits(self.logger, self.config, path)
     363            ##         if fits.getPrimaryHeaderValue("STK_ID") == str(stackID):
     364            ##             # we have the right file!
     365            ##             self.logger.debug("SUCCESS!: %s == %s"% (fits.getPrimaryHeaderValue("STK_ID"), str(stackID)))
     366            ##             return fits
     367            ##         else:
     368            ##             # this is not the correct file
     369            ##             self.logger.debug("STACK ID: %s != %s"% (fits.getPrimaryHeaderValue("STK_ID"), str(stackID)))
     370            ##
     371            ##     # an exception here means that nebulous could not read this file, so we just skip it
     372            ##     except:
     373            ##         self.logger.debug("NEB FAILED SKIPPING")
     374            ##         pass
    333375
    334376    '''
Note: See TracChangeset for help on using the changeset viewer.