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

Function Documentation

◆ do2016LaterPeriods()

create_period_container.do2016LaterPeriods ( )

Definition at line 175 of file create_period_container.py.

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

◆ doData15()

create_period_container.doData15 ( )

Definition at line 153 of file create_period_container.py.

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

◆ doFirstTry()

create_period_container.doFirstTry ( )

Definition at line 128 of file create_period_container.py.

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

◆ getRuns()

create_period_container.getRuns ( grl)

Definition at line 26 of file create_period_container.py.

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

◆ makeContainer()

create_period_container.makeContainer ( c1)

Definition at line 44 of file create_period_container.py.

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

Variable Documentation

◆ client

create_period_container.client
Initial value:
1= pyAMI.client.Client(
2 'atlas'
3 #'atlas-replica'
4)

Definition at line 19 of file create_period_container.py.