tez-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject tez git commit: TEZ-3026. Tez UI 2: Add adapters for RM & AM (sree)
Date Wed, 06 Jan 2016 12:55:48 GMT
Repository: tez
Updated Branches:
  refs/heads/TEZ-2980 b2f0bd50d -> 04dbcb048


TEZ-3026. Tez UI 2: Add adapters for RM & AM (sree)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/04dbcb04
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/04dbcb04
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/04dbcb04

Branch: refs/heads/TEZ-2980
Commit: 04dbcb048b49134c317a71c675e00a91b8c67dbf
Parents: b2f0bd5
Author: Sreenath Somarajapuram <sree@apache.org>
Authored: Wed Jan 6 18:25:29 2016 +0530
Committer: Sreenath Somarajapuram <sree@apache.org>
Committed: Wed Jan 6 18:25:29 2016 +0530

----------------------------------------------------------------------
 TEZ-2980-CHANGES.txt                            |  1 +
 .../src/main/webapp/app/adapters/abstract.js    | 11 +++----
 tez-ui2/src/main/webapp/app/adapters/am.js      | 25 ++++++++++++++++
 tez-ui2/src/main/webapp/app/adapters/rm.js      | 25 ++++++++++++++++
 .../src/main/webapp/app/adapters/timeline.js    |  2 ++
 tez-ui2/src/main/webapp/app/services/env.js     | 24 +++++++--------
 tez-ui2/src/main/webapp/app/services/hosts.js   |  6 ++--
 .../src/main/webapp/config/default-app-conf.js  | 11 +++----
 .../webapp/tests/unit/adapters/abstract-test.js | 28 ++++++++++++++++++
 .../main/webapp/tests/unit/adapters/am-test.js  | 31 ++++++++++++++++++++
 .../main/webapp/tests/unit/adapters/rm-test.js  | 31 ++++++++++++++++++++
 .../main/webapp/tests/unit/services/env-test.js | 29 ++++++++++--------
 12 files changed, 179 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/TEZ-2980-CHANGES.txt
----------------------------------------------------------------------
diff --git a/TEZ-2980-CHANGES.txt b/TEZ-2980-CHANGES.txt
index c8f9d0f..28584a8 100644
--- a/TEZ-2980-CHANGES.txt
+++ b/TEZ-2980-CHANGES.txt
@@ -10,3 +10,4 @@ ALL CHANGES:
   TEZ-3021. Tez UI 2: Add env service & initializer
   TEZ-3023. Tez UI 2: Abstract adapter and route
   TEZ-3022. Tez UI 2: Add serializer & adapter for timeline server
