IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32118


Ignore:
Timestamp:
Aug 17, 2011, 12:37:27 PM (15 years ago)
Author:
rhenders
Message:

added some static methods to getting batch name, paths etc; moved datastore inport to bottom to avoid issue of circular imports

File:
1 edited

Legend:

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

    r32091 r32118  
    1111from subprocess import call, PIPE, Popen
    1212
    13 from datastore import Datastore
    1413from scratchdb import ScratchDb
    1514from gpc1db import Gpc1Db
     
    9796
    9897        # get local storage location from config
    99         self.batchName = "B%08d" % self.batchID
    100         self.subDir = self.doc.find("localOutPath").text + "/" + self.batchType + "/" + dvoGpc1Label
    101         self.localOutPath = self.subDir + "/" + self.batchName
     98        self.batchName = Batch.getNameFromID(self.batchID)
     99        basePath = self.doc.find("localOutPath").text
     100        self.subDir = Batch.getSubDir(
     101                basePath,
     102                self.batchType,
     103                dvoGpc1Label)
     104
     105        self.localOutPath = Batch.getOutputPath(
     106                basePath,
     107                self.batchType,
     108                dvoGpc1Label,
     109                self.batchID)
     110
    102111        if not os.path.exists(self.localOutPath): os.makedirs(self.localOutPath)
    103112
     
    125134
    126135        self.everythingOK = True
     136   
     137    '''
     138    Static method to generated batch name from batch ID
     139    '''
     140    @staticmethod
     141    def getNameFromID(id):
     142       return "B%08d" % id
     143
     144    '''
     145    Static method to generated sub directory for batch on local disk
     146    '''
     147    @staticmethod
     148    def getSubDir(basePath, batchType, dvoLabel):
     149       return basePath + "/" + batchType + "/" + dvoLabel
     150
     151    '''
     152    Static method to generated output path for batch
     153    '''
     154    @staticmethod
     155    def getOutputPath(basePath, batchType, dvoLabel, id):
     156       return Batch.getSubDir(basePath, batchType, dvoLabel) + "/" + Batch.getNameFromID(id)
    127157
    128158    '''
     
    448478        self.logger.infoPair("Batch......", "complete")
    449479
    450 
     480from datastore import Datastore
     481
Note: See TracChangeset for help on using the changeset viewer.