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 43 of file copyTCTOutput.py.

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

◆ getFileSize()

def python.copyTCTOutput.getFileSize (   pfn)

Definition at line 14 of file copyTCTOutput.py.

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

◆ usage()

def python.copyTCTOutput.usage ( )

Definition at line 51 of file copyTCTOutput.py.

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

Variable Documentation

◆ allFilesToCopy

python.copyTCTOutput.allFilesToCopy

Definition at line 83 of file copyTCTOutput.py.

◆ chains

python.copyTCTOutput.chains

Definition at line 81 of file copyTCTOutput.py.

◆ cmd

python.copyTCTOutput.cmd

Definition at line 134 of file copyTCTOutput.py.

◆ dDir

python.copyTCTOutput.dDir

Definition at line 61 of file copyTCTOutput.py.

◆ destdir

python.copyTCTOutput.destdir

Definition at line 115 of file copyTCTOutput.py.

◆ destfile

python.copyTCTOutput.destfile

Definition at line 131 of file copyTCTOutput.py.

◆ ff

python.copyTCTOutput.ff

Definition at line 80 of file copyTCTOutput.py.

◆ filesToCopy

python.copyTCTOutput.filesToCopy

Definition at line 87 of file copyTCTOutput.py.

◆ locDir

python.copyTCTOutput.locDir

Definition at line 113 of file copyTCTOutput.py.

◆ logpath

python.copyTCTOutput.logpath

Definition at line 109 of file copyTCTOutput.py.

◆ nFiles

python.copyTCTOutput.nFiles

Definition at line 94 of file copyTCTOutput.py.

◆ out

python.copyTCTOutput.out

Definition at line 136 of file copyTCTOutput.py.

◆ patterns

python.copyTCTOutput.patterns

Definition at line 63 of file copyTCTOutput.py.

◆ sDir

python.copyTCTOutput.sDir

Definition at line 60 of file copyTCTOutput.py.

◆ stat

python.copyTCTOutput.stat

Definition at line 136 of file copyTCTOutput.py.

◆ totalSize

python.copyTCTOutput.totalSize

Definition at line 93 of file copyTCTOutput.py.

python.copyTCTOutput.usage
def usage()
Definition: copyTCTOutput.py:51
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
python.copyTCTOutput.freeSpace
def freeSpace(p)
Definition: copyTCTOutput.py:43
python.copyTCTOutput.getFileSize
def getFileSize(pfn)
Definition: copyTCTOutput.py:14