source: FCC2/trunk/source/fcc_master.py @ 41

Subversion URL: http://proj.badc.rl.ac.uk/svn/exarch/FCC2/trunk/source/fcc_master.py@41
Revision 41, 1.7 KB checked in by mjuckes, 6 years ago (diff)

reworked and MIP tables added

Line 
1#!/usr/bin/python
2
3import run_fcc, sys, getopt, time, os
4import string
5
6start_time = time.ctime()
7args = getopt.getopt( sys.argv[1:], 'c:d:l:q', ['R','repeatable',
8                   'noLinksOnly','linksOnly','omit-infile-checks','oic','uc=','user-config=',
9                   'no-log-passes','nlp','exception-on-fail', 'ef', 'swallow-exceptions', 'append-log'] )
10
11exceptionOnFail = False
12swallowExceptions = False
13deferredMsgs = []
14for a in args[0]:
15            if a[0] in ['--exception-on-fail','--ef']:
16              exceptionOnFail = True
17            elif a[0] in ['--swallow-exceptions','--ef']:
18              swallowExceptions = True
19
20if swallowExceptions:
21  if exceptionOnFail:
22    deferredMsgs.append( 'Inconsistent settings -- exception-on-fail reset to False' )
23    exceptionOnFail = False
24
25def report(batch_id,comp,nofail,start_time,msg):
26  if not os.path.isdir( 'reports' ):
27    os.mkdir( 'reports' )
28  oo = open( 'reports/%s_summary.txt' % batch_id, 'w' )
29  oo.write( '%s:: completion %s:: nofail %s\n' % (batch_id,comp,nofail) )
30  oo.write( '%s\n' % string.join(sys.argv) )
31  oo.write( '%s\n' % start_time )
32  oo.write( '%s\n' % time.ctime() )
33  oo.write( '%s\n' % msg )
34  oo.close()
35
36try:
37  fcc = run_fcc.fcc( 'STFC-CORDEX' )
38  batch_id = fcc.batch_id
39  fcc.extDeferredMsgs = deferredMsgs
40except:
41  print 'Failed to initiate QC tests'
42  raise
43
44try:
45  nofail = fcc.run()
46  report(batch_id,True,nofail,start_time,fcc.msg)
47  if not nofail:
48     assert not exceptionOnFail, 'Tests failed and exceptionOnFail True'
49except BaseException, msg:
50  report(batch_id,False,False,start_time,msg)
51  if not swallowExceptions:
52    raise
53except:
54  report(batch_id,False,False,start_time,'Unrecognised exception')
55  if not swallowExceptions:
56    raise
Note: See TracBrowser for help on using the repository browser.