[llvm-commits] [zorg] r146941 - in /zorg/trunk/lnt/lnt: db/perfdb.py lnttool/import_data.py server/db/v4db.py util/ImportData.py
Daniel Dunbar
daniel at zuster.org
Mon Dec 19 17:14:11 PST 2011
Author: ddunbar
Date: Mon Dec 19 19:14:11 2011
New Revision: 146941
URL: http://llvm.org/viewvc/llvm-project?rev=146941&view=rev
Log:
[lnt/v0.4] ImportData: Sink importDataFromDict to be a DB method, and start instantiating the correct database (although this will crash and burn quickly).
- Also, allow V4DB to take non-urlified paths (assumed as sqlite), for ease of transition.
Modified:
zorg/trunk/lnt/lnt/db/perfdb.py
zorg/trunk/lnt/lnt/lnttool/import_data.py
zorg/trunk/lnt/lnt/server/db/v4db.py
zorg/trunk/lnt/lnt/util/ImportData.py
Modified: zorg/trunk/lnt/lnt/db/perfdb.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/db/perfdb.py?rev=146941&r1=146940&r2=146941&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/db/perfdb.py (original)
+++ zorg/trunk/lnt/lnt/db/perfdb.py Mon Dec 19 19:14:11 2011
@@ -341,6 +341,9 @@
self.session.rollback()
self.modified_machine = self.modified_test = self.modified_run = False
+ def importDataFromDict(self, data):
+ return importDataFromDict(self, data)
+
def importDataFromDict(db, data):
# FIXME: Validate data
machineData = data['Machine']
Modified: zorg/trunk/lnt/lnt/lnttool/import_data.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/lnttool/import_data.py?rev=146941&r1=146940&r2=146941&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/lnttool/import_data.py (original)
+++ zorg/trunk/lnt/lnt/lnttool/import_data.py Mon Dec 19 19:14:11 2011
@@ -3,7 +3,8 @@
import lnt.db.perfdb
from lnt import formats
import lnt.server.config
-from lnt.util import ImportData
+import lnt.server.db.v4db
+import lnt.util.ImportData
def action_import(name, args):
"""import test data into a database"""
@@ -52,10 +53,18 @@
if db_entry is None:
parser.error("invalid database name")
+ # Load the appropriate version of the database.
+ if db_entry.db_version == '0.3':
+ db = lnt.db.perfdb.PerfDB(db_entry.path, echo=opts.show_sql)
+ elif db_entry.db_version == '0.4':
+ db = lnt.server.db.v4db.V4DB(db_entry.path, echo=opts.show_sql)
+ else:
+ raise NotImplementedError,"unable to import to version %r database" % (
+ db_entry.db_version,)
+
# Load the database.
- db = lnt.db.perfdb.PerfDB(db_entry.path, echo=opts.show_sql)
for file in args:
- result = ImportData.import_and_report(
+ result = lnt.util.ImportData.import_and_report(
config, opts.database, db, file,
opts.format, opts.commit, opts.show_sample_count,
opts.noEmail)
@@ -63,5 +72,6 @@
if opts.show_raw_result:
pprint.pprint(result)
else:
- ImportData.print_report_result(result, sys.stdout, opts.verbose)
+ lnt.util.ImportData.print_report_result(result, sys.stdout,
+ opts.verbose)
Modified: zorg/trunk/lnt/lnt/server/db/v4db.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/db/v4db.py?rev=146941&r1=146940&r2=146941&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/v4db.py (original)
+++ zorg/trunk/lnt/lnt/server/db/v4db.py Mon Dec 19 19:14:11 2011
@@ -22,8 +22,12 @@
return testsuitedb.TestSuiteDB(self.v4db, ts)
def __init__(self, path, echo=False):
- assert (path.startswith('mysql://') or
- path.startswith('sqlite://')), "invalid database path"
+ # If the path includes no database type, assume sqlite.
+ #
+ # FIXME: I would like to phase this out and force clients to propagate
+ # paths, but it isn't a big deal.
+ if not path.startswith('mysql://') and not path.startswith('sqlite://'):
+ path = 'sqlite:///' + path
self.path = path
self.engine = sqlalchemy.create_engine(path, echo=echo)
Modified: zorg/trunk/lnt/lnt/util/ImportData.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/util/ImportData.py?rev=146941&r1=146940&r2=146941&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/util/ImportData.py (original)
+++ zorg/trunk/lnt/lnt/util/ImportData.py Mon Dec 19 19:14:11 2011
@@ -60,7 +60,7 @@
importStartTime = time.time()
try:
- success,run = lnt.db.perfdb.importDataFromDict(db, data)
+ success,run = db.importDataFromDict(data)
except KeyboardInterrupt:
raise
except:
More information about the llvm-commits
mailing list