bitbake: toastergui: decrease load time for configuration page
PATCH 1/1 bitbake: toastergui: decrease load time for configuration page
Used __in field lookup for QuerySet to get build variables faster.
[YOCTO #6691]
--- bitbake/lib/toaster/toastergui/views.py | 46 +++++++-------------------------- 1 file changed, 9 insertions(+), 37 deletions(-)
bitbake/lib/toaster/toastergui/views.py +9 -37
@@ -1267,43 +1267,15 @@ def recipes(request, build_id): def configuration(request, build_id): template = 'configuration.html' - variables = Variable.objects.filter(build=build_id) - - def _get_variable_or_empty(variable_name): - from django.core.exceptions import ObjectDoesNotExist - try: - return variables.get(variable_name=variable_name).variable_value - except ObjectDoesNotExist: - return '' - - BB_VERSION=_get_variable_or_empty(variable_name='BB_VERSION') - BUILD_SYS=_get_variable_or_empty(variable_name='BUILD_SYS') - NATIVELSBSTRING=_get_variable_or_empty(variable_name='NATIVELSBSTRING') - TARGET_SYS=_get_variable_or_empty(variable_name='TARGET_SYS') - MACHINE=_get_variable_or_empty(variable_name='MACHINE') - DISTRO=_get_variable_or_empty(variable_name='DISTRO') - DISTRO_VERSION=_get_variable_or_empty(variable_name='DISTRO_VERSION') - TUNE_FEATURES=_get_variable_or_empty(variable_name='TUNE_FEATURES') - TARGET_FPU=_get_variable_or_empty(variable_name='TARGET_FPU') - - targets = Target.objects.filter(build=build_id) - - context = { - 'objectname': 'configuration', - 'object_search_display':'variables', - 'filter_search_display':'variables', - 'build': Build.objects.get(pk=build_id), - 'BB_VERSION':BB_VERSION, - 'BUILD_SYS':BUILD_SYS, - 'NATIVELSBSTRING':NATIVELSBSTRING, - 'TARGET_SYS':TARGET_SYS, - 'MACHINE':MACHINE, - 'DISTRO':DISTRO, - 'DISTRO_VERSION':DISTRO_VERSION, - 'TUNE_FEATURES':TUNE_FEATURES, - 'TARGET_FPU':TARGET_FPU, - 'targets':targets, - } + var_names = ('BB_VERSION', 'BUILD_SYS', 'NATIVELSBSTRING', 'TARGET_SYS', + 'MACHINE', 'DISTRO', 'DISTRO_VERSION', 'TUNE_FEATURES', 'TARGET_FPU') + context = dict(Variable.objects.filter(build=build_id, variable_name__in=var_names)\ + .values_list('variable_name', 'variable_value')) + context.update({'objectname': 'configuration', + 'object_search_display':'variables', + 'filter_search_display':'variables', + 'build': Build.objects.get(pk=build_id), + 'targets': Target.objects.filter(build=build_id)}) return render(request, template, context)
Signature · 1 line
2.1.4
Taken for submission,
Thank you,
Alex
Quoted 83 lines · Ed Bartosh
Used
__infield lookup for QuerySet to get build variables faster.[YOCTO #6691]
Signed-off-by Ed Bartosh <[email protected]>--- bitbake/lib/toaster/toastergui/views.py | 46 +++++++-------------------------- 1 file changed, 9 insertions(+), 37 deletions(-)bitbake/lib/toaster/toastergui/views.py +0
-6@@ -1267,43 +1267,15 @@ def recipes(request, build_id): def configuration(request, build_id): template = 'configuration.html' - variables = Variable.objects.filter(build=build_id) - - def _get_variable_or_empty(variable_name): - from django.core.exceptions import ObjectDoesNotExist - try: - returnvariables.get(variable_name=variable_name).variable_value
bitbake/lib/toaster/toastergui/views.py +0
-6- except ObjectDoesNotExist: - return '' - - BB_VERSION=_get_variable_or_empty(variable_name='BB_VERSION') - BUILD_SYS=_get_variable_or_empty(variable_name='BUILD_SYS') -NATIVELSBSTRING=_get_variable_or_empty(variable_name='NATIVELSBSTRING')
bitbake/lib/toaster/toastergui/views.py +1
-25- TARGET_SYS=_get_variable_or_empty(variable_name='TARGET_SYS') - MACHINE=_get_variable_or_empty(variable_name='MACHINE') - DISTRO=_get_variable_or_empty(variable_name='DISTRO') - DISTRO_VERSION=_get_variable_or_empty(variable_name='DISTRO_VERSION') - TUNE_FEATURES=_get_variable_or_empty(variable_name='TUNE_FEATURES') - TARGET_FPU=_get_variable_or_empty(variable_name='TARGET_FPU') - - targets = Target.objects.filter(build=build_id) - - context = { - 'objectname': 'configuration', - 'object_search_display':'variables', - 'filter_search_display':'variables', - 'build': Build.objects.get(pk=build_id), - 'BB_VERSION':BB_VERSION, - 'BUILD_SYS':BUILD_SYS, - 'NATIVELSBSTRING':NATIVELSBSTRING, - 'TARGET_SYS':TARGET_SYS, - 'MACHINE':MACHINE, - 'DISTRO':DISTRO, - 'DISTRO_VERSION':DISTRO_VERSION, - 'TUNE_FEATURES':TUNE_FEATURES, - 'TARGET_FPU':TARGET_FPU, - 'targets':targets, - } + var_names = ('BB_VERSION', 'BUILD_SYS', 'NATIVELSBSTRING','
TARGET_SYS',
+ 'MACHINE', 'DISTRO', 'DISTRO_VERSION', 'TUNE_FEATURES',
'TARGET_FPU')
+ context = dict(Variable.objects.filter(build=build_id,
variable_name__in=var_names)\
+ .values_list('variable_name',
'variable_value'))bitbake/lib/toaster/toastergui/views.py +5
-1+ context.update({'objectname': 'configuration', + 'object_search_display':'variables', + 'filter_search_display':'variables', + 'build': Build.objects.get(pk=build_id), + 'targets': Target.objects.filter(build=build_id)}) return render(request, template, context) --2.1.4
--
_______________________________________________
toaster mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/toaster
Signature · 3 lines
Alex Damian Yocto Project SSG / OTC