ATLAS Offline Software
removeVals.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import uploadTools
4 
5 basepath="/afs/cern.ch/atlas/groups/Generators/CrossSectionInfo/ScriptsCentralPage/"
6 
7 def main():
8 
9  # parse options from command line
10  from optparse import OptionParser
11  parser = OptionParser(usage = "usage: %prog arguments", version="%prog")
12  parser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="Set verbose mode (default: %default)")
13  parser.add_option("-y", "--alwaysyes", action="store_true", dest="alwaysyes", help="Always answer yes to checks (default: %default)")
14  parser.add_option("-t", "--istest", action="store", dest="istest", help="Is test (no actual upload to AMI) (default: %default)")
15  parser.add_option("-e", "--explanation",action="store", dest="explanation",help="Comment for explanation field (default: %default)")
16  parser.add_option("-d", "--dataset", action="store", dest="dataset", help="Dataset to remove value from (default: %default)")
17  parser.add_option("-p", "--param", action="store", dest="param", help="Parameter to remove (default: %default)")
18 
19  parser.set_defaults(verbose=False,alwaysyes=False,istest="TRUE",explanation=None,dataset=None,param=None)
20 
21  (opts, args) = parser.parse_args()
22 
23  if not opts.explanation:
24  print "ERROR: No explanation found - Should be JIRA ticket or similar"
25  return
26  elif 'CENTRPAGE' not in opts.explanation:
27  print "WARNING: Explanation found, but does not include CENTRPAGE - this should usually be a JIRA ticket"
28 
29  if not opts.dataset:
30  print "ERROR: No dataset found"
31  return
32 
33  if not opts.param:
34  print "ERROR: No parameter found"
35  return
36 
37  if opts.istest=="FALSE":
38  opts.istest=False
39 
40  UT=uploadTools.UT(opts=opts)
41  cols=UT.colors
42 
43  if not opts.istest:
44  print cols.FAIL+"INFO: THIS IS NOT A TEST - UPLOADING FOR REALS!"+cols.ENDC
45  else:
46  print cols.OKGREEN+"INFO: THIS IS A TEST - Nothing will be uploaded!"+cols.ENDC
47 
48 
49  UT.removeParamEntry(opts.dataset,UT.getScope(opts.dataset),opts.param,opts.explanation)
50 
51 
52 if __name__ == '__main__':
53  main()
54 
removeVals.main
def main()
Definition: removeVals.py:7
uploadTools.UT
Definition: uploadTools.py:10