Bug 8011 - Sorting columns breaks Toaster
Summary: Sorting columns breaks Toaster
Status: VERIFIED DUPLICATE of bug 8131
Alias: None
Product: Toaster
Classification: Build System, Metadata & Runtime
Component: toaster (show other bugs)
Version: 1.9
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.0
Assignee: Michael Wood
QA Contact: Mihail Stanciu
URL:
Whiteboard:
: 8228 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-07-15 11:48 UTC by Mihail Stanciu
Modified: 2015-09-29 10:57 UTC (History)
6 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: Regression (Used to work)
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mihail Stanciu 2015-07-15 11:48:57 UTC
Tested on 1.9 M1 RC2: f9ea480e6c26fea46c3011c4e9d0e2de3d5c81b4

In the "All Builds" table sorting by "Errors", "Warnings" or "Time" causes Toaster to throw an exception:

BaseException at /toastergui/builds/

Invalid ordering model:<class 'orm.models.Build'>(u'timespent', ['bitbake_version', 'build_name', 'buildartifact', 'buildrequest', 'completed_on', 'cooker_log_path', 'distro', 'distro_version', 'helptext_build', u'id', 'layer_version_build', 'logmessage', 'machine', 'outcome', 'package', 'project', 'started_on', 'target', 'task_build', 'variable_build'])

Request Method: 	GET
Request URL: 	http://localhost:8000/toastergui/builds/?orderby=timespent%3A-&count=10&search=&page=1
Django Version: 	1.6.6
Exception Type: 	BaseException
Exception Value: 	

Invalid ordering model:<class 'orm.models.Build'>(u'timespent', ['bitbake_version', 'build_name', 'buildartifact', 'buildrequest', 'completed_on', 'cooker_log_path', 'distro', 'distro_version', 'helptext_build', u'id', 'layer_version_build', 'logmessage', 'machine', 'outcome', 'package', 'project', 'started_on', 'target', 'task_build', 'variable_build'])

Exception Location: 	/home/gushie/poky/bitbake/lib/toaster/toastergui/views.py in _search_tuple, line 329
Python Executable: 	/usr/bin/python
Python Version: 	2.7.8
Python Path: 	

['bitbake/bin/../lib',
 '/home/gushie/poky/bitbake/lib',
 '/home/gushie/poky/bitbake/lib/toaster',
 '/usr/lib64/python27.zip',
 '/usr/lib64/python2.7',
 '/usr/lib64/python2.7/plat-linux2',
 '/usr/lib64/python2.7/lib-tk',
 '/usr/lib64/python2.7/lib-old',
 '/usr/lib64/python2.7/lib-dynload',
 '/usr/lib64/python2.7/site-packages',
 '/usr/lib64/python2.7/site-packages/gtk-2.0',
 '/usr/lib/python2.7/site-packages',
 '/home/gushie/poky/bitbake/lib/toaster/contrib/django-aggregate-if-master']

Traceback in next comment.
Comment 1 Mihail Stanciu 2015-07-15 11:49:24 UTC
Traceback:
Environment:


Request Method: GET
Request URL: http://localhost:8000/toastergui/builds/?count=10&orderby=timespent%3A-&page=1

Django Version: 1.6.6
Python Version: 2.7.8
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.messages',
 'django.contrib.sessions',
 'django.contrib.admin',
 'django.contrib.staticfiles',
 'django.contrib.humanize',
 'bldcollector',
 'toastermain',
 'south',
 'toastergui',
 'bldcontrol',
 'orm')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware')


Traceback:
File "/usr/lib64/python2.7/site-packages/django/core/handlers/base.py" in get_response
  112.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/gushie/poky/bitbake/lib/toaster/toastergui/views.py" in returned_wrapper
  138.                 context = view(request, *args, **kwargs)
File "/home/gushie/poky/bitbake/lib/toaster/toastergui/views.py" in builds
  1886.             context, pagesize, orderby = _build_list_helper(request, queryset)
File "/home/gushie/poky/bitbake/lib/toaster/toastergui/views.py" in _build_list_helper
  1906.         (filter_string, search_term, ordering_string) = _search_tuple(request, Build)
File "/home/gushie/poky/bitbake/lib/toaster/toastergui/views.py" in _search_tuple
  329.         raise BaseException("Invalid ordering model:" + str(model) + str(invalid))

Exception Type: BaseException at /toastergui/builds/
Exception Value: Invalid ordering model:<class 'orm.models.Build'>(u'timespent', ['bitbake_version', 'build_name', 'buildartifact', 'buildrequest', 'completed_on', 'cooker_log_path', 'distro', 'distro_version', 'helptext_build', u'id', 'layer_version_build', 'logmessage', 'machine', 'outcome', 'package', 'project', 'started_on', 'target', 'task_build', 'variable_build'])
Comment 2 Alexandru Damian 2015-07-27 15:48:33 UTC
This breaks because "timespent" is not a field in the database, but it is calculated on the fly.

There are two ways to go about here:

a). disable sorting by time spent

b). add the field to the database


Belen, we need your input.
Comment 3 Belen Barros Pena 2015-07-28 09:27:38 UTC
(In reply to comment #2)
> This breaks because "timespent" is not a field in the database, but it is
> calculated on the fly.

It looks like this would explain why sorting by 'time' throws an error, but I am not sure it explains why sorting by 'errors' and 'warnings' also throws an error. Although the error seems to be the same error in all cases, so I could be wrong. 

> 
> There are two ways to go about here:
> 
> a). disable sorting by time spent
> 
> b). add the field to the database

I am ok with disabling the sorting by 'time', unless we think that adding the field to the database could improve performance in any way. 

> 
> 
> Belen, we need your input.
Comment 4 Belen Barros Pena 2015-08-19 15:30:54 UTC
*** Bug 8131 has been marked as a duplicate of this bug. ***
Comment 5 Belen Barros Pena 2015-09-01 10:10:22 UTC
*** Bug 8228 has been marked as a duplicate of this bug. ***
Comment 6 Michael Wood 2015-09-28 17:42:03 UTC
Triggers the same problem caused by bug #8131

*** This bug has been marked as a duplicate of bug 8131 ***
Comment 7 Cristina Agurida 2015-09-29 10:57:48 UTC
As per last comment set it as verified duplicate.