Bug 7334

Summary: The 'machine' information is not searchable in the all builds, all projects and project builds tables
Product: [Build System, Metadata & Runtime] Toaster Reporter: Belen Barros Pena <belen.barros.pena>
Component: toasterAssignee: David Reyna <david.reyna>
Status: VERIFIED WONTFIX QA Contact: Bogdan Alexandru Voiculescu <bogdanx.a.voiculescu>
Severity: normal    
Priority: Medium CC: alexandru.damian, belen.barros.pena, bluelightning, bogdanx.a.voiculescu, cristiana.voicu, david.reyna, jessica.zhang
Version: unspecified   
Target Milestone: 2.1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Bug Depends on: 8738    
Bug Blocks:    

Description Belen Barros Pena 2015-02-19 11:18:21 UTC
This was working before, I am pretty sure. But something must have changed and I can no longer search the all builds or the all projects tables by machine names.
Comment 1 Belen Barros Pena 2015-02-19 11:22:46 UTC
Also, the project name is not sercah
Comment 2 Belen Barros Pena 2015-02-19 11:23:06 UTC
(In reply to comment #1)
> Also, the project name is not sercah

(In reply to comment #1)
> Also, the project name is not sercah

searchable
Comment 3 David Reyna 2015-03-18 03:20:48 UTC
Add "build__machine" to "bldcontrol/models.py":

    search_allowed_fields = ("brtarget__target", "build__project__name", "build__machine")

The search on project names was already fixed earlier with #6682.
Comment 4 Belen Barros Pena 2015-03-26 10:55:05 UTC
The search only happens for builds, not for failed build requests. Since Toaster does not differentiate between builds and build requests (the difference is an implementation detail of no interest to users), the search looks like broken.
Comment 5 David Reyna 2015-03-30 20:48:31 UTC
> "The search only happens for builds, not for failed build requests"

This search is not achievable with the current Toaster design, as we have discovered with other synthetic values.

The "machine" value for failed builds is made available to the view by special code that looks up and inserts these into the context's objects with temporary members, but this is done _after_ the search filter is applied and is therefor not searchable. Nor can this addition be done before the search filter because that filter has the side effect of removing inserted members.

The possible solutions for the future are:

  (a) allow searches on locally inserted members - the current filter removes all added members

  (b) allow searches on object routines (in this case "BuildRequest.get_machine()") - the current filter only operates with physical object members.

I have therefor moved this case back to "Resolved".
Comment 6 Belen Barros Pena 2015-03-31 13:46:28 UTC
(In reply to comment #5)
> > "The search only happens for builds, not for failed build requests"
> 
> This search is not achievable with the current Toaster design, as we have
> discovered with other synthetic values.

Well, this is quite bad: from the user's perspective, it looks like the search is broken, and makes Toaster look unreliable. I'd rather revert the fix, to be honest, back to the machine not being searchable. At least that way search does not return what looks like incorrect results.

> 
> The "machine" value for failed builds is made available to the view by
> special code that looks up and inserts these into the context's objects with
> temporary members, but this is done _after_ the search filter is applied and
> is therefor not searchable. Nor can this addition be done before the search
> filter because that filter has the side effect of removing inserted members.
> 
> The possible solutions for the future are:
> 
>   (a) allow searches on locally inserted members - the current filter
> removes all added members
> 
>   (b) allow searches on object routines (in this case
> "BuildRequest.get_machine()") - the current filter only operates with
> physical object members.
> 
> I have therefor moved this case back to "Resolved".

This is not resolved. We can not leave this as is: reopening and moving to 1.9. This bug should go into the list of known issues published with the release notes.
Comment 7 Alexandru Damian 2015-03-31 14:00:20 UTC
Per chat with Belen, I am reverting the patch since incomplete functionality is worse than no functionality.
Comment 8 Belen Barros Pena 2015-04-10 11:10:46 UTC
*** Bug 7498 has been marked as a duplicate of this bug. ***
Comment 9 David Reyna 2015-06-03 08:03:06 UTC
The solution will also solve 7154.
Comment 10 Alexandru Damian 2015-06-12 13:40:30 UTC
Alex D needs a chat with David about this bug - since the builds table contents changed showing from BuildRequests to Builds, the machine field is now searchable again.
Comment 11 Stephen K Jolley 2015-11-18 16:44:23 UTC
This has been REOPENED
Comment 12 Belen Barros Pena 2015-12-22 13:45:48 UTC
As has been mentioned, Django does not support sorting calculated or derived fields out of the box. Implementing this sorting seems then a bit too much work for not that much return. So setting a 'won't fix'.
Comment 13 Bogdan Alexandru Voiculescu 2016-01-06 10:07:27 UTC
Verified per above comment.