CMS 3D CMS Logo

Classes | Functions | Variables
ValidationMatrix_v2 Namespace Reference

Classes

class  ReleaseComparison
 

Functions

def call_compare_using_files (args)
 
def merge_dbs (main_db, partial_db)
 
def partial_db_name (db_name, i)
 

Variables

 action
 
 args
 
 default
 
 dest
 
 help
 
 no_url
 
 optional_group
 
 opts
 
 parser
 Parse options. More...
 
 rel_cmp
 
 start
 
 usage
 
 use_external
 

Detailed Description

The script compares two releases, generates SQLite3 database file with release
comparison information.

Author:  Albertas Gimbutas,  Vilnius University (LT)
e-mail:  albertasgim@gmail.com

Note: default Pool size for file comparison is 7.
Note: did NOT finish static HTML generation implementation.

Function Documentation

def ValidationMatrix_v2.call_compare_using_files (   args)

Definition at line 63 of file ValidationMatrix_v2.py.

References join().

64  file1, file2, work_path, db_name, clear_db = args
65  command = ['./compare_using_files_v2.py', join(work_path, file1), join(work_path, file2), '--db', db_name]
66  if clear_db:
67  command.append('--cl')
68  return call(command)
69 
def call_compare_using_files(args)
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def ValidationMatrix_v2.merge_dbs (   main_db,
  partial_db 
)

Definition at line 74 of file ValidationMatrix_v2.py.

Referenced by ValidationMatrix_v2.ReleaseComparison.compare().

74 def merge_dbs(main_db, partial_db):
75  conn = sqlite3.connect(main_db)
76  c = conn.cursor()
77 
78  ## Test if database is empty
79  c.execute('''SELECT * FROM Directory limit 1;''')
80  directory_row = c.fetchall()
81 
82  ## Select offsets
83  rel_cmp_offset, file_cmp_offset, directory_offset, hist_cmp_offset = 0, 0, 0, 0
84  if directory_row:
85  c.execute('''SELECT count(*) FROM ReleaseComparison;''')
86  rel_cmp_offset = c.fetchone()[0]
87  c.execute('''SELECT count(*) FROM RootFileComparison;''')
88  file_cmp_offset = c.fetchone()[0]
89  c.execute('''SELECT max(id) FROM Directory;''')
90  directory_offset = c.fetchone()[0]
91  c.execute('''SELECT max(id) FROM HistogramComparison;''')
92  hist_cmp_offset = c.fetchone()[0]
93 
94  ## Merge DBs
95  c.executescript("""
96  ATTACH '{0}' AS partial;
97  BEGIN;
98 
99  INSERT INTO ReleaseComparison (title, release1, release2, statistical_test)
100  SELECT title, release1, release2, statistical_test FROM partial.ReleaseComparison;
101 
102  INSERT INTO RootFileComparison (filename1, filename2, release_comparison_id, directory_id)
103  SELECT filename1, filename2, release_comparison_id+{1}, directory_id+{3} FROM partial.RootFileComparison;
104 
105  INSERT INTO Directory (id, name, parent_id, from_histogram_id, till_histogram_id)
106  SELECT id+{3}, name, parent_id+{3}, from_histogram_id+{4}, till_histogram_id+{4} FROM partial.Directory;
107 
108  INSERT INTO HistogramComparison (name, p_value, directory_id)
109  SELECT name, p_value, directory_id+{3} FROM partial.HistogramComparison;
110 
111  COMMIT;""".format(partial_db, rel_cmp_offset, file_cmp_offset, directory_offset, hist_cmp_offset))
112 
113  ## Select Last RootFileComparison ID
114  c.execute('''SELECT max(id) FROM RootFileComparison;''')
115  max_file_cmp_id = c.fetchone()[0]
116  conn.close()
117  return max_file_cmp_id
118 
119 
def merge_dbs(main_db, partial_db)
def ValidationMatrix_v2.partial_db_name (   db_name,
  i 
)
Generates temporary database name.

Definition at line 70 of file ValidationMatrix_v2.py.

Referenced by ValidationMatrix_v2.ReleaseComparison.compare().

70 def partial_db_name(db_name, i):
71  """Generates temporary database name."""
72  return '%s___%d.db' % (db_name.strip('.db'), i + 1)
73 
def partial_db_name(db_name, i)

Variable Documentation

ValidationMatrix_v2.action

Definition at line 27 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.args

Definition at line 262 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.default

Definition at line 27 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.dest

Definition at line 27 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.help

Definition at line 28 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.no_url

Definition at line 266 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.optional_group

Definition at line 39 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.opts

Definition at line 262 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.parser

Parse options.

Definition at line 25 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.rel_cmp

Definition at line 266 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.start

Definition at line 261 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.usage

Definition at line 25 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.use_external

Definition at line 266 of file ValidationMatrix_v2.py.