- Timestamp:
- Nov 8, 2011, 2:44:12 PM (15 years ago)
- Location:
- branches/eam_branches/ipp-20110906
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippToPsps/jython/load.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20110906
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20110906/ippToPsps/jython/load.py
r32227 r32630 7 7 import time 8 8 import sys 9 import os 10 import socket 9 11 import logging.config 10 12 from xml.etree.ElementTree import ElementTree, Element, tostring … … 35 37 logger.infoPair("Batch name", batchName) 36 38 37 Batch.publishToDatastore(datastore, ippToPspsDb, batchID, batchName, subDir, tarballFile) 38 39 Batch.publishToDatastore(datastore, batchID, batchName, subDir, tarballFile) 39 40 40 41 ''' … … 54 55 logger.errorPair("Problem loading IDs from config under", "options/ids/id") 55 56 56 # no config dictated IDs, so get from DVO instead57 57 if len(allIDs) > 0: 58 58 logger.infoPair("Using config IDs (not DVO)", "%d" % len(allIDs)) 59 # no config dictated IDs, so get from DVO instead 59 60 else: 60 allIDs = gpc1Db.getIDsInThisDVODbForThisStage(DVOGPC1LABEL, batchType) 61 62 if MINRA and MAXRA and MINDEC and MAXDEC: 63 allIDs = gpc1Db.getIDsInThisDVODbForThisStage(DVOGPC1LABEL, batchType, MINRA, MAXRA, MINDEC, MAXDEC) 64 else: 65 allIDs = gpc1Db.getIDsInThisDVODbForThisStage(DVOGPC1LABEL, batchType) 66 61 67 logger.infoPair("All %s items in DVO" % batchType, "%d" % len(allIDs)) 62 68 … … 67 73 else: 68 74 processedIDs = ippToPspsDb.getProcessedIDs(batchType, EPOCH, DVOGPC1LABEL) 69 logger.infoPair("Processed %s items" % batchType, "%d" % len(processedIDs)) 70 ids = list(set(allIDs) - set(processedIDs)) 71 logger.infoPair("Unprocessed %s items" % batchType, "%d" % len(ids)) 75 consistaentlyFailedIDs = ippToPspsDb.getConsistentlyFailedIDs(batchType, EPOCH, DVOGPC1LABEL) 76 ids = list(set(allIDs) - set(processedIDs) - set(consistaentlyFailedIDs)) 77 logger.infoPair("Processed items", "%d" % len(processedIDs)) 78 logger.infoPair("Consistently failing items", "%d" % len(consistaentlyFailedIDs)) 79 logger.infoPair("Unprocessed items", "%d" % len(ids)) 72 80 73 81 logger.infoPair("%s items queued" % batchType, "%d" % len(ids)) 74 82 75 83 # loop round IDs of all items to be processed 84 ippToPspsDb.lockBatchTable() 76 85 for id in ids: 77 86 78 if not FORCE and ippToPspsDb.alreadyProcessed(batchType, id, EPOCH, DVOGPC1LABEL): continue 79 if not FORCE and ippToPspsDb.consistentlyFailed(batchType, id, EPOCH, DVOGPC1LABEL, 3): continue 87 batchID = ippToPspsDb.createNewBatch( 88 batchType, 89 id, 90 SURVEY, 91 EPOCH, 92 DVOGPC1LABEL, 93 datastore.product, 94 FORCE) 95 96 if batchID < 0: continue; 97 98 ippToPspsDb.unlockTables() 80 99 81 100 if batchType == "P2": … … 85 104 gpc1Db, 86 105 ippToPspsDb, 87 id) 106 id, 107 batchID) 88 108 elif batchType == "ST": 89 109 batch = StackBatch(logger, … … 92 112 gpc1Db, 93 113 ippToPspsDb, 94 id) 114 id, 115 batchID) 95 116 96 117 batch.run() 118 119 ippToPspsDb.lockBatchTable() 120 121 logger.infoSeparator() 97 122 98 123 # if in TEST mode, then quit after one batch 99 124 if TEST: break 100 125 126 ippToPspsDb.unlockTables() 101 127 102 128 ''' … … 122 148 logger = logging.getLogger("ippToPspsLog") 123 149 150 # get hostnamee and PID for unique log naming 151 HOST = socket.gethostname() 152 PID = os.getpid() 153 124 154 # if in test mode, print log to screen, otherwise, only to file 125 logger.setup(configDoc, "ippToPsps", TEST, not TEST )155 logger.setup(configDoc, "ippToPsps", TEST, not TEST, HOST, PID) 126 156 127 157 # create database objects 128 158 gpc1Db = Gpc1Db(logger, configDoc) 129 159 ippToPspsDb = IppToPspsDb(logger, configDoc) 130 datastore = Datastore(logger, configDoc )160 datastore = Datastore(logger, configDoc, ippToPspsDb) 131 161 132 162 # check we connected ok … … 143 173 QUEUE_P2 = int(configDoc.find("options/queueP2").text) 144 174 QUEUE_ST = int(configDoc.find("options/queueST").text) 175 SURVEY = configDoc.find("options/survey").text 176 177 # get equatorial coord limits, if any 178 MINRA = None 179 MAXRA = None 180 MINDEC = None 181 MAXDEC = None 182 try: 183 MINRA = float(configDoc.find("dvo/minRA").text) 184 MAXRA = float(configDoc.find("dvo/maxRA").text) 185 MINDEC = float(configDoc.find("dvo/minDec").text) 186 MAXDEC = float(configDoc.find("dvo/maxDec").text) 187 except: 188 pass 145 189 146 190 # prompt user: FORCE and PUBLISH is a dangerous combination … … 180 224 # queue all items for all batch types, sequentially 181 225 if QUEUE_IN: 182 batch = InitBatch(logger, CONFIG, configDoc, gpc1Db, ippToPspsDb) 183 batch.run() 226 batchID = ippToPspsDb.createNewBatch( 227 "IN", 228 0, 229 SURVEY, 230 EPOCH, 231 DVOGPC1LABEL, 232 datastore.product, 233 1) 234 if batchID > 0: 235 batch = InitBatch(logger, CONFIG, configDoc, gpc1Db, ippToPspsDb, batchID) 236 batch.run() 184 237 break; 185 238
Note:
See TracChangeset
for help on using the changeset viewer.
