chenyulin0719 commented on code in PR #146:
URL: https://github.com/apache/yunikorn-web/pull/146#discussion_r1421393132
##########
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:
When making this change, I noticed that if the resource is undefined, the
result will be empty. Even though this might not happen in the real world, I
prefer to keep the original behavior.
Screenshot with json-server data.
<img width="336" alt="image"
src="https://github.com/apache/yunikorn-web/assets/26764036/f572851b-f0d1-4001-bb17-4d7aaf7165aa">
I refactored the code and added test cases/comments to make this function
more readable. I hope this is helpful.
Additionally, I include a sorting function before foreach loop, which
guarantees the order of Memory/Cpu/ephemeral-storage. Please let me know if
it's not necessarily.
--
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]