[llvm-commits] [zorg] r147508 - in /zorg/trunk/lnt/lnt: server/config.py server/db/v4db.py util/ImportData.py
Daniel Dunbar
daniel at zuster.org
Tue Jan 3 16:49:53 PST 2012
Author: ddunbar
Date: Tue Jan 3 18:49:52 2012
New Revision: 147508
URL: http://llvm.org/viewvc/llvm-project?rev=147508&view=rev
Log:
[lnt/v0.4] lnt.util.ImportData: Add a "shadow import" feature which allows database entries to configure a "shadow" database to always duplicate import submissions into.
- Useful for bringing up a new database schema, for example. Imagine that!!!
Modified:
zorg/trunk/lnt/lnt/server/config.py
zorg/trunk/lnt/lnt/server/db/v4db.py
zorg/trunk/lnt/lnt/util/ImportData.py
Modified: zorg/trunk/lnt/lnt/server/config.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/config.py?rev=147508&r1=147507&r2=147508&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/config.py (original)
+++ zorg/trunk/lnt/lnt/server/config.py Tue Jan 3 18:49:52 2012
@@ -52,15 +52,17 @@
bool(dict.get('showGeneral')),
bool(dict.get('showSimple')),
str(dict.get('db_version', '0.3')),
+ dict.get('shadow_import', None),
email_config)
def __init__(self, path, showNightlytest, showGeneral, showSimple,
- db_version, email_config):
+ db_version, shadow_import, email_config):
self.path = path
self.showGeneral = showGeneral
self.showNightlytest = showNightlytest
self.showSimple = showSimple
self.db_version = db_version
+ self.shadow_import = shadow_import
self.email_config = email_config
class Config:
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=147508&r1=147507&r2=147508&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/v4db.py (original)
+++ zorg/trunk/lnt/lnt/server/db/v4db.py Tue Jan 3 18:49:52 2012
@@ -119,6 +119,10 @@
tag,)
db = self.testsuite.get(db_name)
+ if db is None:
+ raise ValueError,"test suite %r not present in this database!" % (
+ db_name)
+
return db.importDataFromDict(data)
def get_db_summary(self):
Modified: zorg/trunk/lnt/lnt/util/ImportData.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/util/ImportData.py?rev=147508&r1=147507&r2=147508&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/util/ImportData.py (original)
+++ zorg/trunk/lnt/lnt/util/ImportData.py Tue Jan 3 18:49:52 2012
@@ -100,6 +100,25 @@
result['report_time'] = time.time() - importStartTime
result['total_time'] = time.time() - startTime
+ # If this database has a shadow import configured, import the run into that
+ # database as well.
+ db_config = config.databases[db_name]
+ if db_config.shadow_import:
+ # Load the shadow database to import into.
+ shadow_name = db_config.shadow_import
+ shadow_db = config.get_database(shadow_name)
+ if shadow_db is None:
+ raise ValueError,("invalid configuration, shadow import "
+ "database %r does not exist") % shadow_name
+
+ # Perform the shadow import.
+ shadow_result = import_and_report(config, shadow_name,
+ shadow_db, file, format, commit,
+ show_sample_count, disable_email)
+
+ # Append the shadow result to the result.
+ result['shadow_result'] = shadow_result
+
result['success'] = True
return result
More information about the llvm-commits
mailing list