IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 29, 2011, 9:26:53 AM (15 years ago)
Author:
rhenders
Message:

new method to publish batches that previously failed to load to the datastore; added some log messages when a batch fails;

File:
1 edited

Legend:

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

    r32183 r32206  
    1111from gpc1db import Gpc1Db
    1212from ipptopspsdb import IppToPspsDb
     13from datastore import Datastore
     14from batch import Batch
    1315
    1416from initbatch import InitBatch
    1517from stackbatch import StackBatch
    1618from detectionbatch import DetectionBatch
     19
     20'''
     21Finds batches that processed ok, but did not get loaded to the datastore, then tries to load them
     22'''
     23def publishAnyUnpublishedBatches(batchType):
     24
     25    batchIDs = ippToPspsDb.getProcessedButFailedDatastoreBatchIDs(EPOCH, DVOGPC1LABEL, batchType)
     26    logger.infoPair("Failed load to datastore", "%d %s batches" % (len(batchIDs), batchType))
     27
     28    for batchID in batchIDs:
     29
     30        batchName = Batch.getNameFromID(batchID)
     31        subDir = Batch.getSubDir(BASEPATH, batchType, DVOGPC1LABEL)
     32        tarballFile = Batch.getTarballFile(batchID)
     33        logger.infoPair("Batch name", batchName)
     34
     35        Batch.publishToDatastore(datastore, ippToPspsDb, batchID, batchName, subDir, tarballFile)
     36
    1737
    1838'''
     
    105125gpc1Db = Gpc1Db(logger, configDoc)
    106126ippToPspsDb = IppToPspsDb(logger, configDoc)
     127datastore = Datastore(logger, configDoc)
    107128
    108129# check we connected ok
     
    116137EPOCH = configDoc.find("options/epoch").text
    117138PUBLISH = int(configDoc.find("options/publishToDatastore").text)
     139BASEPATH = configDoc.find("localOutPath").text
    118140QUEUE_P2 = int(configDoc.find("options/queueP2").text)
    119141QUEUE_ST = int(configDoc.find("options/queueST").text)
     
    159181       break;
    160182
     183    # queue up batches that are processed but not loaded to datastore
     184    if QUEUE_P2: publishAnyUnpublishedBatches("P2")
     185    if QUEUE_ST: publishAnyUnpublishedBatches("ST")
     186
    161187    if QUEUE_P2: queueItems("P2")
    162188    if QUEUE_ST: queueItems("ST")
Note: See TracChangeset for help on using the changeset viewer.