CMS 3D CMS Logo

Classes | Functions | Variables

ValidationMatrix_v2 Namespace Reference

Classes

class  ReleaseComparison

Functions

def call_compare_using_files
def merge_dbs
def partial_db_name

Variables

string help = 'First CMSSW release for release comparison, e.g. CMSSW_5_3_2_pre7.'
tuple optional_group = OptionGroup(parser, 'Optional')
tuple parser
 Parse options.
tuple rel_cmp = ReleaseComparison(opts.dir, opts.db_name, opts.clear_db, opts.dry, opts.no_url, use_external=True)
tuple start = datetime.now()

Function Documentation

def ValidationMatrix_v2::call_compare_using_files (   args)

Definition at line 63 of file ValidationMatrix_v2.py.

00064                                   :
00065     file1, file2, work_path, db_name, clear_db = args
00066     command = ['./compare_using_files_v2.py', join(work_path, file1), join(work_path, file2), '--db', db_name]
00067     if clear_db:
00068         command.append('--cl')
00069     return call(command)

def ValidationMatrix_v2::merge_dbs (   main_db,
  partial_db 
)

Definition at line 74 of file ValidationMatrix_v2.py.

00075                                   :
00076     conn = sqlite3.connect(main_db)
00077     c = conn.cursor()
00078 
00079     ## Test if database is empty
00080     c.execute('''SELECT * FROM Directory limit 1;''')
00081     directory_row = c.fetchall()
00082 
00083     ## Select offsets
00084     rel_cmp_offset, file_cmp_offset, directory_offset, hist_cmp_offset = 0, 0, 0, 0
00085     if directory_row:
00086         c.execute('''SELECT count(*) FROM ReleaseComparison;''')
00087         rel_cmp_offset = c.fetchone()[0]
00088         c.execute('''SELECT count(*) FROM RootFileComparison;''')
00089         file_cmp_offset = c.fetchone()[0]
00090         c.execute('''SELECT max(id) FROM Directory;''')
00091         directory_offset = c.fetchone()[0]
00092         c.execute('''SELECT max(id) FROM HistogramComparison;''')
00093         hist_cmp_offset = c.fetchone()[0]
00094 
00095     ## Merge DBs
00096     c.executescript("""
00097     ATTACH '{0}' AS partial;
00098     BEGIN;
00099 
00100     INSERT INTO ReleaseComparison (title, release1, release2, statistical_test)
00101     SELECT title, release1, release2, statistical_test FROM partial.ReleaseComparison;
00102 
00103     INSERT INTO RootFileComparison (filename1, filename2, release_comparison_id, directory_id)
00104     SELECT filename1, filename2, release_comparison_id+{1}, directory_id+{3} FROM partial.RootFileComparison;
00105 
00106     INSERT INTO Directory (id, name, parent_id, from_histogram_id, till_histogram_id)
00107     SELECT id+{3}, name, parent_id+{3}, from_histogram_id+{4}, till_histogram_id+{4} FROM partial.Directory;
00108 
00109     INSERT INTO HistogramComparison (name, p_value, directory_id)
00110     SELECT name, p_value, directory_id+{3} FROM partial.HistogramComparison;
00111 
00112     COMMIT;""".format(partial_db, rel_cmp_offset, file_cmp_offset, directory_offset, hist_cmp_offset))
00113 
00114     ## Select Last RootFileComparison ID
00115     c.execute('''SELECT max(id) FROM RootFileComparison;''')
00116     max_file_cmp_id = c.fetchone()[0]
00117     conn.close()
00118     return max_file_cmp_id
00119 

def ValidationMatrix_v2::partial_db_name (   db_name,
  i 
)
Generates temporary database name.

Definition at line 70 of file ValidationMatrix_v2.py.

00071                                :
00072     """Generates temporary database name."""
00073     return '%s___%d.db' % (db_name.strip('.db'), i + 1)


Variable Documentation

string ValidationMatrix_v2::help = 'First CMSSW release for release comparison, e.g. CMSSW_5_3_2_pre7.'

Definition at line 28 of file ValidationMatrix_v2.py.

tuple ValidationMatrix_v2::optional_group = OptionGroup(parser, 'Optional')

Definition at line 39 of file ValidationMatrix_v2.py.

Initial value:
00001 OptionParser(usage='Usage: %prog --re1 RELEASE1 [--f1 FR,FR,..] ' +
00002                             '--re2 RELEASE2 [--f2 FR,FR,..] [--st ST_TESTS] [options]')

Parse options.

Definition at line 25 of file ValidationMatrix_v2.py.

tuple ValidationMatrix_v2::rel_cmp = ReleaseComparison(opts.dir, opts.db_name, opts.clear_db, opts.dry, opts.no_url, use_external=True)

Definition at line 266 of file ValidationMatrix_v2.py.

tuple ValidationMatrix_v2::start = datetime.now()

Definition at line 261 of file ValidationMatrix_v2.py.