def checkIncFiles(self, fn): filesInc = [] # Incoming file fl = fu.getFileName(self.ib.landDir, fn) if len(fl) == 0: i = 1 self.log.info('File %s/%s does not exists. Will start in %s sec' % (self.ib.landDir, fn, self.ib.waitFile)) wi = int(self.ib.waitFileIter) while (i <= wi): time.sleep(float(self.ib.waitFile)) fl = fu.getFileName(self.ib.landDir, fn) self.log.info('Iteration %d out of %d ' % (i, wi)) if len(fl) > 0 : break else : i += 1 if len(fl) == 0 : return filesInc self.log.info('File(s) found ', fl) for f in fl: rc = self._isFileStable(f) if rc is True : filesInc.append(f) return filesInc
def ftpMput(self): rc = 0 fns = fu.getFileName(self.locDir, self.rxfile) for f in fns: r = self._ftpPutFile(f) if r != 0 : rc+=r return rc
def procIncFiles(self, dir, fn): filesInc = [] # Incoming file fl = fu.getFileName(dir, fn) self.log.debug('dir=%s fn=%s File(s) found %s' % (dir, fn, ''.join(fl))) for f in fl: filesInc.append(f) self.log.info('File %s', f) return filesInc
def remFiles(self): fl = fu.getFileName(self.ib.landDir, self.ib.fileName) if len(fl) < 1 : self.log.warn('Nothing to remove %s/%s' % (self.ib.landDir, self.ib.fileName)) return 0 fls = ','.join(fl) self.log.debug('fls = %s ' % fls) rc = self._remFiles(fls) return rc
def checkApprovFile(self): fl = fu.getFileName(self.ib.landDir, self.ib.fileName) if len(fl) == 0: i = 1 self.log.info('Approval File %s/%s does not exists. Will start in %s sec' % (self.ib.landDir, self.ib.fileName, self.ib.waitAppFile)) wi = int(self.ib.waitFileAppIter) while (i <= wi): time.sleep(float(self.ib.waitAppFile)) fl = fu.getFileName(self.ib.landDir, self.ib.fileName) self.log.info('Iteration %d out of %d ' % (i, wi)) if len(fl) > 0 : break else : i += 1 if len(fl) == 0 : return 1 else: rc = fu.delFile(fl[0]) self.log.info('Removing %s , rc = %s ' % (fl[0], rc)) return 0