diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-05-30 18:51:27 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-05-30 18:51:27 +0000 |
commit | 67e71c9ff4d8ed55341c99b2cc278b8efa294e89 (patch) | |
tree | af1b1be36e9d2e5e3fec296f8fdcb7a9bd5d3e9a | |
parent | 97ee4fddbfcfefa7005e66736c0fbb9dc676ecbe (diff) | |
download | bcfg2-67e71c9ff4d8ed55341c99b2cc278b8efa294e89.tar.gz bcfg2-67e71c9ff4d8ed55341c99b2cc278b8efa294e89.tar.bz2 bcfg2-67e71c9ff4d8ed55341c99b2cc278b8efa294e89.zip |
Add -O3 mode to importscript to relax reason deduplication process (Results in 1000X speedup for large databases) Because it breaks common reason display in the reporting system, this is non-default behavior
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4639 ce84e21b-d406-0410-9b95-82705330c041
-rwxr-xr-x | src/lib/Server/Reports/importscript.py | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/lib/Server/Reports/importscript.py b/src/lib/Server/Reports/importscript.py index 83df3ac94..a37f64214 100755 --- a/src/lib/Server/Reports/importscript.py +++ b/src/lib/Server/Reports/importscript.py @@ -180,7 +180,11 @@ if __name__ == '__main__': for (xpath, obj, tablename) in pattern: for x in statistics.findall(xpath): kargs = build_reason_kwargs(x) - rls = Reason.objects.filter(**kargs) + if '-O3' not in sys.argv: + rls = Reason.objects.filter(**kargs) + else: + rls = [] + if rls: rr = rls[0] if verbose: @@ -190,9 +194,13 @@ if __name__ == '__main__': rr.save() if verbose: print "Created reason: %s" % rr.id - links = obj.objects.filter(name=x.get('name'), - kind=x.tag, - reason=rr) + if '-O3' not in sys.argv: + links = obj.objects.filter(name=x.get('name'), + kind=x.tag, + reason=rr) + else: + links = [] + if links: item_id = links[0].id if verbose: @@ -204,7 +212,7 @@ if __name__ == '__main__': newitem.save() item_id = newitem.id if verbose: - print "Bad item INSERTED having reason id %s and ID %s" % (rr.id, item_id) + print "%s item INSERTED having reason id %s and ID %s" % (xpath, rr.id, item_id) try: cursor.execute("INSERT INTO "+tablename+"_interactions VALUES (NULL, %s, %s);", [item_id, current_interaction_id]) @@ -213,7 +221,11 @@ if __name__ == '__main__': for times in statistics.findall('OpStamps'): for metric, value in times.items(): - mmatch = Performance.objects.filter(metric=metric, value=value) + if '-O3' not in sys.argv: + mmatch = Performance.objects.filter(metric=metric, value=value) + else: + mmatch = [] + if mmatch: item_id = mmatch[0].id else: |