-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCopyToLPC.py
More file actions
72 lines (55 loc) · 1.9 KB
/
CopyToLPC.py
File metadata and controls
72 lines (55 loc) · 1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python
# encoding: utf-8
# File : CopyToLPC.py
# Author : Ben Wu
# Contact : benwu@fnal.gov
# Date : 2016 Apr 11
#
# Description :
import sys
import subprocess
import subprocess
from multiprocessing import Pool
# filename = "r275059_itgv63p1.list"
# filename = "r275064_itgv63p1.list"
# filename = "r279931_v86SK.list"
# filename = "279931_ParkingZeroBias.list"
# filename = "testing.list"
def fwork(cmd):
return subprocess.call(cmd, shell=True)
def usage():
""" Usage: CopyToLPC filelist <nproc>
\n\tPlease supply filelist
"""
pass
if __name__ == "__main__":
nproc=8
narg=len(sys.argv)
if narg < 2 :
print usage.__doc__
sys.exit(1)
if narg >=3:
nproc=sys.arv[2]
filename = sys.argv[1]
newfile=filename + ".new"
p = Pool(nproc)
cmdlist = []
# f = open("r259721_itgv46p0_local.list", "w")
# with open("r259721_itgv46p0.list") as file:
f = open(newfile, "w")
with open("%s" % filename) as file:
for line_ in file.readlines():
line =line_.strip()
print line, " xx"
##newloc = line.replace("eoscms.cern.ch", "cmseos.fnal.gov")
##newloc = newloc.replace("dpg_trigger", "lpctrig")
## newloc = line.replace("cmseos.fnal.gov//eos/uscms","eoscms.cern.ch//eos/cms")
## newloc = newloc.replace("user/lpctrig/apana/L1Menu_2016","group/dpg_trigger/comm_trigger/L1Trigger/L1Menu2016")
newloc = line.replace("cmseos.fnal.gov//store","eoscms.cern.ch//eos/cms/store")
newloc = newloc.replace("user//lpctrig/apana/L1Menu_2016","group/dpg_trigger/comm_trigger/L1Trigger/L1Menu2016")
f.write(newloc+"\n")
print newloc,"\n"
cmdlist.append("xrdcp %s %s" % ( line, newloc ))
f.close()
## print cmdlist
print p.map(fwork, cmdlist)