wilfred-s commented on code in PR #146:
URL: https://github.com/apache/yunikorn-web/pull/146#discussion_r1419776145
##########
src/app/services/scheduler/scheduler.service.ts:
##########
@@ -328,13 +328,13 @@ export class SchedulerService {
const formatted = [];
if (resource && resource.memory !== undefined) {
- formatted.push(`Memory: ${CommonUtil.formatBytes(resource.memory)}`);
+ formatted.push(`Memory:
${CommonUtil.formatMemoryBytes(resource.memory)}`);
} else {
formatted.push(`Memory: ${NOT_AVAILABLE}`);
}
if (resource && resource.vcore !== undefined) {
- formatted.push(`CPU: ${CommonUtil.formatCount(resource.vcore)}`);
+ formatted.push(`CPU: ${CommonUtil.formatCpuCore(resource.vcore)}`);
Review Comment:
I am not a huge java script programmer but there is a for loop just below to
process all the resources. Can we not do all resources in that loop instead of
having memory and cpu sit outside?
I think this was done to always have memory and cpu at location 0 and 1 in
the array. For memory that would be a simple change to `unshift` from `push`
when inside the loop For cpu it would be something like this:
```
const memTemp
if formatted.at(0) == "memory"{
memTemp = formatted.pop()
}
format the cpu thing....
if memTemp != ""{
formatted.unshift(memTemp)
}
```
##########
src/app/services/scheduler/scheduler.service.ts:
##########
@@ -350,7 +350,7 @@ export class SchedulerService {
if (resource[`ephemeral-storage`] == 0) {
formatted.push(`ephemeral-storage: ${NOT_AVAILABLE}`);
}else{
- formatted.push(`ephemeral-storage:
${CommonUtil.formatBytes(resource[key])}`);
+ formatted.push(`ephemeral-storage:
${CommonUtil.formatEphemeralStorageBytes(resource[key])}`);
Review Comment:
All `hugepages-*` resources fall into a special category also. They are
memory sizes and should be displayed as such.
Can use the multiple case value support javascript has here if we use
`formatted.push(`${key}: ...`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]