ATLAS Offline Software
Functions | Variables
python.copyTCTOutput Namespace Reference

Functions

def getFileSize (pfn)
 
def freeSpace (p)
 
def usage ()
 

Variables

 sDir
 
 dDir
 
 patterns
 
 ff
 
 chains
 
 allFilesToCopy
 
 filesToCopy
 
 totalSize
 
 nFiles
 
 logpath
 
 locDir
 
 destdir
 
 destfile
 
 cmd
 
 stat
 
 out
 

Function Documentation

◆ freeSpace()

def python.copyTCTOutput.freeSpace (   p)

Definition at line 40 of file copyTCTOutput.py.

40 def freeSpace(p): #wont' work on afs ..
41  s = os.statvfs(p)
42  return s.f_bsize * s.f_bavail
43 
44 
45 
46 

◆ getFileSize()

def python.copyTCTOutput.getFileSize (   pfn)

Definition at line 11 of file copyTCTOutput.py.

11 def getFileSize(pfn):
12  "Get size of a file through os.stat (regular file) or rfstat (file on castor)"
13  size=None
14  pos=pfn.rfind(':')
15  if pos!=-1:
16  pfn=pfn[1+pos:]
17  #print ("New pfn:",pfn)
18  if pfn.startswith("/castor/"):
19  cmd= "rfstat "+pfn
20  (stat,out)=subprocess.getstatusoutput(cmd)
21  if stat!=0:
22  print ("ERROR: ",cmd,"failed.")
23  return None
24  for l in out.split(os.linesep):
25  if l.startswith("Size"):
26  colon=l.index(':')
27  size=int(l[1+colon:].strip())
28  return size
29  print ("ERROR: Failed to interpret output of rfstat")
30  return None
31  else: #Assume regular file
32  try:
33  statinfo=os.stat(pfn)
34  size=statinfo[6]
35  except Exception:
36  print ("Can't acess regular file: ",pfn)
37  return size
38 
39 

◆ usage()

def python.copyTCTOutput.usage ( )

Definition at line 48 of file copyTCTOutput.py.

48  def usage():
49  print ("Copy a full TCT to a (local) disk")
50  print (sys.argv[0],"tctpath destpath")
51 
52 

Variable Documentation

◆ allFilesToCopy

python.copyTCTOutput.allFilesToCopy

Definition at line 80 of file copyTCTOutput.py.

◆ chains

python.copyTCTOutput.chains

Definition at line 78 of file copyTCTOutput.py.

◆ cmd

python.copyTCTOutput.cmd

Definition at line 131 of file copyTCTOutput.py.

◆ dDir

python.copyTCTOutput.dDir

Definition at line 58 of file copyTCTOutput.py.

◆ destdir

python.copyTCTOutput.destdir

Definition at line 112 of file copyTCTOutput.py.

◆ destfile

python.copyTCTOutput.destfile

Definition at line 128 of file copyTCTOutput.py.

◆ ff

python.copyTCTOutput.ff

Definition at line 77 of file copyTCTOutput.py.

◆ filesToCopy

python.copyTCTOutput.filesToCopy

Definition at line 84 of file copyTCTOutput.py.

◆ locDir

python.copyTCTOutput.locDir

Definition at line 110 of file copyTCTOutput.py.

◆ logpath

python.copyTCTOutput.logpath

Definition at line 106 of file copyTCTOutput.py.

◆ nFiles

python.copyTCTOutput.nFiles

Definition at line 91 of file copyTCTOutput.py.

◆ out

python.copyTCTOutput.out

Definition at line 133 of file copyTCTOutput.py.

◆ patterns

python.copyTCTOutput.patterns

Definition at line 60 of file copyTCTOutput.py.

◆ sDir

python.copyTCTOutput.sDir

Definition at line 57 of file copyTCTOutput.py.

◆ stat

python.copyTCTOutput.stat

Definition at line 133 of file copyTCTOutput.py.

◆ totalSize

python.copyTCTOutput.totalSize

Definition at line 90 of file copyTCTOutput.py.

python.copyTCTOutput.usage
def usage()
Definition: copyTCTOutput.py:48
python.copyTCTOutput.freeSpace
def freeSpace(p)
Definition: copyTCTOutput.py:40
python.copyTCTOutput.getFileSize
def getFileSize(pfn)
Definition: copyTCTOutput.py:11
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45