+  TEZ-3026. Tez UI 2: Add adapters for RM & AM

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/app/adapters/abstract.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/adapters/abstract.js b/tez-ui2/src/main/webapp/app/adapters/abstract.js
index b412a46..6cb701b 100644
--- a/tez-ui2/src/main/webapp/app/adapters/abstract.js
+++ b/tez-ui2/src/main/webapp/app/adapters/abstract.js
@@ -28,15 +28,12 @@ export default LoaderAdapter.extend({
     return this.get(`hosts.${serverName}`);
   }),
   namespace: Ember.computed("serverName", function () {
-    var serverName = this.get("serverName"),
-        env = this.get("env");
-    return env.getAppConfig(`namespaces.webService.${serverName}`);
+    var serverName = this.get("serverName");
+    return this.get(`env.app.namespaces.webService.${serverName}`);
   }),
   pathTypeHash: Ember.computed("serverName", function () {
-    var serverName = this.get("serverName"),
-        env = this.get("env");
-
-    return env.getAppConfig(`paths.${serverName}`);
+    var serverName = this.get("serverName");
+    return this.get(`env.app.paths.${serverName}`);
   }),
 
   ajaxOptions: function(url, method, options) {

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/app/adapters/am.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/adapters/am.js b/tez-ui2/src/main/webapp/app/adapters/am.js
new file mode 100644
index 0000000..f80cdd5
--- /dev/null
+++ b/tez-ui2/src/main/webapp/app/adapters/am.js
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  serverName: "am",
+
+  // Any am specific adapter changes must be added here
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/app/adapters/rm.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/adapters/rm.js b/tez-ui2/src/main/webapp/app/adapters/rm.js
new file mode 100644
index 0000000..b87c77d
--- /dev/null
+++ b/tez-ui2/src/main/webapp/app/adapters/rm.js
@@ -0,0 +1,25 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import AbstractAdapter from './abstract';
+
+export default AbstractAdapter.extend({
+  serverName: "rm",
+
+  // Any rm specific adapter changes must be added here
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/app/adapters/timeline.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/adapters/timeline.js b/tez-ui2/src/main/webapp/app/adapters/timeline.js
index aba7e1e..454cbc9 100644
--- a/tez-ui2/src/main/webapp/app/adapters/timeline.js
+++ b/tez-ui2/src/main/webapp/app/adapters/timeline.js
@@ -20,4 +20,6 @@ import AbstractAdapter from './abstract';
 
 export default AbstractAdapter.extend({
   serverName: "timeline",
+
+  // Any timeline specific adapter changes must be added here
 });

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/app/services/env.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/services/env.js b/tez-ui2/src/main/webapp/app/services/env.js
index 397293d..bd7dde7 100644
--- a/tez-ui2/src/main/webapp/app/services/env.js
+++ b/tez-ui2/src/main/webapp/app/services/env.js
@@ -24,32 +24,28 @@ import environment from '../config/environment';
 var MoreObject = more.Object;
 
 export default Ember.Service.extend({
-  _configs: null,
+  ENV: null,
 
   init: function () {
     this.collateConfigs();
   },
 
   collateConfigs: function () {
-    var configs = {},
+    var collatedENV = {
+          APP: {}
+        },
         ENV = window.ENV;
 
-    MoreObject.merge(configs, environment);
+    MoreObject.merge(collatedENV, environment);
 
     if(ENV) {
-      MoreObject.merge(configs.APP, ENV);
+      MoreObject.merge(collatedENV.APP, ENV);
     }
 
-    this.set("_configs", configs);
+    this.set("ENV", collatedENV);
   },
 
-  getConfig: function (path) {
-    var configs = this.get("_configs");
-    return Ember.get(configs, path);
-  },
-
-  getAppConfig: function (path) {
-    var configs = this.get("_configs.APP");
-    return Ember.get(configs, path);
-  }
+  app: Ember.computed("ENV.APP", function () {
+    return this.get("ENV.APP");
+  })
 });

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/app/services/hosts.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/app/services/hosts.js b/tez-ui2/src/main/webapp/app/services/hosts.js
index 07de04d..a3dc1f3 100644
--- a/tez-ui2/src/main/webapp/app/services/hosts.js
+++ b/tez-ui2/src/main/webapp/app/services/hosts.js
@@ -56,13 +56,11 @@ export default Ember.Service.extend({
   },
 
   timeline: Ember.computed(function () {
-    var env = this.get("env");
-    return this.normalizeURL(env.getAppConfig("hosts.timeline"));
+    return this.normalizeURL(this.get("env.app.hosts.timeline"));
   }),
 
   rm: Ember.computed(function () {
-    var env = this.get("env");
-    return this.normalizeURL(env.getAppConfig("hosts.rm"));
+    return this.normalizeURL(this.get("env.app.hosts.rm"));
   }),
 
 });

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/config/default-app-conf.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/config/default-app-conf.js b/tez-ui2/src/main/webapp/config/default-app-conf.js
index 51a2e81..31a946f 100644
--- a/tez-ui2/src/main/webapp/config/default-app-conf.js
+++ b/tez-ui2/src/main/webapp/config/default-app-conf.js
@@ -24,15 +24,12 @@ module.exports = { // Tez App configurations
   namespaces: {
     webService: {
       timeline: 'ws/v1/timeline',
-      history: 'ws/v1/applicationhistory',
-      am: {
-        v1: 'proxy/__app_id__/ws/v1/tez',
-        v2: 'proxy/__app_id__/ws/v2/tez',
-      },
-      cluster: 'ws/v1/cluster',
+      appHistory: 'ws/v1/applicationhistory',
+      rm: 'ws/v1/cluster',
+      am: 'proxy/{app_id}/ws/v{version}/tez',
     },
     web: {
-      cluster: 'cluster'
+      rm: 'cluster'
     },
   },
   paths: {

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/tests/unit/adapters/abstract-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/abstract-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/abstract-test.js
index bc00679..5ff39e7 100644
--- a/tez-ui2/src/main/webapp/tests/unit/adapters/abstract-test.js
+++ b/tez-ui2/src/main/webapp/tests/unit/adapters/abstract-test.js
@@ -37,6 +37,34 @@ test('Basic creation test', function(assert) {
   assert.ok(adapter.pathForType);
 });
 
+test('host, namespace & pathTypeHash test', function(assert) {
+  let adapter = this.subject(),
+      testServerName = "sn",
+      testHosts = {
+        sn: "foo.bar",
+      },
+      testENV = {
+        app: {
+          namespaces: {
+            webService: {
+              sn: "ws"
+            }
+          },
+          paths: {
+            sn: "path"
+          }
+        }
+      };
+
+  adapter.hosts = testHosts;
+  adapter.env = testENV;
+  adapter.set("serverName", testServerName);
+
+  assert.equal(adapter.get("host"), testHosts.sn);
+  assert.equal(adapter.get("namespace"), testENV.app.namespaces.webService.sn);
+  assert.equal(adapter.get("pathTypeHash"), testENV.app.paths.sn);
+});
+
 test('ajaxOptions test', function(assert) {
   let adapter = this.subject(),
       testUrl = "foo.bar",

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/tests/unit/adapters/am-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/am-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/am-test.js
new file mode 100644
index 0000000..a452467
--- /dev/null
+++ b/tez-ui2/src/main/webapp/tests/unit/adapters/am-test.js
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:am', 'Unit | Adapter | am', {
+  // Specify the other units that are required for this test.
+  // needs: ['serializer:foo']
+});
+
+test('Basic creation test', function(assert) {
+  let adapter = this.subject();
+
+  assert.ok(adapter);
+  assert.equal(adapter.serverName, "am");
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/tests/unit/adapters/rm-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/adapters/rm-test.js b/tez-ui2/src/main/webapp/tests/unit/adapters/rm-test.js
new file mode 100644
index 0000000..0b0445e
--- /dev/null
+++ b/tez-ui2/src/main/webapp/tests/unit/adapters/rm-test.js
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { moduleFor, test } from 'ember-qunit';
+
+moduleFor('adapter:rm', 'Unit | Adapter | rm', {
+  // Specify the other units that are required for this test.
+  // needs: ['serializer:foo']
+});
+
+test('Basic creation test', function(assert) {
+  let adapter = this.subject();
+
+  assert.ok(adapter);
+  assert.equal(adapter.serverName, "rm");
+});

http://git-wip-us.apache.org/repos/asf/tez/blob/04dbcb04/tez-ui2/src/main/webapp/tests/unit/services/env-test.js
----------------------------------------------------------------------
diff --git a/tez-ui2/src/main/webapp/tests/unit/services/env-test.js b/tez-ui2/src/main/webapp/tests/unit/services/env-test.js
index a8a064b..5064fc3 100644
--- a/tez-ui2/src/main/webapp/tests/unit/services/env-test.js
+++ b/tez-ui2/src/main/webapp/tests/unit/services/env-test.js
@@ -29,9 +29,9 @@ test('Basic creation test', function(assert) {
   let service = this.subject();
 
   assert.ok(service);
+  assert.ok(service.ENV);
   assert.ok(service.collateConfigs);
-  assert.ok(service.getConfig);
-  assert.ok(service.getAppConfig);
+  assert.ok(service.app);
 });
 
 test('collateConfigs test', function(assert) {
@@ -46,25 +46,28 @@ test('collateConfigs test', function(assert) {
 
   service.collateConfigs();
 
-  APP = service._configs.APP;
+  APP = service.get("app");
   assert.equal(APP.a, 1, "Test window.ENV merge onto environment.APP");
   assert.equal(APP.b, 22);
 });
 
-test('getConfig test', function(assert) {
-  let service = this.subject();
+test('app computed property test', function(assert) {
+  let service = this.subject(),
+      ENV = {
+        b: 2
+      };
 
-  window.ENV = {};
-  environment.a = 11;
+  window.ENV = ENV;
+  environment.APP.a = 11;
   service.collateConfigs();
-  assert.equal(service.getConfig("a"), environment.a);
+  assert.equal(service.get("app.a"), environment.APP.a);
+  assert.equal(service.get("app.b"), ENV.b);
 });
 
-test('getAppConfig test', function(assert) {
+test('Validate config/default-app-conf.js', function(assert) {
   let service = this.subject();
 
-  window.ENV = {};
-  environment.APP.a = 11;
-  service.collateConfigs();
-  assert.equal(service.getAppConfig("a"), environment.APP.a);
+  assert.equal(service.get("app.hosts.timeline"), "localhost:8188");
+  assert.equal(service.get("app.namespaces.webService.timeline"), "ws/v1/timeline");
+  assert.equal(service.get("app.paths.timeline.dag"), "TEZ_DAG_ID");
 });


Mime
View raw message