Пример #1
0
 def deleteStuffIn(self, path):
     # Deletes everything inside directory path
     if not self.exists(path) or not self.isdir(path): return
     timed_cmd('yes | rfrm -r %s;rfmkdir %s;' %
               (path, os.path.basename(path))
               )  # rfrm -r asks if we are sure, hence pipe yes
     print 'Deleted everything inside %s' % path
Пример #2
0
 def copyfile(self, src, dst):
     timed_cmd('rfcp %s %s;' % (src, dst), 120)
     if not self.exists(os.path.join(dst, os.path.basename(src))):
         m = 'Unable to copy file %s to %s' % (src, dst)
         self.logger.error(m)
         return False
     return True
Пример #3
0
 def makeTimeStamp(self, path_):
     ts = os.path.join(path_, 'time_stamp')
     m = 'Making time stamp: %s' % ts
     self.logger.debug(m)
     cmd = 'touch time_stamp;rfmkdir -p %s;rfcp time_stamp %s;nsls -l %s;rm -f time_stamp;' % (
         path_, path_, ts)
     self.logger.debug("Exec command: %s" % cmd)
     m = 'Reply from cmd was:\n%s' % str(timed_cmd(cmd, 30))
     self.logger.debug(m)
Пример #4
0
 def du(self, path):
     try:
         ans = timed_cmd('du -hs %s' % self.runpath)
         return ans[0].split()[0].strip()
     except:
         self.logger.error('Unable to du %s' % path)
         self.logger.error('Answer was: %s' % ans)
         self.logger.error(exc2string2())
         return '-1'
Пример #5
0
 def path_info(self, fpath):
     try:
         return timed_cmd('nsls -ld %s' % fpath, 30)
     except:
         return None
Пример #6
0
 def mkdir(self, dirToMake):
     try:
         timed_cmd('rfmkdir -p %s' % dirToMake, 30)
         return True
     except:
         return False
Пример #7
0
 def deleteStuffIn(self, path):
     # Deletes everything inside directory path
     if not self.exists(path) or not self.isdir(path): return
     timed_cmd('rm -rf %s/*' % path)
Пример #8
0
 def mkdir(self, dirToMake):
     try:
         timed_cmd('mkdir -p %s' % dirToMake)
         return self.exists(dirToMake)
     except:
         return False
Пример #9
0
 def makeTimeStamp(self, path_):
     ts = os.path.join(path_, 'time_stamp')
     timed_cmd('mkdir -p %s; touch %s' % (path_, ts))