> On June 23, 2017, 4:06 p.m., haosdent huang wrote:
> > src/webui/master/static/agent.html
> > Lines 184 (patched)
> > <https://reviews.apache.org/r/60370/diff/1/?file=1758433#file1758433line184>
> >
> > Is `|| 0` necessary here?
>
> Andrei Budnik wrote:
> I think yes, because we might miss information about a specific role in
> state.reserved_resources_allocated. E.g., we have both statically reserved
> resources for both "ads" and "dyn" roles, but only one role is actually
> allocated. Let's assume that resources from "dyn" role are used to launch
> some task, while "ads" role isn't used, hence no item for "ads" in
> state.reserved_resources_allocated exists. In the latter case 0 is used as a
> default value.
>
> haosdent huang wrote:
> Hmm, but
>
> ```
> state.unreserved_resources_allocated.cpus | number
> ```
>
> above would show `/0` as well.
>
> Should we keep consistency since almost part use this pattern
>
> ```
>
> <td>{{monitor.frameworks[framework.id].statistics.cpus_total_usage | number}}
> / {{framework.cpus | number}}</td>
> ```
`unreserved_resources_allocated` is always defined.
If I change this:
```html
<td>{{reservation.role}}</td>
<td>{{(state.reserved_resources_allocated[reservation.role].cpus |
number) || 0}} / {{reservation.cpus | number}}</td>
<td>{{(state.reserved_resources_allocated[reservation.role].gpus |
number) || 0}} / {{reservation.gpus | number}}</td>
<td>{{(state.reserved_resources_allocated[reservation.role].mem *
(1024 * 1024) | dataSize) || 0}} / {{reservation.mem * (1024 * 1024) |
dataSize}}</td>
<td>{{(state.reserved_resources_allocated[reservation.role].disk *
(1024 * 1024) | dataSize) || 0}} / {{reservation.disk * (1024 * 1024) |
dataSize}}</td>
```
to that:
```html
<td>{{reservation.role}}</td>
<td>{{state.reserved_resources_allocated[reservation.role].cpus |
number}} / {{reservation.cpus | number}}</td>
<td>{{state.reserved_resources_allocated[reservation.role].gpus |
number}} / {{reservation.gpus | number}}</td>
<td>{{state.reserved_resources_allocated[reservation.role].mem *
(1024 * 1024) | dataSize}} / {{reservation.mem * (1024 * 1024) | dataSize}}</td>
<td>{{state.reserved_resources_allocated[reservation.role].disk *
(1024 * 1024) | dataSize}} / {{reservation.disk * (1024 * 1024) |
dataSize}}</td>
```
Then it will look like in the
[picture](https://reviews.apache.org/r/60370/file/1507/).
- Andrei
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/60370/#review178801
-----------------------------------------------------------
On June 28, 2017, 12:29 p.m., Andrei Budnik wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/60370/
> -----------------------------------------------------------
>
> (Updated June 28, 2017, 12:29 p.m.)
>
>
> Review request for mesos, Benjamin Mahler and haosdent huang.
>
>
> Bugs: MESOS-6441
> https://issues.apache.org/jira/browse/MESOS-6441
>
>
> Repository: mesos
>
>
> Description
> -------
>
> Updated agent webui page to display allocated resources per each role.
>
>
> Diffs
> -----
>
> src/webui/master/static/agent.html 71e5e702e5e64e6f46c84791247aa5156c046ed9
> src/webui/master/static/js/controllers.js
> 67bfd030649dd21840c16188a4964f814aa232d7
>
>
> Diff: https://reviews.apache.org/r/60370/diff/2/
>
>
> Testing
> -------
>
> See screenshot.
>
>
> File Attachments
> ----------------
>
> agent.html
>
> https://reviews.apache.org/media/uploaded/files/2017/06/22/66cc61b4-04c8-451e-a434-58f556397724__Resource_Reservations.png
> ui_bug
>
> https://reviews.apache.org/media/uploaded/files/2017/06/28/1b7755e3-0b11-46ab-9ae4-71f19bce0cd6__ui_bug.png
>
>
> Thanks,
>
> Andrei Budnik
>
>