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 64 of file ValidationMatrix_v2.py.

References join().

65  file1, file2, work_path, db_name, clear_db = args
66  command = ['./compare_using_files_v2.py', join(work_path, file1), join(work_path, file2), '--db', db_name]
67  if clear_db:
68  command.append('--cl')
69  return call(command)
70 
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 75 of file ValidationMatrix_v2.py.

Referenced by ValidationMatrix_v2.ReleaseComparison.compare().

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

Definition at line 71 of file ValidationMatrix_v2.py.

Referenced by ValidationMatrix_v2.ReleaseComparison.compare().

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

Variable Documentation

ValidationMatrix_v2.action

Definition at line 28 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.args

Definition at line 263 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.default

Definition at line 28 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.dest

Definition at line 28 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.help

Definition at line 29 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.no_url

Definition at line 267 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.optional_group

Definition at line 40 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.opts

Definition at line 263 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.parser

Parse options.

Definition at line 26 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.rel_cmp

Definition at line 267 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.start

Definition at line 262 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.usage

Definition at line 26 of file ValidationMatrix_v2.py.

ValidationMatrix_v2.use_external

Definition at line 267 of file ValidationMatrix_v2.py.