Changeset 33259 for trunk/ippToPsps/jython/batch.py
- Timestamp:
- Feb 14, 2012, 12:02:48 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/batch.py (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/batch.py
r33235 r33259 30 30 def __init__(self, 31 31 logger, 32 configPath, 33 doc, 32 config, 34 33 gpc1Db, 35 34 ippToPspsDb, … … 42 41 self.everythingOK = False 43 42 self.readHeader = False 44 self.configPath = configPath 45 self.doc = doc 43 self.config = config 46 44 self.fits = fits 47 45 self.useFullTables = useFullTables … … 75 73 return 76 74 77 # get info from config 78 self.survey = self.doc.find("options/survey").text 79 self.pspsSurvey = self.doc.find("options/pspsSurvey").text 80 self.dvoGpc1Label = self.doc.find("dvo/gpc1Label").text 81 self.dvoLocation = self.doc.find("dvo/location").text 82 self.scratchDb = ScratchDb(logger, self.doc, self.useFullTables) 75 self.scratchDb = ScratchDb(logger, self.config, self.useFullTables) 83 76 84 77 if not self.scratchDb.everythingOK: return … … 87 80 self.tablesToExport = [] 88 81 89 if self. survey != "":90 self.surveyID = self.scratchDb.getSurveyID(self. survey)82 if self.config.survey != "": 83 self.surveyID = self.scratchDb.getSurveyID(self.config.survey) 91 84 else: 92 85 self.surveyID = -1; 93 86 94 # get some options from the config95 self.testMode = int(self.doc.find("options/testMode").text)96 self.dataRelease = int(self.doc.find("metadata/dataRelease").text)97 98 87 # create datastore object 99 self.datastore = Datastore(self.logger, self. doc, self.ippToPspsDb)88 self.datastore = Datastore(self.logger, self.config, self.ippToPspsDb) 100 89 101 90 # get local storage location from config 102 91 self.batchName = Batch.getNameFromID(self.batchID) 103 self.basePath = self.doc.find("localOutPath").text104 92 self.subDir = Batch.getSubDir( 105 self. basePath,93 self.config.basePath, 106 94 self.batchType, 107 self. dvoGpc1Label)95 self.config.dvoLabel) 108 96 109 97 self.localOutPath = Batch.getOutputPath( 110 self. basePath,98 self.config.basePath, 111 99 self.batchType, 112 self. dvoGpc1Label,100 self.config.dvoLabel, 113 101 self.batchID) 114 102 … … 125 113 self.logger.infoTitle("New " + self.batchType + " batch") 126 114 self.logger.infoPair("Batch name", self.batchName) 127 self.logger.infoPair("Survey", self.survey)128 115 self.logger.infoPair("Survey ID", "%d" % self.surveyID) 129 self.logger.infoPair("Publishing to PSPS as survey", self.pspsSurvey)130 self.logger.infoPair("DVO location", self.dvoLocation)131 116 self.logger.infoBool("Use full DVO tables?", self.useFullTables) 132 117 … … 227 212 if value != "NULL": return value 228 213 else: 229 if not self. testMode: return "NULL"214 if not self.config.test: return "NULL" 230 215 header[key] = default 231 216 self.logger.infoPair("Hardcoding " + key + " to", header[key]) … … 256 241 root.attrib['type'] = self.batchType 257 242 root.attrib['timestamp'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") 258 if self.batchType != "IN": root.attrib['survey'] = self. pspsSurvey243 if self.batchType != "IN": root.attrib['survey'] = self.config.pspsSurvey 259 244 try: self.minObjID 260 245 except: pass … … 287 272 # set up filenams and paths 288 273 tarFile = Batch.getTarFile(self.batchID) 289 tarPath = Batch.getTarPath(self. basePath, self.batchType, self.dvoGpc1Label, self.batchID)274 tarPath = Batch.getTarPath(self.config.basePath, self.batchType, self.config.dvoLabel, self.batchID) 290 275 tarballFile = Batch.getTarballFile(self.batchID) 291 tarballPath = Batch.getTarballPath(self. basePath, self.batchType, self.dvoGpc1Label, self.batchID)276 tarballPath = Batch.getTarballPath(self.config.basePath, self.batchType, self.config.dvoLabel, self.batchID) 292 277 293 278 # tar directory … … 498 483 499 484 # TODO path to DVO prog hardcoded temporarily 500 cmd = "../src/dvograbber " + self.config Path + " " + self.dvoLocation485 cmd = "../src/dvograbber " + self.config.path + " " + self.config.dvoLocation 501 486 self.logger.infoPair("Running DVO", cmd) 502 487 p = Popen(cmd, shell=True, stdout=PIPE) … … 537 522 else: 538 523 self.writeBatchManifest() 539 if int(self.doc.find("options/publishToDatastore").text):524 if self.config.datastorePublishing: 540 525 # tar and zip ready for publication to datastore 541 526 if self.tarAndZip(): … … 544 529 Batch.publishToDatastore(self.datastore, self.batchID, self.batchName, self.subDir, tarballFile) 545 530 546 if int(self.doc.find("options/reportNulls").text): self.reportNullsInAllPspsTables(False)531 if self.config.reportNulls: self.reportNullsInAllPspsTables(False) 547 532 548 533 from datastore import Datastore
Note:
See TracChangeset
for help on using the changeset viewer.
