summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2015-02-24 17:20:57 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-24 23:35:45 +0000
commitcb23e3043bf5c07f111787287a321df0ece647dd (patch)
tree7e44457c912b50bf78cc2048d1309f9f46cf2c50 /bitbake
parent6de6739c4cee68c38b815f8daa948156cf0a7c73 (diff)
downloadpoky-cb23e3043bf5c07f111787287a321df0ece647dd.tar.gz
bitbake: toasterui: disable autocommit for build logging
This patch disables autocommit for inserting build data, effectively updating all build data in a single transaction. This is a purely performance improvement patch, as the transaction will always be commited. Similar manual transaction handling in the layer source update method. Added feedback messages during update method. [YOCTO #7140] (Bitbake rev: 3978c819e797f857235499a4b8ec238134f1c028) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py11
-rw-r--r--bitbake/lib/toaster/orm/models.py18
2 files changed, 28 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 1096ccf4de..967e4bdca2 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -35,6 +35,7 @@ from bb.msg import BBLogFormatter as format
35from django.db import models 35from django.db import models
36import logging 36import logging
37 37
38from django.db import transaction
38 39
39logger = logging.getLogger("BitBake") 40logger = logging.getLogger("BitBake")
40 41
@@ -606,7 +607,9 @@ class BuildInfoHelper(object):
606 self.internal_state = {} 607 self.internal_state = {}
607 self.internal_state['taskdata'] = {} 608 self.internal_state['taskdata'] = {}
608 self.task_order = 0 609 self.task_order = 0
610 self.autocommit_step = 1
609 self.server = server 611 self.server = server
612 transaction.set_autocommit(False)
610 self.orm_wrapper = ORMWrapper() 613 self.orm_wrapper = ORMWrapper()
611 self.has_build_history = has_build_history 614 self.has_build_history = has_build_history
612 self.tmp_dir = self.server.runCommand(["getVariable", "TMPDIR"])[0] 615 self.tmp_dir = self.server.runCommand(["getVariable", "TMPDIR"])[0]
@@ -926,6 +929,12 @@ class BuildInfoHelper(object):
926 task_information['outcome'] = Task.OUTCOME_FAILED 929 task_information['outcome'] = Task.OUTCOME_FAILED
927 del self.internal_state['taskdata'][identifier] 930 del self.internal_state['taskdata'][identifier]
928 931
932 # we force a sync point here, to get the progress bar to show
933 if self.autocommit_step % 3 == 0:
934 transaction.set_autocommit(True)
935 transaction.set_autocommit(False)
936 self.autocommit_step += 1
937
929 self.orm_wrapper.get_update_task_object(task_information, True) # must exist 938 self.orm_wrapper.get_update_task_object(task_information, True) # must exist
930 939
931 940
@@ -1197,3 +1206,5 @@ class BuildInfoHelper(object):
1197 # we have no build, and we still have events; something amazingly wrong happend 1206 # we have no build, and we still have events; something amazingly wrong happend
1198 for event in self.internal_state['backlog']: 1207 for event in self.internal_state['backlog']:
1199 logger.error("UNSAVED log: %s", event.msg) 1208 logger.error("UNSAVED log: %s", event.msg)
1209
1210 transaction.set_autocommit(True)
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 54cd5354de..9d4f4c94c1 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -664,6 +664,7 @@ class LayerIndexLayerSource(LayerSource):
664 """ 664 """
665 assert self.apiurl is not None 665 assert self.apiurl is not None
666 from django.db import IntegrityError 666 from django.db import IntegrityError
667 from django.db import transaction
667 668
668 import httplib, urlparse, json 669 import httplib, urlparse, json
669 import os 670 import os
@@ -715,6 +716,7 @@ class LayerIndexLayerSource(LayerSource):
715 # update branches; only those that we already have names listed in the Releases table 716 # update branches; only those that we already have names listed in the Releases table
716 whitelist_branch_names = map(lambda x: x.branch_name, Release.objects.all()) 717 whitelist_branch_names = map(lambda x: x.branch_name, Release.objects.all())
717 718
719 print "Fetching branches"
718 branches_info = _get_json_response(apilinks['branches'] 720 branches_info = _get_json_response(apilinks['branches']
719 + "?filter=name:%s" % "OR".join(whitelist_branch_names)) 721 + "?filter=name:%s" % "OR".join(whitelist_branch_names))
720 for bi in branches_info: 722 for bi in branches_info:
@@ -727,6 +729,7 @@ class LayerIndexLayerSource(LayerSource):
727 729
728 # update layers 730 # update layers
729 layers_info = _get_json_response(apilinks['layerItems']) 731 layers_info = _get_json_response(apilinks['layerItems'])
732 transaction.set_autocommit(False)
730 for li in layers_info: 733 for li in layers_info:
731 l, created = Layer.objects.get_or_create(layer_source = self, name = li['name']) 734 l, created = Layer.objects.get_or_create(layer_source = self, name = li['name'])
732 l.up_id = li['id'] 735 l.up_id = li['id']
@@ -738,11 +741,15 @@ class LayerIndexLayerSource(LayerSource):
738 l.summary = li['summary'] 741 l.summary = li['summary']
739 l.description = li['description'] 742 l.description = li['description']
740 l.save() 743 l.save()
744 transaction.set_autocommit(True)
741 745
742 # update layerbranches/layer_versions 746 # update layerbranches/layer_versions
747 print "Fetching layer information"
743 layerbranches_info = _get_json_response(apilinks['layerBranches'] 748 layerbranches_info = _get_json_response(apilinks['layerBranches']
744 + "?filter=branch:%s" % "OR".join(map(lambda x: str(x.up_id), [i for i in Branch.objects.filter(layer_source = self) if i.up_id is not None] )) 749 + "?filter=branch:%s" % "OR".join(map(lambda x: str(x.up_id), [i for i in Branch.objects.filter(layer_source = self) if i.up_id is not None] ))
745 ) 750 )
751
752 transaction.set_autocommit(False)
746 for lbi in layerbranches_info: 753 for lbi in layerbranches_info:
747 lv, created = Layer_Version.objects.get_or_create(layer_source = self, 754 lv, created = Layer_Version.objects.get_or_create(layer_source = self,
748 up_id = lbi['id'], 755 up_id = lbi['id'],
@@ -755,10 +762,12 @@ class LayerIndexLayerSource(LayerSource):
755 lv.commit = lbi['actual_branch'] 762 lv.commit = lbi['actual_branch']
756 lv.dirpath = lbi['vcs_subdir'] 763 lv.dirpath = lbi['vcs_subdir']
757 lv.save() 764 lv.save()
765 transaction.set_autocommit(True)
758 766
759 # update layer dependencies 767 # update layer dependencies
760 layerdependencies_info = _get_json_response(apilinks['layerDependencies']) 768 layerdependencies_info = _get_json_response(apilinks['layerDependencies'])
761 dependlist = {} 769 dependlist = {}
770 transaction.set_autocommit(False)
762 for ldi in layerdependencies_info: 771 for ldi in layerdependencies_info:
763 try: 772 try:
764 lv = Layer_Version.objects.get(layer_source = self, up_id = ldi['layerbranch']) 773 lv = Layer_Version.objects.get(layer_source = self, up_id = ldi['layerbranch'])
@@ -777,23 +786,29 @@ class LayerIndexLayerSource(LayerSource):
777 LayerVersionDependency.objects.filter(layer_version = lv).delete() 786 LayerVersionDependency.objects.filter(layer_version = lv).delete()
778 for lvd in dependlist[lv]: 787 for lvd in dependlist[lv]:
779 LayerVersionDependency.objects.get_or_create(layer_version = lv, depends_on = lvd) 788 LayerVersionDependency.objects.get_or_create(layer_version = lv, depends_on = lvd)
789 transaction.set_autocommit(True)
780 790
781 791
782 # update machines 792 # update machines
793 print "Fetching machine information"
783 machines_info = _get_json_response(apilinks['machines'] 794 machines_info = _get_json_response(apilinks['machines']
784 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self))) 795 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self)))
785 ) 796 )
797 transaction.set_autocommit(False)
786 for mi in machines_info: 798 for mi in machines_info:
787 mo, created = Machine.objects.get_or_create(layer_source = self, up_id = mi['id'], layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch'])) 799 mo, created = Machine.objects.get_or_create(layer_source = self, up_id = mi['id'], layer_version = Layer_Version.objects.get(layer_source = self, up_id = mi['layerbranch']))
788 mo.up_date = mi['updated'] 800 mo.up_date = mi['updated']
789 mo.name = mi['name'] 801 mo.name = mi['name']
790 mo.description = mi['description'] 802 mo.description = mi['description']
791 mo.save() 803 mo.save()
804 transaction.set_autocommit(True)
792 805
793 # update recipes; paginate by layer version / layer branch 806 # update recipes; paginate by layer version / layer branch
807 print "Fetching target information"
794 recipes_info = _get_json_response(apilinks['recipes'] 808 recipes_info = _get_json_response(apilinks['recipes']
795 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self))) 809 + "?filter=layerbranch:%s" % "OR".join(map(lambda x: str(x.up_id), Layer_Version.objects.filter(layer_source = self)))
796 ) 810 )
811 transaction.set_autocommit(False)
797 for ri in recipes_info: 812 for ri in recipes_info:
798 try: 813 try:
799 ro, created = Recipe.objects.get_or_create(layer_source = self, up_id = ri['id'], layer_version = Layer_Version.objects.get(layer_source = self, up_id = ri['layerbranch'])) 814 ro, created = Recipe.objects.get_or_create(layer_source = self, up_id = ri['id'], layer_version = Layer_Version.objects.get(layer_source = self, up_id = ri['layerbranch']))
@@ -809,8 +824,9 @@ class LayerIndexLayerSource(LayerSource):
809 ro.file_path = ri['filepath'] + "/" + ri['filename'] 824 ro.file_path = ri['filepath'] + "/" + ri['filename']
810 ro.save() 825 ro.save()
811 except: 826 except:
812 print "Duplicate Recipe, ignoring: ", vars(ro) 827 #print "Duplicate Recipe, ignoring: ", vars(ro)
813 pass 828 pass
829 transaction.set_autocommit(True)
814 pass 830 pass
815 831
816class BitbakeVersion(models.Model): 832class BitbakeVersion(models.Model):