[LNT] r264722 - [search] default_machine should be an ID, not a textual name

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 5 08:33:14 PDT 2016


Hi Chris,

Good catch, thanks! I hadn’t considered that. I’ll take a ponder and update the algorithm tomorrow.

Cheers,

James
> On 5 Apr 2016, at 16:30, Chris Matthews <chris.matthews at apple.com> wrote:
>
> When a machine is updated to a new OS version, LNT makes a new machine with the same name and a new ID, this is pretty common especially on OSX as we like to do these point releases.  In this case you would just use the old ID.  Maybe the machine with a matching text name and the largest ID is more intuitive?
>
>> On Mar 29, 2016, at 5:11 AM, James Molloy via llvm-commits <llvm-commits at lists.llvm.org> wrote:
>>
>> Author: jamesm
>> Date: Tue Mar 29 07:11:19 2016
>> New Revision: 264722
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=264722&view=rev
>> Log:
>> [search] default_machine should be an ID, not a textual name
>>
>> Modified:
>>   lnt/trunk/lnt/server/db/search.py
>>   lnt/trunk/tests/server/db/search.py
>>
>> Modified: lnt/trunk/lnt/server/db/search.py
>> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/search.py?rev=264722&r1=264721&r2=264722&view=diff
>> ==============================================================================
>> --- lnt/trunk/lnt/server/db/search.py (original)
>> +++ lnt/trunk/lnt/server/db/search.py Tue Mar 29 07:11:19 2016
>> @@ -27,10 +27,7 @@ def _naive_search_for_run(ts, query, num
>>        else:
>>            machine_queries.append(q)
>>
>> -    # If we didn't have any machines queries but we do have a default, query that.
>> -    if not machine_queries and default_machine:
>> -        machine_queries = [default_machine]
>> -    elif not machine_queries:
>> +    if not machine_queries and not default_machine:
>>        # No machines to query: no matches. We can't query all machines, we'd end up
>>        # doing a full table scan and that is not scalable.
>>        return []
>> @@ -39,9 +36,13 @@ def _naive_search_for_run(ts, query, num
>>        order_queries.append(default_order)
>>
>>    machines = []
>> -    for m in ts.query(ts.Machine).all():
>> -        if all(q in m.name for q in machine_queries):
>> -            machines.append(m.id)
>> +    if not machine_queries:
>> +        machines = [default_machine]
>> +    else:
>> +        for m in ts.query(ts.Machine).all():
>> +            if all(q in m.name for q in machine_queries):
>> +                machines.append(m.id)
>> +
>>    if not machines:
>>        return []
>>
>> @@ -66,4 +67,4 @@ def search(ts, query,
>>    """
>>
>>    return _naive_search_for_run(ts, query,
>> -    num_results, default_machine, default_order)
>> +                                 num_results, default_machine, default_order)
>>
>> Modified: lnt/trunk/tests/server/db/search.py
>> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/tests/server/db/search.py?rev=264722&r1=264721&r2=264722&view=diff
>> ==============================================================================
>> --- lnt/trunk/tests/server/db/search.py (original)
>> +++ lnt/trunk/tests/server/db/search.py Tue Mar 29 07:11:19 2016
>> @@ -93,7 +93,7 @@ class SearchTest(unittest.TestCase):
>>    def test_default_machine(self):
>>        ts = self.db.testsuite.get('nts')
>>
>> -        results = self._mangleResults(search(ts, '65', default_machine='machine2'))
>> +        results = self._mangleResults(search(ts, '65', default_machine=3))
>>        self.assertEqual(results, [
>>            ('machine2', '6512')
>>        ])
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>

IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.



More information about the llvm-commits mailing list