Esempio n. 1
0
 def extractFileSizes(self):
     '''Get the file size for each file, from the eos ls -l command.'''
     lsout = castortools.runEOSCommand(self.castorDir, 'ls', '-l')[0]
     lsout = lsout.split('\n')
     self.filesAndSizes = {}
     for entry in lsout:
         values = entry.split()
         if (len(values) != 9):
             continue
         # using full abs path as a key.
         file = '/'.join([self.lfnDir, values[8]])
         size = values[4]
         self.filesAndSizes[file] = size
Esempio n. 2
0
 def extractFileSizes(self):
     '''Get the file size for each file, from the eos ls -l command.'''
     lsout = castortools.runEOSCommand(self.castorDir, 'ls','-l')[0]
     lsout = lsout.split('\n')
     self.filesAndSizes = {}
     for entry in lsout:
         values = entry.split()
         if( len(values) != 9):
             continue
         # using full abs path as a key.
         file = '/'.join([self.lfnDir, values[8]])
         size = values[4]
         self.filesAndSizes[file] = size 
Esempio n. 3
0
    def ParseOptions(self):
        (self.options_, args) = self.parser_.parse_args()
        #        self.remoteOutputDir_ = os.path.dirname( self.options_.remoteCopy )
        self.remoteOutputDir_ = self.options_.remoteCopy
        # Ugly but at least it tells the user why things come to a stop.
        if not self.remoteOutputDir_:
            print >> sys.stderr, "Please provide me with an output directory (-r option) " "or ask for help (-h option)"
            sys.exit(1)

        if self.remoteOutputDir_.startswith("/eos"):
            dirExit = castortools.runEOSCommand(self.remoteOutputDir_, "ls")
            if not dirExit:
                print "check that the castor output directory specified with the -r option exists."
                sys.exit(1)
        else:
            nsls = "rfdir %s > /dev/null" % self.remoteOutputDir_
            dirExist = os.system(nsls)
            if dirExist != 0:
                print "check that the castor output directory specified with the -r option exists."
                sys.exit(1)
        #        self.remoteOutputFile_ = os.path.basename( self.options_.remoteCopy )
        self.remoteOutputFile_ = ""
Esempio n. 4
0
    def ParseOptions(self):
        (self.options_,args) = self.parser_.parse_args()
#        self.remoteOutputDir_ = os.path.dirname( self.options_.remoteCopy )
        self.remoteOutputDir_ = self.options_.remoteCopy
        # Ugly but at least it tells the user why things come to a stop.
        if not self.remoteOutputDir_:
            print >> sys.stderr, "Please provide me with an output directory (-r option) " \
                  "or ask for help (-h option)"
            sys.exit(1)

        if self.remoteOutputDir_.startswith("/eos"):
          dirExit = castortools.runEOSCommand(self.remoteOutputDir_,'ls')
          if not dirExit:
              print 'check that the castor output directory specified with the -r option exists.'
              sys.exit(1)
        else:
          nsls = 'rfdir %s > /dev/null' % self.remoteOutputDir_
          dirExist = os.system( nsls )
          if dirExist != 0: 
              print 'check that the castor output directory specified with the -r option exists.'
              sys.exit(1)
#        self.remoteOutputFile_ = os.path.basename( self.options_.remoteCopy )
        self.remoteOutputFile_ = ""