ATLAS Offline Software
Loading...
Searching...
No Matches
python.copyTCTOutput Namespace Reference

Functions

 getFileSize (pfn)
 freeSpace (p)
 usage ()

Variables

 sDir = os.path.normpath(sys.argv[1])
 dDir = os.path.normpath(sys.argv[2])
tuple patterns = (".*myESD.*pool.root$",".*myAOD.*pool.root$","myTAGCOMM.*root$","TAG.root",)
 ff = findTCTFiles(sDir,"")
 chains = ff.getChains()
 allFilesToCopy = dict()
list filesToCopy = [tci[0].logfile,]
int totalSize = 0
int nFiles = 0
 logpath = fs[0]
str locDir = "/".join(logpath[len(sDir):].split("/")[:-1])
str destdir = dDir+locDir
str destfile = destdir+"/"+os.path.basename(f)
str cmd = "rfcp "+f+" "+destfile
 stat
 out

Function Documentation

◆ freeSpace()

python.copyTCTOutput.freeSpace ( p)

Definition at line 40 of file copyTCTOutput.py.

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

◆ getFileSize()

python.copyTCTOutput.getFileSize ( pfn)

Definition at line 11 of file copyTCTOutput.py.

11def 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()

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
StatusCode usage()

Variable Documentation

◆ allFilesToCopy

python.copyTCTOutput.allFilesToCopy = dict()

Definition at line 80 of file copyTCTOutput.py.

◆ chains

python.copyTCTOutput.chains = ff.getChains()

Definition at line 78 of file copyTCTOutput.py.

◆ cmd

str python.copyTCTOutput.cmd = "rfcp "+f+" "+destfile

Definition at line 131 of file copyTCTOutput.py.

◆ dDir

python.copyTCTOutput.dDir = os.path.normpath(sys.argv[2])

Definition at line 58 of file copyTCTOutput.py.

◆ destdir

str python.copyTCTOutput.destdir = dDir+locDir

Definition at line 112 of file copyTCTOutput.py.

◆ destfile

str python.copyTCTOutput.destfile = destdir+"/"+os.path.basename(f)

Definition at line 128 of file copyTCTOutput.py.

◆ ff

python.copyTCTOutput.ff = findTCTFiles(sDir,"")

Definition at line 77 of file copyTCTOutput.py.

◆ filesToCopy

list python.copyTCTOutput.filesToCopy = [tci[0].logfile,]

Definition at line 84 of file copyTCTOutput.py.

◆ locDir

str python.copyTCTOutput.locDir = "/".join(logpath[len(sDir):].split("/")[:-1])

Definition at line 110 of file copyTCTOutput.py.

◆ logpath

python.copyTCTOutput.logpath = fs[0]

Definition at line 106 of file copyTCTOutput.py.

◆ nFiles

int python.copyTCTOutput.nFiles = 0

Definition at line 91 of file copyTCTOutput.py.

◆ out

python.copyTCTOutput.out

Definition at line 133 of file copyTCTOutput.py.

◆ patterns

tuple python.copyTCTOutput.patterns = (".*myESD.*pool.root$",".*myAOD.*pool.root$","myTAGCOMM.*root$","TAG.root",)

Definition at line 60 of file copyTCTOutput.py.

◆ sDir

python.copyTCTOutput.sDir = os.path.normpath(sys.argv[1])

Definition at line 57 of file copyTCTOutput.py.

◆ stat

python.copyTCTOutput.stat

Definition at line 133 of file copyTCTOutput.py.

◆ totalSize

int python.copyTCTOutput.totalSize = 0

Definition at line 90 of file copyTCTOutput.py.