Merge lp://staging/~qzhang/lava-scheduler/device-type-page into lp://staging/lava-scheduler

Proposed by Spring Zhang
Status: Merged
Merged at revision: 173
Proposed branch: lp://staging/~qzhang/lava-scheduler/device-type-page
Merge into: lp://staging/lava-scheduler
Diff against target: 256 lines (+159/-3) (has conflicts)
5 files modified
lava_scheduler_app/models.py (+4/-0)
lava_scheduler_app/templates/lava_scheduler_app/device_type.html (+16/-0)
lava_scheduler_app/templates/lava_scheduler_app/index.html (+7/-0)
lava_scheduler_app/urls.py (+19/-2)
lava_scheduler_app/views.py (+113/-1)
Text conflict in lava_scheduler_app/urls.py
To merge this branch: bzr merge lp://staging/~qzhang/lava-scheduler/device-type-page
Reviewer Review Type Date Requested Status
Linaro Validation Team Pending
Review via email: mp+106577@code.staging.launchpad.net

Description of the change

Construct device type page

To post a comment you must log in.
Revision history for this message
Spring Zhang (qzhang) wrote :

Still in development of one part.

180. By Spring Zhang

merge with mainline

Revision history for this message
Andy Doan (doanac) wrote :

progressing nicely, a one comment

For the Device Type Overview. Rather than saying "X running", you might change the wording to "X busy". I think "running" might be confusing to people

I think the other stuff I'm noticing is just todo's in the code. keep up the good work

Revision history for this message
Spring Zhang (qzhang) wrote :

216 +class HealthJobSummaryTable(DataTablesTable):
217 +
218 + # Make use of Tag model to return 1 day, 1 week, 1 month offset
219 + # Please ensure there's 3 or more Tag named with prefix 'time_offset':
220 + # time_offset-24 stands for -24 hours
221 + # time_offset-168 stands for -24*7 hours
222 + # time_offset-5040 stands for -24*7*30 hours

Here I make use of Tag when constructing health job summary table, it needs to create 3 tags in admin page: time_offset-24, time_offset-168, time_offset-5040, for returning a QuerySets in get_queryset() is right, I don't know if it's best solution, but keep it as a temp one. Another side it brings another flexibility, more tags can be created for different times.

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Oh WOW the contortions around using the Tag model seem pretty horrible... I've proposed a change to lava-server (https://code.launchpad.net/~mwhudson/lava-server/data-backed-tables/+merge/106735) to make this easier (once the above branch is merged and released, this sort of change http://bazaar.launchpad.net/~mwhudson/lava-scheduler/device-type-page/revision/181/lava_scheduler_app/views.py can be made to this branch).

In other ways, it mostly looks fine. Some visual polish is required.

One thing is that your code makes many queries for each row of the device_type table. It's easy enough to write sql that gets all the data you need in one query, something like:

  select device_type_id,
         sum((status=1)::int) as online,
         sum((status in (0, 3))::int) as offline,
         sum((status=2)::int) as busy
    from lava_scheduler_app_device
group by device_type_id;

works, but to get django to do it is much harder. I spent way too long on this and came up with http://bazaar.launchpad.net/~mwhudson/lava-scheduler/device-type-page/revision/182/lava_scheduler_app/views.py

I hope these comments help!

181. By Spring Zhang

rename running to busy in Device Table Overview

182. By Spring Zhang

Add devices table in device_type page

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches