[llvm-commits] [LNT] r161833 - /lnt/trunk/lnt/server/ui/views.py

Daniel Dunbar daniel at zuster.org
Thu Aug 16 10:24:49 PDT 2012


Hey,

On Mon, Aug 13, 2012 at 9:20 PM, Michael Gottesman <mgottesman at apple.com> wrote:
> Author: mgottesman
> Date: Mon Aug 13 23:20:41 2012
> New Revision: 161833
>
> URL: http://llvm.org/viewvc/llvm-project?rev=161833&view=rev
> Log:
> [LNT] v4_global_status: Added code to handle field/revision arguments.
>
> A field argument is either 2 or 3. 2 is for compile time and 3 is for
> execution time.

This is wrong, that is only true for one particular test suite. The
compile time test suite is an example of something which will be
completely wrong currently.

> Revision is just an int as well.
>
> Modified:
>     lnt/trunk/lnt/server/ui/views.py
>
> Modified: lnt/trunk/lnt/server/ui/views.py
> URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=161833&r1=161832&r2=161833&view=diff
> ==============================================================================
> --- lnt/trunk/lnt/server/ui/views.py (original)
> +++ lnt/trunk/lnt/server/ui/views.py Mon Aug 13 23:20:41 2012
> @@ -645,12 +645,15 @@
>
>      # Create a datetime for the day before the most recent run.
>      yesterday = latest_date - datetime.timedelta(days=1)
> -
> -    # Get the revision number for the default baseline and look up
> -    # the fields we are interested in.
> -    revision = ts.Machine.DEFAULT_BASELINE_REVISION
> -    field = ts.Sample.get_primary_fields().next()
> -
> +
> +    # Get arguments.
> +    revision = int(request.args.get('revision',
> +                                    ts.Machine.DEFAULT_BASELINE_REVISION))
> +    field = int(request.args.get('field', 2)) # 2 is for compile time
> +    # FIXME: This maybe could be done in itertools or we could maybe
> +    # return an actual list that is populated lazily.
> +    field = [x for x in ts.Sample.get_primary_fields()][field-2]

It probably makes sense for the field to just be the sample field
index (and give an error on non-primary fields). This can be written
more cleanly (and correctly) as:
--
  field_index = request.args.get('field')
  if field_index is not None:
    field = ts.Sample.fields[int(field_index)]
    if field.status_field is not None:
       abort(500) # Not allow to view status fields.
 else:
    field = ts.Sample.get_primary_fields().next()
--

 - Daniel

> +
>      # Get the list of all runs we might be interested in.
>      recent_runs = ts.query(ts.Run).filter(ts.Run.start_time > yesterday).all()
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list