Changeset 32468 for trunk/ippToPsps
- Timestamp:
- Sep 29, 2011, 3:33:14 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/load.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/load.py
r32227 r32468 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 ''' … … 67 68 else: 68 69 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)) 70 consistaentlyFailedIDs = ippToPspsDb.getConsistentlyFailedIDs(batchType, EPOCH, DVOGPC1LABEL) 71 ids = list(set(allIDs) - set(processedIDs) - set(consistaentlyFailedIDs)) 72 logger.infoPair("Processed items", "%d" % len(processedIDs)) 73 logger.infoPair("Consistently failing items", "%d" % len(consistaentlyFailedIDs)) 74 logger.infoPair("Unprocessed items", "%d" % len(ids)) 72 75 73 76 logger.infoPair("%s items queued" % batchType, "%d" % len(ids)) 74 77 75 78 # loop round IDs of all items to be processed 79 ippToPspsDb.lockBatchTable() 76 80 for id in ids: 77 81 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 82 batchID = ippToPspsDb.createNewBatch( 83 batchType, 84 id, 85 SURVEY, 86 EPOCH, 87 DVOGPC1LABEL, 88 datastore.product, 89 FORCE) 90 91 if batchID < 0: continue; 92 93 ippToPspsDb.unlockTables() 80 94 81 95 if batchType == "P2": … … 85 99 gpc1Db, 86 100 ippToPspsDb, 87 id) 101 id, 102 batchID) 88 103 elif batchType == "ST": 89 104 batch = StackBatch(logger, … … 92 107 gpc1Db, 93 108 ippToPspsDb, 94 id) 109 id, 110 batchID) 95 111 96 112 batch.run() 113 114 ippToPspsDb.lockBatchTable() 115 116 logger.infoSeparator() 97 117 98 118 # if in TEST mode, then quit after one batch 99 119 if TEST: break 100 120 121 ippToPspsDb.unlockTables() 101 122 102 123 ''' … … 122 143 logger = logging.getLogger("ippToPspsLog") 123 144 145 # get hostnamee and PID for unique log naming 146 HOST = socket.gethostname() 147 PID = os.getpid() 148 124 149 # if in test mode, print log to screen, otherwise, only to file 125 logger.setup(configDoc, "ippToPsps", TEST, not TEST )150 logger.setup(configDoc, "ippToPsps", TEST, not TEST, HOST, PID) 126 151 127 152 # create database objects 128 153 gpc1Db = Gpc1Db(logger, configDoc) 129 154 ippToPspsDb = IppToPspsDb(logger, configDoc) 130 datastore = Datastore(logger, configDoc )155 datastore = Datastore(logger, configDoc, ippToPspsDb) 131 156 132 157 # check we connected ok … … 143 168 QUEUE_P2 = int(configDoc.find("options/queueP2").text) 144 169 QUEUE_ST = int(configDoc.find("options/queueST").text) 170 SURVEY = configDoc.find("options/survey").text 145 171 146 172 # prompt user: FORCE and PUBLISH is a dangerous combination … … 180 206 # queue all items for all batch types, sequentially 181 207 if QUEUE_IN: 182 batch = InitBatch(logger, CONFIG, configDoc, gpc1Db, ippToPspsDb) 183 batch.run() 208 batchID = ippToPspsDb.createNewBatch( 209 "IN", 210 0, 211 SURVEY, 212 EPOCH, 213 DVOGPC1LABEL, 214 datastore.product, 215 1) 216 if batchID > 0: 217 batch = InitBatch(logger, CONFIG, configDoc, gpc1Db, ippToPspsDb, batchID) 218 batch.run() 184 219 break; 185 220
Note:
See TracChangeset
for help on using the changeset viewer.
