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

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

◆ getFileSize()

def python.copyTCTOutput.getFileSize (   pfn)

Definition at line 13 of file copyTCTOutput.py.

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

◆ usage()

def python.copyTCTOutput.usage ( )

Definition at line 50 of file copyTCTOutput.py.

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

Variable Documentation

◆ allFilesToCopy

python.copyTCTOutput.allFilesToCopy

Definition at line 82 of file copyTCTOutput.py.

◆ chains

python.copyTCTOutput.chains

Definition at line 80 of file copyTCTOutput.py.

◆ cmd

python.copyTCTOutput.cmd

Definition at line 133 of file copyTCTOutput.py.

◆ dDir

python.copyTCTOutput.dDir

Definition at line 60 of file copyTCTOutput.py.

◆ destdir

python.copyTCTOutput.destdir

Definition at line 114 of file copyTCTOutput.py.

◆ destfile

python.copyTCTOutput.destfile

Definition at line 130 of file copyTCTOutput.py.

◆ ff

python.copyTCTOutput.ff

Definition at line 79 of file copyTCTOutput.py.

◆ filesToCopy

python.copyTCTOutput.filesToCopy

Definition at line 86 of file copyTCTOutput.py.

◆ locDir

python.copyTCTOutput.locDir

Definition at line 112 of file copyTCTOutput.py.

◆ logpath

python.copyTCTOutput.logpath

Definition at line 108 of file copyTCTOutput.py.

◆ nFiles

python.copyTCTOutput.nFiles

Definition at line 93 of file copyTCTOutput.py.

◆ out

python.copyTCTOutput.out

Definition at line 135 of file copyTCTOutput.py.

◆ patterns

python.copyTCTOutput.patterns

Definition at line 62 of file copyTCTOutput.py.

◆ sDir

python.copyTCTOutput.sDir

Definition at line 59 of file copyTCTOutput.py.

◆ stat

python.copyTCTOutput.stat

Definition at line 135 of file copyTCTOutput.py.

◆ totalSize

python.copyTCTOutput.totalSize

Definition at line 92 of file copyTCTOutput.py.

python.copyTCTOutput.usage
def usage()
Definition: copyTCTOutput.py:50
python.copyTCTOutput.freeSpace
def freeSpace(p)
Definition: copyTCTOutput.py:42
python.copyTCTOutput.getFileSize
def getFileSize(pfn)
Definition: copyTCTOutput.py:13
python.CaloAddPedShiftConfig.int
int
Definition: CaloAddPedShiftConfig.py:45