diff options
Diffstat (limited to 'bitbake/lib/toaster/toastergui/views.py')
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 116 |
1 files changed, 63 insertions, 53 deletions
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index 0f05955af4..2aadc75b9e 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -284,30 +284,30 @@ def _get_toggle_order_icon(request, orderkey): | |||
284 | return None | 284 | return None |
285 | 285 | ||
286 | # we check that the input comes in a valid form that we can recognize | 286 | # we check that the input comes in a valid form that we can recognize |
287 | def _validate_input(input, model): | 287 | def _validate_input(field_input, model): |
288 | 288 | ||
289 | invalid = None | 289 | invalid = None |
290 | 290 | ||
291 | if input: | 291 | if field_input: |
292 | input_list = input.split(FIELD_SEPARATOR) | 292 | field_input_list = field_input.split(FIELD_SEPARATOR) |
293 | 293 | ||
294 | # Check we have only one colon | 294 | # Check we have only one colon |
295 | if len(input_list) != 2: | 295 | if len(field_input_list) != 2: |
296 | invalid = "We have an invalid number of separators: " + input + " -> " + str(input_list) | 296 | invalid = "We have an invalid number of separators: " + field_input + " -> " + str(field_input_list) |
297 | return None, invalid | 297 | return None, invalid |
298 | 298 | ||
299 | # Check we have an equal number of terms both sides of the colon | 299 | # Check we have an equal number of terms both sides of the colon |
300 | if len(input_list[0].split(AND_VALUE_SEPARATOR)) != len(input_list[1].split(AND_VALUE_SEPARATOR)): | 300 | if len(field_input_list[0].split(AND_VALUE_SEPARATOR)) != len(field_input_list[1].split(AND_VALUE_SEPARATOR)): |
301 | invalid = "Not all arg names got values" | 301 | invalid = "Not all arg names got values" |
302 | return None, invalid + str(input_list) | 302 | return None, invalid + str(field_input_list) |
303 | 303 | ||
304 | # Check we are looking for a valid field | 304 | # Check we are looking for a valid field |
305 | valid_fields = model._meta.get_all_field_names() | 305 | valid_fields = model._meta.get_all_field_names() |
306 | for field in input_list[0].split(AND_VALUE_SEPARATOR): | 306 | for field in field_input_list[0].split(AND_VALUE_SEPARATOR): |
307 | if not reduce(lambda x, y: x or y, map(lambda x: field.startswith(x), [ x for x in valid_fields ])): | 307 | if not reduce(lambda x, y: x or y, [ field.startswith(x) for x in valid_fields ]): |
308 | return None, (field, [ x for x in valid_fields ]) | 308 | return None, (field, [ x for x in valid_fields ]) |
309 | 309 | ||
310 | return input, invalid | 310 | return field_input, invalid |
311 | 311 | ||
312 | # uses search_allowed_fields in orm/models.py to create a search query | 312 | # uses search_allowed_fields in orm/models.py to create a search query |
313 | # for these fields with the supplied input text | 313 | # for these fields with the supplied input text |
@@ -542,23 +542,23 @@ def generateCoveredList2( revlist = None ): | |||
542 | 542 | ||
543 | def task( request, build_id, task_id ): | 543 | def task( request, build_id, task_id ): |
544 | template = "task.html" | 544 | template = "task.html" |
545 | tasks = Task.objects.filter( pk=task_id ) | 545 | tasks_list = Task.objects.filter( pk=task_id ) |
546 | if tasks.count( ) == 0: | 546 | if tasks_list.count( ) == 0: |
547 | return redirect( builds ) | 547 | return redirect( builds ) |
548 | task = tasks[ 0 ]; | 548 | task_object = tasks_list[ 0 ]; |
549 | dependencies = sorted( | 549 | dependencies = sorted( |
550 | _find_task_dep( task ), | 550 | _find_task_dep( task_object ), |
551 | key=lambda t:'%s_%s %s'%(t.recipe.name, t.recipe.version, t.task_name)) | 551 | key=lambda t:'%s_%s %s'%(t.recipe.name, t.recipe.version, t.task_name)) |
552 | reverse_dependencies = sorted( | 552 | reverse_dependencies = sorted( |
553 | _find_task_revdep( task ), | 553 | _find_task_revdep( task_object ), |
554 | key=lambda t:'%s_%s %s'%( t.recipe.name, t.recipe.version, t.task_name )) | 554 | key=lambda t:'%s_%s %s'%( t.recipe.name, t.recipe.version, t.task_name )) |
555 | coveredBy = ''; | 555 | coveredBy = ''; |
556 | if ( task.outcome == Task.OUTCOME_COVERED ): | 556 | if ( task_object.outcome == Task.OUTCOME_COVERED ): |
557 | # _list = generateCoveredList( task ) | 557 | # _list = generateCoveredList( task ) |
558 | coveredBy = sorted(generateCoveredList2( _find_task_revdep( task ) ), key = lambda x: x.recipe.name) | 558 | coveredBy = sorted(generateCoveredList2( _find_task_revdep( task_object ) ), key = lambda x: x.recipe.name) |
559 | log_head = '' | 559 | log_head = '' |
560 | log_body = '' | 560 | log_body = '' |
561 | if task.outcome == task.OUTCOME_FAILED: | 561 | if task_object.outcome == task_object.OUTCOME_FAILED: |
562 | pass | 562 | pass |
563 | 563 | ||
564 | uri_list= [ ] | 564 | uri_list= [ ] |
@@ -570,12 +570,13 @@ def task( request, build_id, task_id ): | |||
570 | if (v.count() > 0): | 570 | if (v.count() > 0): |
571 | for mirror in v[0].variable_value.split('\\n'): | 571 | for mirror in v[0].variable_value.split('\\n'): |
572 | s=re.sub('.* ','',mirror.strip(' \t\n\r')) | 572 | s=re.sub('.* ','',mirror.strip(' \t\n\r')) |
573 | if len(s): uri_list.append(s) | 573 | if len(s): |
574 | uri_list.append(s) | ||
574 | 575 | ||
575 | context = { | 576 | context = { |
576 | 'build' : Build.objects.filter( pk = build_id )[ 0 ], | 577 | 'build' : Build.objects.filter( pk = build_id )[ 0 ], |
577 | 'object' : task, | 578 | 'object' : task_object, |
578 | 'task' : task, | 579 | 'task' : task_object, |
579 | 'covered_by' : coveredBy, | 580 | 'covered_by' : coveredBy, |
580 | 'deps' : dependencies, | 581 | 'deps' : dependencies, |
581 | 'rdeps' : reverse_dependencies, | 582 | 'rdeps' : reverse_dependencies, |
@@ -587,8 +588,8 @@ def task( request, build_id, task_id ): | |||
587 | if request.GET.get( 'show_matches', "" ): | 588 | if request.GET.get( 'show_matches', "" ): |
588 | context[ 'showing_matches' ] = True | 589 | context[ 'showing_matches' ] = True |
589 | context[ 'matching_tasks' ] = Task.objects.filter( | 590 | context[ 'matching_tasks' ] = Task.objects.filter( |
590 | sstate_checksum=task.sstate_checksum ).filter( | 591 | sstate_checksum=task_object.sstate_checksum ).filter( |
591 | build__completed_on__lt=task.build.completed_on).exclude( | 592 | build__completed_on__lt=task_object.build.completed_on).exclude( |
592 | order__isnull=True).exclude(outcome=Task.OUTCOME_NA).order_by('-build__completed_on') | 593 | order__isnull=True).exclude(outcome=Task.OUTCOME_NA).order_by('-build__completed_on') |
593 | 594 | ||
594 | return render( request, template, context ) | 595 | return render( request, template, context ) |
@@ -598,10 +599,10 @@ def recipe(request, build_id, recipe_id, active_tab="1"): | |||
598 | if Recipe.objects.filter(pk=recipe_id).count() == 0 : | 599 | if Recipe.objects.filter(pk=recipe_id).count() == 0 : |
599 | return redirect(builds) | 600 | return redirect(builds) |
600 | 601 | ||
601 | object = Recipe.objects.get(pk=recipe_id) | 602 | recipe_object = Recipe.objects.get(pk=recipe_id) |
602 | layer_version = Layer_Version.objects.get(pk=object.layer_version_id) | 603 | layer_version = Layer_Version.objects.get(pk=recipe_object.layer_version_id) |
603 | layer = Layer.objects.get(pk=layer_version.layer_id) | 604 | layer = Layer.objects.get(pk=layer_version.layer_id) |
604 | tasks = Task.objects.filter(recipe_id = recipe_id, build_id = build_id).exclude(order__isnull=True).exclude(task_name__endswith='_setscene').exclude(outcome=Task.OUTCOME_NA) | 605 | tasks_list = Task.objects.filter(recipe_id = recipe_id, build_id = build_id).exclude(order__isnull=True).exclude(task_name__endswith='_setscene').exclude(outcome=Task.OUTCOME_NA) |
605 | package_count = Package.objects.filter(recipe_id = recipe_id).filter(build_id = build_id).filter(size__gte=0).count() | 606 | package_count = Package.objects.filter(recipe_id = recipe_id).filter(build_id = build_id).filter(size__gte=0).count() |
606 | 607 | ||
607 | if active_tab != '1' and active_tab != '3' and active_tab != '4' : | 608 | if active_tab != '1' and active_tab != '3' and active_tab != '4' : |
@@ -611,10 +612,10 @@ def recipe(request, build_id, recipe_id, active_tab="1"): | |||
611 | 612 | ||
612 | context = { | 613 | context = { |
613 | 'build' : Build.objects.get(pk=build_id), | 614 | 'build' : Build.objects.get(pk=build_id), |
614 | 'object' : object, | 615 | 'object' : recipe_object, |
615 | 'layer_version' : layer_version, | 616 | 'layer_version' : layer_version, |
616 | 'layer' : layer, | 617 | 'layer' : layer, |
617 | 'tasks' : tasks, | 618 | 'tasks' : tasks_list, |
618 | 'package_count' : package_count, | 619 | 'package_count' : package_count, |
619 | 'tab_states' : tab_states, | 620 | 'tab_states' : tab_states, |
620 | } | 621 | } |
@@ -632,7 +633,7 @@ def recipe_packages(request, build_id, recipe_id): | |||
632 | return _redirect_parameters( 'recipe_packages', request.GET, mandatory_parameters, build_id = build_id, recipe_id = recipe_id) | 633 | return _redirect_parameters( 'recipe_packages', request.GET, mandatory_parameters, build_id = build_id, recipe_id = recipe_id) |
633 | (filter_string, search_term, ordering_string) = _search_tuple(request, Package) | 634 | (filter_string, search_term, ordering_string) = _search_tuple(request, Package) |
634 | 635 | ||
635 | recipe = Recipe.objects.get(pk=recipe_id) | 636 | recipe_object = Recipe.objects.get(pk=recipe_id) |
636 | queryset = Package.objects.filter(recipe_id = recipe_id).filter(build_id = build_id).filter(size__gte=0) | 637 | queryset = Package.objects.filter(recipe_id = recipe_id).filter(build_id = build_id).filter(size__gte=0) |
637 | package_count = queryset.count() | 638 | package_count = queryset.count() |
638 | queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string, 'name') | 639 | queryset = _get_queryset(Package, queryset, filter_string, search_term, ordering_string, 'name') |
@@ -641,7 +642,7 @@ def recipe_packages(request, build_id, recipe_id): | |||
641 | 642 | ||
642 | context = { | 643 | context = { |
643 | 'build' : Build.objects.get(pk=build_id), | 644 | 'build' : Build.objects.get(pk=build_id), |
644 | 'recipe' : recipe, | 645 | 'recipe' : recipe_object, |
645 | 'objects' : packages, | 646 | 'objects' : packages, |
646 | 'object_count' : package_count, | 647 | 'object_count' : package_count, |
647 | 'tablecols':[ | 648 | 'tablecols':[ |
@@ -952,13 +953,13 @@ def dirinfo(request, build_id, target_id, file_path=None): | |||
952 | } | 953 | } |
953 | return render(request, template, context) | 954 | return render(request, template, context) |
954 | 955 | ||
955 | def _find_task_dep(task): | 956 | def _find_task_dep(task_object): |
956 | 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")) | 957 | return map(lambda x: x.depends_on, Task_Dependency.objects.filter(task=task_object).filter(depends_on__order__gt = 0).exclude(depends_on__outcome = Task.OUTCOME_NA).select_related("depends_on")) |
957 | 958 | ||
958 | 959 | ||
959 | def _find_task_revdep(task): | 960 | def _find_task_revdep(task_object): |
960 | tp = [] | 961 | tp = [] |
961 | 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")) | 962 | tp = map(lambda t: t.task, Task_Dependency.objects.filter(depends_on=task_object).filter(task__order__gt=0).exclude(task__outcome = Task.OUTCOME_NA).select_related("task", "task__recipe", "task__build")) |
962 | return tp | 963 | return tp |
963 | 964 | ||
964 | def _find_task_revdep_list(tasklist): | 965 | def _find_task_revdep_list(tasklist): |
@@ -966,8 +967,8 @@ def _find_task_revdep_list(tasklist): | |||
966 | 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")) | 967 | 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")) |
967 | return tp | 968 | return tp |
968 | 969 | ||
969 | def _find_task_provider(task): | 970 | def _find_task_provider(task_object): |
970 | task_revdeps = _find_task_revdep(task) | 971 | task_revdeps = _find_task_revdep(task_object) |
971 | for tr in task_revdeps: | 972 | for tr in task_revdeps: |
972 | if tr.outcome != Task.OUTCOME_COVERED: | 973 | if tr.outcome != Task.OUTCOME_COVERED: |
973 | return tr | 974 | return tr |
@@ -1055,15 +1056,15 @@ def tasks_common(request, build_id, variant, task_anchor): | |||
1055 | i=0 | 1056 | i=0 |
1056 | a=int(anchor) | 1057 | a=int(anchor) |
1057 | count_per_page=int(pagesize) | 1058 | count_per_page=int(pagesize) |
1058 | for task in queryset.iterator(): | 1059 | for task_object in queryset.iterator(): |
1059 | if a == task.order: | 1060 | if a == task_object.order: |
1060 | new_page= (i / count_per_page ) + 1 | 1061 | new_page= (i / count_per_page ) + 1 |
1061 | request.GET.__setitem__('page', new_page) | 1062 | request.GET.__setitem__('page', new_page) |
1062 | mandatory_parameters['page']=new_page | 1063 | mandatory_parameters['page']=new_page |
1063 | return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id) | 1064 | return _redirect_parameters( variant, request.GET, mandatory_parameters, build_id = build_id) |
1064 | i += 1 | 1065 | i += 1 |
1065 | 1066 | ||
1066 | tasks = _build_page_range(Paginator(queryset, pagesize),request.GET.get('page', 1)) | 1067 | task_objects = _build_page_range(Paginator(queryset, pagesize),request.GET.get('page', 1)) |
1067 | 1068 | ||
1068 | # define (and modify by variants) the 'tablecols' members | 1069 | # define (and modify by variants) the 'tablecols' members |
1069 | tc_order={ | 1070 | tc_order={ |
@@ -1073,7 +1074,10 @@ def tasks_common(request, build_id, variant, task_anchor): | |||
1073 | 'orderkey' : 'order', | 1074 | 'orderkey' : 'order', |
1074 | 'orderfield':_get_toggle_order(request, "order"), | 1075 | 'orderfield':_get_toggle_order(request, "order"), |
1075 | 'ordericon':_get_toggle_order_icon(request, "order")} | 1076 | 'ordericon':_get_toggle_order_icon(request, "order")} |
1076 | if 'tasks' == variant: tc_order['hidden']='0'; del tc_order['clclass'] | 1077 | if 'tasks' == variant: |
1078 | tc_order['hidden']='0' | ||
1079 | del tc_order['clclass'] | ||
1080 | |||
1077 | tc_recipe={ | 1081 | tc_recipe={ |
1078 | 'name':'Recipe', | 1082 | 'name':'Recipe', |
1079 | 'qhelp':'The name of the recipe to which each task applies', | 1083 | 'qhelp':'The name of the recipe to which each task applies', |
@@ -1131,14 +1135,7 @@ def tasks_common(request, build_id, variant, task_anchor): | |||
1131 | } | 1135 | } |
1132 | 1136 | ||
1133 | } | 1137 | } |
1134 | tc_log={ | 1138 | |
1135 | 'name':'Log', | ||
1136 | 'qhelp':'Path to the task log file', | ||
1137 | 'orderfield': _get_toggle_order(request, "logfile"), | ||
1138 | 'ordericon':_get_toggle_order_icon(request, "logfile"), | ||
1139 | 'orderkey' : 'logfile', | ||
1140 | 'clclass': 'task_log', 'hidden' : 1, | ||
1141 | } | ||
1142 | tc_cache={ | 1139 | tc_cache={ |
1143 | 'name':'Cache attempt', | 1140 | 'name':'Cache attempt', |
1144 | 'qhelp':'This column tells you if a task tried to restore output from the <code>sstate-cache</code> directory or mirrors, and reports the result: Succeeded, Failed or File not in cache', | 1141 | 'qhelp':'This column tells you if a task tried to restore output from the <code>sstate-cache</code> directory or mirrors, and reports the result: Succeeded, Failed or File not in cache', |
@@ -1167,7 +1164,11 @@ def tasks_common(request, build_id, variant, task_anchor): | |||
1167 | 'orderkey' : 'elapsed_time', | 1164 | 'orderkey' : 'elapsed_time', |
1168 | 'clclass': 'time_taken', 'hidden' : 1, | 1165 | 'clclass': 'time_taken', 'hidden' : 1, |
1169 | } | 1166 | } |
1170 | if 'buildtime' == variant: tc_time['hidden']='0'; del tc_time['clclass']; tc_cache['hidden']='1'; | 1167 | if 'buildtime' == variant: |
1168 | tc_time['hidden']='0' | ||
1169 | del tc_time['clclass'] | ||
1170 | tc_cache['hidden']='1' | ||
1171 | |||
1171 | tc_cpu={ | 1172 | tc_cpu={ |
1172 | 'name':'CPU usage', | 1173 | 'name':'CPU usage', |
1173 | 'qhelp':'The percentage of task CPU utilization', | 1174 | 'qhelp':'The percentage of task CPU utilization', |
@@ -1176,7 +1177,12 @@ def tasks_common(request, build_id, variant, task_anchor): | |||
1176 | 'orderkey' : 'cpu_usage', | 1177 | 'orderkey' : 'cpu_usage', |
1177 | 'clclass': 'cpu_used', 'hidden' : 1, | 1178 | 'clclass': 'cpu_used', 'hidden' : 1, |
1178 | } | 1179 | } |
1179 | if 'cpuusage' == variant: tc_cpu['hidden']='0'; del tc_cpu['clclass']; tc_cache['hidden']='1'; | 1180 | |
1181 | if 'cpuusage' == variant: | ||
1182 | tc_cpu['hidden']='0' | ||
1183 | del tc_cpu['clclass'] | ||
1184 | tc_cache['hidden']='1' | ||
1185 | |||
1180 | tc_diskio={ | 1186 | tc_diskio={ |
1181 | 'name':'Disk I/O (ms)', | 1187 | 'name':'Disk I/O (ms)', |
1182 | 'qhelp':'Number of miliseconds the task spent doing disk input and output', | 1188 | 'qhelp':'Number of miliseconds the task spent doing disk input and output', |
@@ -1185,7 +1191,10 @@ def tasks_common(request, build_id, variant, task_anchor): | |||
1185 | 'orderkey' : 'disk_io', | 1191 | 'orderkey' : 'disk_io', |
1186 | 'clclass': 'disk_io', 'hidden' : 1, | 1192 | 'clclass': 'disk_io', 'hidden' : 1, |
1187 | } | 1193 | } |
1188 | if 'diskio' == variant: tc_diskio['hidden']='0'; del tc_diskio['clclass']; tc_cache['hidden']='1'; | 1194 | if 'diskio' == variant: |
1195 | tc_diskio['hidden']='0' | ||
1196 | del tc_diskio['clclass'] | ||
1197 | tc_cache['hidden']='1' | ||
1189 | 1198 | ||
1190 | build = Build.objects.get(pk=build_id) | 1199 | build = Build.objects.get(pk=build_id) |
1191 | 1200 | ||
@@ -1194,7 +1203,7 @@ def tasks_common(request, build_id, variant, task_anchor): | |||
1194 | 'filter_search_display': filter_search_display, | 1203 | 'filter_search_display': filter_search_display, |
1195 | 'title': title_variant, | 1204 | 'title': title_variant, |
1196 | 'build': build, | 1205 | 'build': build, |
1197 | 'objects': tasks, | 1206 | 'objects': task_objects, |
1198 | 'default_orderby' : orderby, | 1207 | 'default_orderby' : orderby, |
1199 | 'search_term': search_term, | 1208 | 'search_term': search_term, |
1200 | 'total_count': queryset_with_search.count(), | 1209 | 'total_count': queryset_with_search.count(), |
@@ -1246,7 +1255,8 @@ def recipes(request, build_id): | |||
1246 | recipes = _build_page_range(Paginator(queryset, pagesize),request.GET.get('page', 1)) | 1255 | recipes = _build_page_range(Paginator(queryset, pagesize),request.GET.get('page', 1)) |
1247 | 1256 | ||
1248 | # prefetch the forward and reverse recipe dependencies | 1257 | # prefetch the forward and reverse recipe dependencies |
1249 | deps = { }; revs = { } | 1258 | deps = { } |
1259 | revs = { } | ||
1250 | queryset_dependency=Recipe_Dependency.objects.filter(recipe__layer_version__build_id = build_id).select_related("depends_on", "recipe") | 1260 | queryset_dependency=Recipe_Dependency.objects.filter(recipe__layer_version__build_id = build_id).select_related("depends_on", "recipe") |
1251 | for recipe in recipes: | 1261 | for recipe in recipes: |
1252 | deplist = [ ] | 1262 | deplist = [ ] |