ATLAS Offline Software
Loading...
Searching...
No Matches
create_period_container Namespace Reference

Classes

class  config1

Functions

 getRuns (grl)
 makeContainer (c1)
 doFirstTry ()
 doData15 ()
 do2016LaterPeriods ()

Variables

 client = pyAMI.client.Client('atlas')

Function Documentation

◆ do2016LaterPeriods()

do2016LaterPeriods ( )

Definition at line 172 of file create_period_container.py.

172def do2016LaterPeriods():
173 grl16 = '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data16_13TeV/20161101/physics_25ns_20.7_ignoreToroidStatus.xml'
174 c1 = config1('data16_13TeV', 'MUON0', 'A', sTag='grp16_v01_', acceptTags=['p2769','p2689','p2667'], autoCreate=False, grl=grl16)
175 c1.outScript = 'createIt_16Later2.sh'
176
177 periods = AtlasAPI.list_dataperiods(client, 2, 16)
178
179 c1.project = 'data16_13TeV'
180 c1.sTag='grp16_v01_'
181 c1.acceptTags=None
182 c1.grl = grl16
183
184# pds =[p['period'] for p in periods if p['status']=='frozen']
185# print (pds)
186# sys.exit(0)
187 pds = ['J', 'K', 'L']
188
189 for p in pds:
190 for d in ['MUON0','MUON1','MUON2','MUON3']:
191 c1.period = p
192 c1.derivation = d
193 makeContainer(c1)
194

◆ doData15()

doData15 ( )

Definition at line 150 of file create_period_container.py.

150def doData15():
151 grl15 = '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.xml'
152 c1 = config1('data15_13TeV', 'MUON0', 'A', sTag='grp15_v01_', acceptTags=None, autoCreate=False, grl=None)
153 c1.outScript = 'createIt_15v2.sh'
154
155 periods = AtlasAPI.list_dataperiods(client, 2, 15)
156 c1.project = 'data15_13TeV'
157 c1.sTag='grp15_v02_'
158 c1.acceptTags=['p2889']
159 c1.grl = grl15
160
161 pds =[p['period'] for p in periods if p['status']=='frozen']
162# print (pds)
163# sys.exit(0)
164
165 for p in pds:
166 for d in ['MUON0','MUON1','MUON2','MUON3']:
167 c1.period = p
168 c1.derivation = d
169 makeContainer(c1)
170
171

◆ doFirstTry()

doFirstTry ( )

Definition at line 125 of file create_period_container.py.

125def doFirstTry():
126 grl15 = '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data15_13TeV/20160720/physics_25ns_20.7.xml'
127 grl16 = '/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data16_13TeV/20160916/physics_25ns_20.7_ignoreToroidStatus.xml'
128 c1 = config1('data16_13TeV', 'MUON0', 'A', sTag='grp16_v01_', acceptTags=['p2769','p2689','p2667'], autoCreate=False, grl=grl16)
129 c1.outScript = 'createIt_15.sh'
130
131# periods = AtlasAPI.list_dataperiods(client, 2, 16)
132
133 periods = AtlasAPI.list_dataperiods(client, 2, 15)
134 c1.project = 'data15_13TeV'
135 c1.sTag='grp15_v01_'
136 c1.acceptTags=['p2667']
137 c1.grl = grl15
138
139 pds =[p['period'] for p in periods if p['status']=='frozen']
140# print (pds)
141# sys.exit(0)
142
143 for p in pds:
144 for d in ['MUON0','MUON1','MUON2','MUON3']:
145# for d in ['MUON0']:
146 c1.period = p
147 c1.derivation = d
148 makeContainer(c1)
149

◆ getRuns()

getRuns ( grl)

Definition at line 23 of file create_period_container.py.

23def getRuns(grl):
24 listGRL = []
25 for i in grl.split(','):
26 import xml.etree.ElementTree
27 listGRL += [atype.text.split(',') for atype in xml.etree.ElementTree.parse(grl).getroot().find('NamedLumiRange').findall('Metadata') if atype.get('Name') == 'RunList']
28 return listGRL
29
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:140

◆ makeContainer()

makeContainer ( c1)

Definition at line 41 of file create_period_container.py.

41def makeContainer(c1):
42
43 x0 = AtlasAPI.list_datasets(client, patterns = [c1.project+'.%.physics_Main.merge.AOD%'], fields = ['run_number', 'ldn', 'events', 'total_size'], order=None, limit=None, show_archived=False, grl=c1.grl, data_period=c1.period)
44 runs = set([a['run_number'] for a in x0])
45
46 if len(runs)==0:
47 print ('no run in period'+c1.period+' is listed in GRL:', c1.grl)
48 return
49
50
51 x = AtlasAPI.list_datasets(client, patterns = [c1.project+'.%.physics_Main.merg%'+c1.derivation+'%'], fields = ['run_number', 'ldn', 'events', 'total_size'], order=None, limit=None, show_archived=False, grl=c1.grl, data_period=c1.period)
52
53
54 dic1={}
55 for a in x:
56 print (a['run_number'], a['ldn'])
57 try:
58 dic1[a['ldn'].split('_')[-1]].append((a['run_number'],a['ldn']))
59 except KeyError:
60 dic1[a['ldn'].split('_')[-1]] = [(a['run_number'],a['ldn'])]
61
62
63 allTags = sorted(dic1.keys(), key=lambda k: len(dic1[k]),reverse=True)
64 for tag in allTags:
65 print (tag,':', end='')
66 for xx in dic1[tag]:
67 print (xx[0], end='')
68 print()
69
70
71 t_acceptTags = c1.acceptTags if c1.acceptTags else allTags
72
73
74 ds = []
75 for t in t_acceptTags:
76 for a in dic1.get(t,[]):
77 found = False
78 for d in ds:
79 if d[0] == a[0]:
80 found = True
81 break
82 if not found:
83 ds.append(a)
84
85
86 if len(ds)==0:
87 print ('No dataset in period',c1.period+', exiting...')
88 return
89
90
91 for d in ds:
92 print (d[0],d[1])
93 runs.remove(d[0])
94 print (runs)
95
96
97 if len(runs) !=0:
98 print ('!'*10)
99 print ('MISSING ', ' '.join(runs))
100
101
102 dlist=','.join([d[1] for d in ds])
103 superTag = 'period'+c1.period+','+c1.sTag+ds[0][1][-5:]
104 comments = superTag+','+c1.derivation
105
106 cmd='ami cmd COMAPopulateSuperProductionDataset -rucioRegistration="yes" -creationComment="'+comments+'" -selectionType="run_config" -superTag="'+superTag+'" -containedDatasets="'+dlist+'" -separator="," '
107 print ('command:',cmd)
108
109
110 if c1.outScript:
111 with open(c1.outScript,'a') as f1:
112 f1.write(cmd+'\n')
113 return
114
115
116 if not c1.autoCreate:
117 while True:
118 x = raw_input("create contianer: y[es]/N[o]/e[xit]")
119 if x == 'e' or x=='N': return
120 elif x=='y': break
121
122 call(cmd, shell=True)
123
124
void print(char *figname, TCanvas *c1)
STL class.
std::vector< std::string > split(const std::string &s, const std::string &t=":")
Definition hcg.cxx:179

Variable Documentation

◆ client

create_period_container.client = pyAMI.client.Client('atlas')

Definition at line 19 of file create_period_container.py.