ATLAS Offline Software
getLatestRuns.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
4 """
5 Get list of runs taken in last xx seconds
6 """
7 
8 __version__ = ''
9 __usage__ = '''%prog [options]
10 
11 Get list of runs taken in last xx seconds
12 '''
13 from DQUtils.oracle import fetch_recent_runs
14 import os
15 
16 from optparse import OptionParser
17 parser = OptionParser(usage=__usage__, version=__version__)
18 parser.add_option('', '--outputDir', dest='outputDir', default='/afs/cern.ch/user/a/atlidbs/nt/DataPeriods/data_latest', help='Output directory for file with run list')
19 (options,args) = parser.parse_args()
20 
21 
22 if(len(args)) < 2:
23  parser.error('wrong number of command line arguments')
24 interval = args[0]
25 fileLabel = args[1]
26 
27 filename = options.outputDir+'/'+fileLabel+'.runs.list'
28 
29 path = os.path
30 if path.exists(filename):
31  os.system('rm ' + filename)
32 
33 with open(filename, 'w') as f:
34  f.write('\n'.join([str(r[1]) for r in fetch_recent_runs(int(interval))]))
35 
python.oracle.fetch_recent_runs
def fetch_recent_runs(how_recent=ONE_WEEK, ascending=False)
Definition: oracle.py:96
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Trk::open
@ open
Definition: BinningType.h:40
if
if(febId1==febId2)
Definition: LArRodBlockPhysicsV0.cxx:567
str
Definition: BTagTrackIpAccessor.cxx:11