CMS 3D CMS Logo

submit.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # to submit a benchmark webpage to the validation website
3 # author: Colin
4 
5 from __future__ import print_function
6 import shutil, sys, os, valtools
7 
8 from optparse import OptionParser
9 
10 
11 
12 
13 parser = OptionParser()
14 parser.usage = "usage: %prog"
15 
16 parser.add_option("-e", "--extension", dest="extension",
17  help="adds an extension to the name of this benchmark",
18  default=None)
19 
20 parser.add_option("-f", "--force", dest="force",action="store_true",
21  help="force the submission. Be careful!",
22  default=False)
23 
24 
25 (options,args) = parser.parse_args()
26 
27 
28 
29 if len(args)!=0:
30  parser.print_help()
31  sys.exit(1)
32 
33 
34 website = valtools.website()
35 bench = valtools.benchmark( options.extension )
36 localBench = valtools.benchmark()
37 print('submitting from local: ', localBench)
38 print(' to: ', bench)
39 
40 comparisons = website.listComparisons( bench )
41 if len(comparisons)>0:
42  print('You are about to make the following list of comparison pages obsolete. These pages will thus be removed:')
43  print(comparisons)
44 
45  answer = None
46  while answer != 'y' and answer != 'n':
47  answer = raw_input('do you agree? [y/n]')
48 
49  if answer == 'n':
50  sys.exit(0)
51 
52 # check that the user can write in the website
53 website.writeAccess()
54 bench.makeRelease( website )
55 
56 
57 if bench.exists( website ) == True:
58  if options.force == False:
59  print('please use the -e option to choose another extension')
60  print(' e.g: submit.py -e Feb10')
61  print('or force it.')
62  sys.exit(1)
63  else:
64  print('overwriting...')
65  shutil.rmtree(bench.benchmarkOnWebSite(website))
66 
67 
68 # local benchmark. this one does not have an extension!
69 
70 shutil.copytree(localBench.fullName(), bench.benchmarkOnWebSite(website) )
71 print('done. Access your benchmark here:')
72 print(bench.benchmarkUrl( website ))
73 
74 # removing comparisons
75 # COMPARISONS COULD ALSO BE REDONE.
76 for comparison in comparisons:
77  rm = 'rm -rf '+comparison
78  os.system(rm)
79 
S & print(S &os, JobReport::InputFile const &f)
Definition: JobReport.cc:66