Beispiel #1
0
 def _procLeaseCredCtlFile(self,fn):
     procFiles = {}
     lines = fu.remBlankLineLst(fn)
     if  len(lines) < 1 : 
         self.log.error("remBlankLineLst Error for File %s" % fn)
         return procFiles
     i = 1
     for line in lines:
         ln = line.split(',')
         if len(ln) != 4 :
             self.log.error("File %s Invalid line No" % (fn,i))
             i+=1
             continue
         
         lc = su.toIntPos(ln[2])
         if lc < 1 :
             self.log.error("File %s line No %d Invalid record Count %s " % (fn,i,lc))
             i+=1
             continue
         
         # Take smallest file size len : Bu_region.csv
         if len(ln[0]) <  13:
             self.log.error("File %s line No %d Invalid File Size Name %s " % (fn,i,ln[0]))
             i+=1
             continue
                
         procFiles[ln[0]] = lc
         self.log.debug("fn = %s line# = %d key = %s lc = %s" % (fn,i,ln[0],lc))
         i+=1
         
     return procFiles
Beispiel #2
0
 def parseGroup(self,grp):
     
     gb = jb.GroupBean()
     gb.name        = grp.get('@name', '' )
     gb.order       = su.toIntPos(grp.get('@order', -1 ))
     gb.active      = su.toIntPos(grp.get('@active',-1 ))
     gb.exit_on_err = su.toIntPos(grp.get('@exit_on_err', 1 ))
     
     lst = []        
     for pl in grp['group']:            
         plb = self.parsePipe(pl)
         lst.append(plb)
     
     gb.pipelines = lst
     
     self.log.debug( "GROUP BEAN  %s "  % gb)   
     return gb
Beispiel #3
0
    def parsePipe(self,pl):
              
        plbe = jb.PipeLineBean()
        plbe.name        = pl.get('@name', '' )
        plbe.order       = su.toIntPos(pl.get('@order', -1 ))
        plbe.active      = su.toIntPos(pl.get('@active',-1 ))
        plbe.exit_on_err = su.toIntPos(pl.get('@exit_on_err',1 ))

        # Get tasks within the pipeline
        lst = []        
        for tsk in pl['pipeline']:
            jbe = self.parseTask(tsk)
            lst.append(jbe)
        plbe.tasks = lst

        self.log.debug("PIPE BEAN %s " % plbe)
        
        return plbe
Beispiel #4
0
 def isWorkDay(self):
     rc = -2
     w = self.getWorkDay() 
     if w < 1 :
         self.log.error(' wkday = %s : Please check DB connectivity table' % w)
         return w
     rwd =  self.ib.workday.split(',')
     self.log.debug('self.ib.workday = %s dbWkday = %s len rdw = %d' % (self.ib.workday,w,len(rwd)))
     for wd in rwd:
         if w == su.toIntPos(wd) : return 0
     return rc
Beispiel #5
0
 def parseTask(self,tsk):
             
     D = {}
     elems = tsk['task']
     for e in elems:D.update(e)  
   
     jbe = jb.TaskBean()
     jbe.name        = tsk.get( '@name'   , '' )   
     jbe.order       = su.toIntPos(tsk.get( '@order'  , -1 ))
     jbe.active      = su.toIntPos(tsk.get( '@active' , -1 ))
     jbe.exit_on_err = su.toIntPos(tsk.get( '@exitErr',  1 ))
     jbe.stime       = D.get( 'stime' , '' )
     jbe.wrkdy       = D.get( 'wrkdy' , '' )        
     jbe.t_type      = D.get( 't_type' , '' )
     jbe.fld         = D.get( 'fld'    , '' )
     jbe.cmd         = D.get( 'cmd'    , '' )
     jbe.host        = D.get( 'host'   , '' )
     jbe.uname       = D.get( 'uname'  , '' )
     jbe.pwd         = D.get( 'pwd'    , '' )
     
     self.log.debug("JOB BEAN %s " % jbe)
     return jbe      
Beispiel #6
0
    def _insCarrPromptDet(self, rs):   
        seqid = rs[0]; uid = rs[1]; procNums = rs[2] ; dt = rs[3]       
        self.log.debug('seqid=%s uid=%s procNum=%s dt=%s' % (seqid,uid ,procNums ,dt))
        val = []
        procNumLst =  procNums.split(self.ib.delim)
        for pn in procNumLst:
            pns = pn.strip()
            if su.isBlank(pns) : continue
            if len(pns) > COL_LEN :
                p = pns[0:COL_LEN]
                self.log.warn('Truncate string %s to %s COL_LEN= %d ' % (pns,p, COL_LEN))
                pns = p
            val.append([seqid,uid,pns,dt])
       
        lim = su.toIntPos(self.ib.odbc_lim)
        lval = len(val)
        self.log.debug('seqid=%s lim=%s lval=%s' % (seqid,lim,lval))
        if lval < 1 : 
            self.log.error('Nothing to load ')
            return 2

        if ( lval < lim ):
            rc = self._insODBC(val)
        else:
            rc = self._insNZLoad(val,seqid)
            
        if rc != 0 :
            self.log.error("Issue inserting child records for seqid = %s" % seqid)
            return rc

        # Update Parent table proc_flag
        sql = "update tis_fb_carr_pmpt_imprt set proc_flag = 1  where seqid = ? "
        val = []
        val.append(seqid)
        rc = self.dbh.exeQry(sql,val)
        self.log.debug('updating parent table seqid=%s rc = %s ' % (seqid,rc))
        if rc < 0 :   # This mehod provide the number of update rows
            self.log.error('updating parent table seqid = %s rc = %s ' % (seqid,rc))
            return rc
         
        return 0