summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster
diff options
context:
space:
mode:
authorAlexandru Damian <alexandru.damian@intel.com>2015-02-24 17:20:58 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-02-24 23:35:45 +0000
commitf120b7822ea09fd234a51000c979ad97c9f26722 (patch)
treeb4eb124eeabb1aa5fb599a37688201e868cdb32a /bitbake/lib/toaster
parentcb23e3043bf5c07f111787287a321df0ece647dd (diff)
downloadpoky-f120b7822ea09fd234a51000c979ad97c9f26722.tar.gz
bitbake: toastergui: performance improvements in task details page
This patch brings better forward and reverse dependency computing in tasks page (offloading python code to the database), as well as replacing the recursive depth-first covered-by tree search with breadth-first search. (Bitbake rev: bc76da054570ae385c87d14c9f2337368e8311f3) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster')
-rw-r--r--bitbake/lib/toaster/orm/models.py2
-rwxr-xr-xbitbake/lib/toaster/toastergui/views.py40
2 files changed, 23 insertions, 19 deletions
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py
index 9d4f4c94c1..15481e5a58 100644
--- a/bitbake/lib/toaster/orm/models.py
+++ b/bitbake/lib/toaster/orm/models.py
@@ -393,6 +393,8 @@ class Task(models.Model):
393 outcome_text = property(get_outcome_text) 393 outcome_text = property(get_outcome_text)
394 sstate_text = property(get_sstate_text) 394 sstate_text = property(get_sstate_text)
395 395
396 def __unicode__(self):
397 return "%d %s:%s" % (self.id, self.recipe.name, self.task_name)
396 class Meta: 398 class Meta:
397 ordering = ('order', 'recipe' ,) 399 ordering = ('order', 'recipe' ,)
398 unique_together = ('build', 'recipe', 'task_name', ) 400 unique_together = ('build', 'recipe', 'task_name', )
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py
index 4960ba0e40..aabc3d0cd8 100755
--- a/bitbake/lib/toaster/toastergui/views.py
+++ b/bitbake/lib/toaster/toastergui/views.py
@@ -352,15 +352,17 @@ def builddashboard( request, build_id ):
352 return render( request, template, context ) 352 return render( request, template, context )
353 353
354 354
355def generateCoveredList( task ): 355
356 revList = _find_task_revdep( task ); 356def generateCoveredList2( revlist = [] ):
357 list = { }; 357 covered_list = [ x for x in revlist if x.outcome == Task.OUTCOME_COVERED ]
358 for t in revList: 358 while len(covered_list):
359 if ( t.outcome == Task.OUTCOME_COVERED ): 359 revlist = [ x for x in revlist if x.outcome != Task.OUTCOME_COVERED ]
360 list.update( generateCoveredList( t )); 360
361 else: 361 newlist = _find_task_revdep_list(covered_list)
362 list[ t.task_name ] = t; 362
363 return( list ); 363 revlist = list(set(revlist + newlist))
364 covered_list = [ x for x in revlist if x.outcome == Task.OUTCOME_COVERED ]
365 return revlist
364 366
365def task( request, build_id, task_id ): 367def task( request, build_id, task_id ):
366 template = "task.html" 368 template = "task.html"
@@ -376,9 +378,10 @@ def task( request, build_id, task_id ):
376 key=lambda t:'%s_%s %s'%( t.recipe.name, t.recipe.version, t.task_name )) 378 key=lambda t:'%s_%s %s'%( t.recipe.name, t.recipe.version, t.task_name ))
377 coveredBy = ''; 379 coveredBy = '';
378 if ( task.outcome == Task.OUTCOME_COVERED ): 380 if ( task.outcome == Task.OUTCOME_COVERED ):
379 dict = generateCoveredList( task ) 381# _list = generateCoveredList( task )
382 _list = generateCoveredList2( _find_task_revdep( task ) )
380 coveredBy = [ ] 383 coveredBy = [ ]
381 for name, t in dict.items( ): 384 for t in _list:
382 coveredBy.append( t ) 385 coveredBy.append( t )
383 log_head = '' 386 log_head = ''
384 log_body = '' 387 log_body = ''
@@ -737,18 +740,17 @@ def dirinfo(request, build_id, target_id, file_path=None):
737 return render(request, template, context) 740 return render(request, template, context)
738 741
739def _find_task_dep(task): 742def _find_task_dep(task):
740 tp = [] 743 return map(lambda x: x.depends_on, Task_Dependency.objects.filter(task=task).filter(depends_on__order__gt = 0).exclude(depends_on__outcome = Task.OUTCOME_NA).select_related("depends_on"))
741 for p in Task_Dependency.objects.filter(task=task):
742 if (p.depends_on.order > 0) and (p.depends_on.outcome != Task.OUTCOME_NA):
743 tp.append(p.depends_on);
744 return tp
745 744
746 745
747def _find_task_revdep(task): 746def _find_task_revdep(task):
748 tp = [] 747 tp = []
749 for p in Task_Dependency.objects.filter(depends_on=task): 748 tp = map(lambda t: t.task, Task_Dependency.objects.filter(depends_on=task).filter(task__order__gt=0).exclude(task__outcome = Task.OUTCOME_NA).select_related("task", "task__recipe", "task__build"))
750 if (p.task.order > 0) and (p.task.outcome != Task.OUTCOME_NA): 749 return tp
751 tp.append(p.task); 750
751def _find_task_revdep_list(tasklist):
752 tp = []
753 tp = map(lambda t: t.task, Task_Dependency.objects.filter(depends_on__in=tasklist).filter(task__order__gt=0).exclude(task__outcome = Task.OUTCOME_NA).select_related("task", "task__recipe", "task__build"))
752 return tp 754 return tp
753 755
754def _find_task_provider(task): 756def _find_task_provider(task):