IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 27, 2015, 4:00:17 PM (11 years ago)
Author:
eugene
Message:

add options to import FITS tables using Ohana fits_to_mysql

File:
1 edited

Legend:

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

    r38951 r38981  
    803803
    804804        return res
     805
     806    '''
     807    Use Ohana fits_to_mysql to load FITS tables into scratch db
     808    '''
     809    def loadFITStoMYSQL(self, filename, tablename):
     810
     811        # TODO path to DVO prog hardcoded temporarily
     812        cmd = "fits_to_mysql"
     813        cmd += " -dbhost " + self.scratchDb.dbHost
     814        cmd += " -dbname " + self.scratchDb.dbName
     815        cmd += " -dbuser " + self.scratchDb.dbUser
     816        cmd += " -dbpass " + self.scratchDb.dbPass
     817        cmd += filename
     818
     819        if tablename != "none":
     820            cmd += " -tablename " + tablename
     821
     822        (stdoutFile, stdoutName) = tempfile.mkstemp(prefix="fits_to_mysql.stdout.", dir="/tmp")
     823        (stderrFile, stderrName) = tempfile.mkstemp(prefix="fits_to_mysql.stderr.", dir="/tmp")
     824
     825        self.logger.infoPair("Running fits_to_mysql", cmd)
     826        self.logger.infoPair("Stdout to ", stdoutName)
     827        self.logger.infoPair("Stderr to ", stderrName)
     828        p = Popen(cmd, shell=True, stdout=stdoutFile, stderr=stderrFile)
     829
     830        p.wait()
     831
     832        if p.returncode < 0:
     833            self.logger.errorPair("fits_to_mysql terminated on signal for: ", cmd)
     834            os._exit(1)
     835
     836        if p.returncode > 0:
     837            self.logger.errorPair("fits_to_mysql failed for: ", cmd)
     838            os._exit(1)
     839
     840        os.close(loadFITStoMYSQL)
     841        os.close(loadFITStoMYSQL)
Note: See TracChangeset for help on using the changeset viewer.