tez_dag.js 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with this
  4. * work for additional information regarding copyright ownership. The ASF
  5. * licenses this file to you under the Apache License, Version 2.0 (the
  6. * "License"); you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. * License for the specific language governing permissions and limitations under
  15. * the License.
  16. */
  17. var App = require('app');
  18. var dateUtils = require('utils/date');
  19. var numberUtils = require('utils/number_utils');
  20. App.TezDag = DS.Model.extend({
  21. id : DS.attr('string'),
  22. /**
  23. * When DAG is actually running on server, a unique ID is assigned.
  24. */
  25. instanceId : DS.attr('string'),
  26. name : DS.attr('string'),
  27. yarnApplicationId: DS.attr('string'),
  28. stage : DS.attr('string'),
  29. vertices : DS.hasMany('App.TezDagVertex'),
  30. edges : DS.hasMany('App.TezDagEdge')
  31. });
  32. App.TezDagEdge = DS.Model.extend({
  33. id : DS.attr('string'),
  34. instanceId : DS.attr('string'),
  35. fromVertex : DS.belongsTo('App.TezDagVertex'),
  36. toVertex : DS.belongsTo('App.TezDagVertex'),
  37. /**
  38. * Type of this edge connecting vertices. Should be one of constants defined
  39. * in 'App.TezDagEdgeType'.
  40. */
  41. edgeType : DS.attr('string')
  42. });
  43. App.TezDagVertex = DS.Model.extend({
  44. id : DS.attr('string'),
  45. /**
  46. * When DAG vertex is actually running on server, a unique ID is assigned.
  47. */
  48. instanceId : DS.attr('string'),
  49. name : DS.attr('string'),
  50. /**
  51. * State of this vertex. Should be one of constants defined in
  52. * App.TezDagVertexState.
  53. */
  54. state : DS.attr('string'),
  55. /**
  56. * Vertex type has to be one of the types defined in 'App.TezDagVertexType'
  57. * @return {string}
  58. */
  59. type : DS.attr('string'),
  60. /**
  61. * A vertex can have multiple incoming edges.
  62. */
  63. incomingEdges : DS.hasMany('App.TezDagEdge'),
  64. /**
  65. * This vertex can have multiple outgoing edges.
  66. */
  67. outgoingEdges : DS.hasMany('App.TezDagEdge'),
  68. startTime : DS.attr('number'),
  69. endTime : DS.attr('number'),
  70. /**
  71. * Provides the duration of this job. If the job has not started, duration
  72. * will be given as 0. If the job has not ended, duration will be till now.
  73. *
  74. * @return {Number} Duration in milliseconds.
  75. */
  76. duration : function() {
  77. return dateUtils.duration(this.get('startTime'), this.get('endTime'))
  78. }.property('startTime', 'endTime'),
  79. /**
  80. * Each Tez vertex can perform arbitrary application specific computations
  81. * inside. The application can provide a list of operations it has provided in
  82. * this vertex.
  83. *
  84. * Array of strings. [{string}]
  85. */
  86. operations : DS.attr('array'),
  87. /**
  88. * Provides additional information about the 'operations' performed in this
  89. * vertex. This is shown directly to the user.
  90. */
  91. operationPlan : DS.attr('string'),
  92. /**
  93. * Number of actual Map/Reduce tasks in this vertex
  94. */
  95. tasksCount : DS.attr('number'),
  96. tasksNumber: function () {
  97. return this.get('tasksCount') ? this.get('tasksCount') : 0;
  98. }.property('tasksCount'),
  99. /**
  100. * Local filesystem usage metrics for this vertex
  101. */
  102. fileReadBytes : DS.attr('number'),
  103. fileWriteBytes : DS.attr('number'),
  104. fileReadOps : DS.attr('number'),
  105. fileWriteOps : DS.attr('number'),
  106. /**
  107. * Spilled records
  108. */
  109. spilledRecords : DS.attr('number'),
  110. /**
  111. * HDFS usage metrics for this vertex
  112. */
  113. hdfsReadBytes : DS.attr('number'),
  114. hdfsWriteBytes : DS.attr('number'),
  115. hdfsReadOps : DS.attr('number'),
  116. hdfsWriteOps : DS.attr('number'),
  117. /**
  118. * Record metrics for this vertex
  119. */
  120. recordReadCount : DS.attr('number'),
  121. recordWriteCount : DS.attr('number'),
  122. totalReadBytes : function() {
  123. return this.get('fileReadBytes') + this.get('hdfsReadBytes');
  124. }.property('fileReadBytes', 'hdfsReadBytes'),
  125. totalWriteBytes : function() {
  126. return this.get('fileWriteBytes') + this.get('hdfsWriteBytes');
  127. }.property('fileWriteBytes', 'hdfsWriteBytes'),
  128. totalReadBytesDisplay : function() {
  129. return numberUtils.bytesToSize(this.get('totalReadBytes'));
  130. }.property('totalReadBytes'),
  131. totalWriteBytesDisplay : function() {
  132. return numberUtils.bytesToSize(this.get('totalWriteBytes'));
  133. }.property('totalWriteBytes'),
  134. durationDisplay : function() {
  135. return dateUtils.timingFormat(this.get('duration'), true);
  136. }.property('duration')
  137. });
  138. App.TezDagVertexState = {
  139. NEW : "NEW",
  140. INITIALIZING : "INITIALIZING",
  141. INITED : "INITED",
  142. RUNNING : "RUNNING",
  143. SUCCEEDED : "SUCCEEDED",
  144. FAILED : "FAILED",
  145. KILLED : "KILLED",
  146. ERROR : "ERROR",
  147. TERMINATING : "TERMINATING",
  148. JOBFAILED: "JOB FAILED"
  149. };
  150. App.TezDagVertexType = {
  151. MAP: 'MAP',
  152. REDUCE: 'REDUCE',
  153. UNION: 'UNION'
  154. };
  155. App.TezDagEdgeType = {
  156. SCATTER_GATHER : "SCATTER_GATHER",
  157. BROADCAST : "BROADCAST",
  158. CONTAINS: "CONTAINS"
  159. };
  160. App.TezDag.FIXTURES = [];
  161. App.TezDagEdge.FIXTURES = [];
  162. App.TezDagVertex.FIXTURES = [];