ATLAS Offline Software
Loading...
Searching...
No Matches
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"""
5Get list of runs taken in last xx seconds
6"""
7
8__version__ = ''
9__usage__ = '''%prog [options]
10
11Get list of runs taken in last xx seconds
12'''
13from DQUtils.oracle import fetch_recent_runs
14import os
15
16from optparse import OptionParser
17parser = OptionParser(usage=__usage__, version=__version__)
18parser.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
22if(len(args)) < 2:
23 parser.error('wrong number of command line arguments')
24interval = args[0]
25fileLabel = args[1]
26
27filename = options.outputDir+'/'+fileLabel+'.runs.list'
28
29path = os.path
30if path.exists(filename):
31 os.system('rm ' + filename)
32
33with open(filename, 'w') as f:
34 f.write('\n'.join([str(r[1]) for r in fetch_recent_runs(int(interval))]))
35
if(febId1==febId2)