fair-queue.js 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. import DS from 'ember-data';
  19. export default DS.Model.extend({
  20. name: DS.attr('string'),
  21. children: DS.attr('array'),
  22. parent: DS.attr('string'),
  23. maxApps: DS.attr('number'),
  24. minResources: DS.attr(),
  25. maxResources: DS.attr(),
  26. usedResources: DS.attr(),
  27. demandResources: DS.attr(),
  28. steadyFairResources: DS.attr(),
  29. fairResources: DS.attr(),
  30. clusterResources: DS.attr(),
  31. pendingContainers: DS.attr('number'),
  32. allocatedContainers: DS.attr('number'),
  33. reservedContainers: DS.attr('number'),
  34. schedulingPolicy: DS.attr('string'),
  35. preemptable: DS.attr('number'),
  36. numPendingApplications: DS.attr('number'),
  37. numActiveApplications: DS.attr('number'),
  38. type: DS.attr('string'),
  39. isLeafQueue: function() {
  40. var len = this.get("children.length");
  41. if (!len) {
  42. return true;
  43. }
  44. return len <= 0;
  45. }.property("children"),
  46. capacitiesBarChartData: function() {
  47. return [
  48. {
  49. label: "Steady Fair Memory",
  50. value: this.get("steadyFairResources.memory")
  51. },
  52. {
  53. label: "Used Memory",
  54. value: this.get("usedResources.memory")
  55. },
  56. {
  57. label: "Maximum Memory",
  58. value: this.get("maxResources.memory")
  59. }
  60. ];
  61. }.property("maxResources.memory", "usedResources.memory", "maxResources.memory"),
  62. numOfApplicationsDonutChartData: function() {
  63. return [
  64. {
  65. label: "Pending Apps",
  66. value: this.get("numPendingApplications") || 0 // TODO, fix the REST API so root will return #applications as well.
  67. },
  68. {
  69. label: "Active Apps",
  70. value: this.get("numActiveApplications") || 0
  71. }
  72. ];
  73. }.property()
  74. });