ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gna...@apache.org
Subject ambari git commit: AMBARI-19978. Coordinator tag sequence is not maintained.(Padma Priya N via gauravn7)
Date Wed, 15 Feb 2017 11:34:34 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 5e647df17 -> a647bf515


AMBARI-19978. Coordinator tag sequence is not maintained.(Padma Priya N via gauravn7)


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

Branch: refs/heads/branch-2.5
Commit: a647bf515128b7b8f1a87be5f54de0f83765018e
Parents: 5e647df
Author: Gaurav Nagar <grvngr@gmail.com>
Authored: Wed Feb 15 17:03:42 2017 +0530
Committer: Gaurav Nagar <grvngr@gmail.com>
Committed: Wed Feb 15 17:04:22 2017 +0530

----------------------------------------------------------------------
 .../ui/app/components/bundle-config.js          |  8 ++--
 .../resources/ui/app/components/coord-config.js | 37 ++++++++++-------
 .../coordinator/coordinator-xml-generator.js    | 12 ++++--
 .../coordinator/coordinator-xml-importer.js     | 43 ++++++++++++--------
 4 files changed, 62 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a647bf51/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
index 658cbc0..db7a180 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/bundle-config.js
@@ -90,7 +90,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
   }),
   loadBundle(draftBundle){
     if(draftBundle){
-      this.set('bundle', JSON.parse(draftBundle));
+      this.set('bundle', JSOG.parse(draftBundle));
     }else{
       this.set('bundle', this.createBundle());
     }
@@ -109,7 +109,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
     if(!this.get('bundle')){
       return;
     }
-    var json = JSON.stringify(this.get("bundle"));
+    var json = JSOG.stringify(this.get("bundle"));
     this.get('workspaceManager').saveWorkInProgress(this.get('tabInfo.id'), json);
   },
   createBundle (){
@@ -161,7 +161,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
     }.bind(this));
   },
   getBundleFromJSON(draftBundle){
-    this.set('bundle', JSON.parse(draftBundle));
+    this.set('bundle', JSOG.parse(draftBundle));
   },
   getBundleFromHdfs(filePath){
     var url =  Ember.ENV.API_URL + "/readWorkflow?workflowPath="+filePath+"&jobType=BUNDLE";
@@ -401,7 +401,7 @@ export default Ember.Component.extend(Ember.Evented, Validations, {
         var bundleGenerator = BundleGenerator.create({bundle:this.get("bundle")});
         bundleXml = bundleGenerator.process();
       }
-      var bundleJson = JSON.stringify(this.get("bundle"));
+      var bundleJson = JSOG.stringify(this.get("bundle"));
       this.set("configForSave",{json:bundleJson, xml:bundleXml, isDraft: isDraft});
       this.set("showingSaveWorkflow", true);
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/a647bf51/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
index 39b9d11..369481f 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/coord-config.js
@@ -89,7 +89,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
     this.on('fileSelected',function(fileName){
       this.set(this.get('filePathModel'), fileName);
     }.bind(this));
-
+    this.set('childComponents', new Map());
   }.on('init'),
   conditionalDataInExists :false,
   elementsInserted : function(){
@@ -123,7 +123,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
   }),
   loadCoordinator(draftCoordinator){
     if(draftCoordinator){
-      this.set('coordinator', JSON.parse(draftCoordinator));
+      this.set('coordinator', JSOG.parse(draftCoordinator));
     }else{
       this.set('coordinator', this.createNewCoordinator());
     }
@@ -162,7 +162,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
     if(!this.get('coordinator')){
       return;
     }
-    var json = JSON.stringify(this.get("coordinator"));
+    var json = JSOG.stringify(this.get("coordinator"));
     this.get('workspaceManager').saveWorkInProgress(this.get('tabInfo.id'), json);
   },
   showExistingWorkflow  : function(){
@@ -188,6 +188,16 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
   }.on('didInsertElement'),
   createNewCoordinator(){
     return Coordinator.create({
+      parameters : {
+        configuration :{
+          property : Ember.A([])
+        }
+      },
+      controls : Ember.A([]),
+      datasets : Ember.A([]),
+      dataInputs : Ember.A([]),
+      inputLogic : null,
+      dataOutputs : Ember.A([]),
       workflow : {
         appPath : undefined,
         configuration :{
@@ -209,16 +219,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
         type : 'date'
       },
       timezone : 'UTC',
-      datasets : Ember.A([]),
-      dataInputs : Ember.A([]),
-      dataOutputs : Ember.A([]),
       dataInputType : 'simple',
-      parameters : {
-        configuration :{
-          property : Ember.A([])
-        }
-      },
-      controls : Ember.A([]),
       slainfo : SlaInfo.create({}),
       schemaVersions : {
         coordinatorVersion : this.get('schemaVersions').getDefaultVersion('coordinator')
@@ -278,7 +279,15 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
     }.bind(this));
   },
   getCoordinatorFromJSON(draftCoordinator){
-    this.set('coordinator', JSON.parse(draftCoordinator));
+    this.set('coordinator', JSOG.parse(draftCoordinator));
+    this.$('input[name="dataInputType"][value="'+ this.get('coordinator.dataInputType')+'"]').prop('checked',
true);
+    if(this.get('coordinator.dataInputType') === 'logical'){
+      this.set('conditionalDataInExists', true);
+    }
+    if(this.get('coordinator.inputLogic')){
+      this.set('inputLogicExists', true);
+      this.set('inputLogicEnabled', true);
+    }
   },
   readCoordinatorFromHdfs(filePath){
     var url =  Ember.ENV.API_URL + "/readWorkflow?workflowPath="+filePath+"&jobType=COORDINATOR";
@@ -649,7 +658,7 @@ export default Ember.Component.extend(Validations, Ember.Evented, {
         var coordGenerator = CoordinatorGenerator.create({coordinator:this.get("coordinator")});
         coordinatorXml = coordGenerator.process();
       }
-      var coordinatorJson = JSON.stringify(this.get("coordinator"));
+      var coordinatorJson = JSOG.stringify(this.get("coordinator"));
       this.set("configForSave",{json:coordinatorJson, xml:coordinatorXml,isDraft: isDraft});
       this.set("showingSaveWorkflow", true);
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/a647bf51/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-generator.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-generator.js
b/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-generator.js
index cbefa99..4c8d16f 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-generator.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-generator.js
@@ -15,9 +15,12 @@
 *    limitations under the License.
 */
 import Ember from 'ember';
+import {SLAMapper} from "../../domain/mapping-utils";
+
 var CoordinatorGenerator= Ember.Object.extend({
   x2js : new X2JS({useDoubleQuotes:true}),
   coordinator: null,
+  slaMapper: SLAMapper.create({}),
   init(){
   },
   process(){
@@ -34,6 +37,8 @@ var CoordinatorGenerator= Ember.Object.extend({
     coordinatorApp._end = this.coordinator.end.value;
     coordinatorApp._timezone = this.coordinator.timezone;
     coordinatorApp._xmlns = "uri:oozie:coordinator:"+this.coordinator.schemaVersions.coordinatorVersion;
+    this.generateParameters(coordinatorApp);
+    this.generateControls(coordinatorApp);
     this.generateDataSets(coordinatorApp);
     if(this.coordinator.dataInputType === 'simple'){
       this.generateInputEvents(coordinatorApp);
@@ -45,8 +50,10 @@ var CoordinatorGenerator= Ember.Object.extend({
     }
     this.generateOutputEvents(coordinatorApp);
     this.generateAction(coordinatorApp);
-    this.generateParameters(coordinatorApp);
-    this.generateControls(coordinatorApp);
+    if(this.coordinator.slaEnabled){
+      coordinatorApp["_xmlns:sla"] = "uri:oozie:sla:0.2";
+      this.get("slaMapper").hanldeGeneration(this.coordinator.slaInfo, coordinatorApp.action);
+    }
     var xmlAsStr = this.get("x2js").json2xml_str(xmlJson);
     return xmlAsStr;
   },
@@ -116,7 +123,6 @@ var CoordinatorGenerator= Ember.Object.extend({
     if(!condition) {
       return;
     }
-    conditionJson._name = condition.name;
     if(condition.min){
       conditionJson._min = condition.min;
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a647bf51/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-importer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-importer.js
b/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-importer.js
index ddb2b43..bc61f10 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-importer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/coordinator/coordinator-xml-importer.js
@@ -18,47 +18,52 @@ import Ember from 'ember';
 import { Coordinator } from '../coordinator/coordinator';
 import SchemaVersions from '../schema-versions';
 import CommonUtils from "../../utils/common-utils";
+import {SLAMapper} from "../../domain/mapping-utils";
+import {SlaInfo} from '../../domain/sla-info';
 
 var CoordinatorXmlImporter= Ember.Object.extend({
   x2js : new X2JS(),
   schemaVersions: SchemaVersions.create({}),
+  slaMapper: SLAMapper.create({}),
   importCoordinator (xml){
     var coordinatorJson = this.get("x2js").xml_str2json(xml);
     return this.processCoordinatorXML(coordinatorJson);
   },
   createNewCoordinator(){
     return Coordinator.create({
+      parameters : {
+        configuration :{
+          property : Ember.A([])
+        }
+      },
+      controls : Ember.A([]),
+      datasets : Ember.A([]),
+      dataInputs : Ember.A([]),
+      inputLogic : null,
+      dataOutputs : Ember.A([]),
       workflow : {
-        appPath : '',
+        appPath : undefined,
         configuration :{
           property : Ember.A([])
         }
       },
       frequency : {
-        type : '',
-        value : ''
+        type : undefined,
+        value : undefined
       },
       start : {
-        value : '',
-        displayValue : '',
+        value : undefined,
+        displayValue : undefined,
         type : 'date'
       },
       end : {
-        value : '',
-        displayValue : '',
+        value : undefined,
+        displayValue : undefined,
         type : 'date'
       },
-      timezone : '',
-      datasets : Ember.A([]),
-      dataInputs : Ember.A([]),
-      dataOutputs : Ember.A([]),
+      timezone : 'UTC',
       dataInputType : 'simple',
-      parameters : {
-        configuration :{
-          property : Ember.A([])
-        }
-      },
-      controls : Ember.A([]),
+      slainfo : SlaInfo.create({}),
       schemaVersions : {
         coordinatorVersion : this.get('schemaVersions').getDefaultVersion('coordinator')
       }
@@ -102,6 +107,10 @@ var CoordinatorXmlImporter= Ember.Object.extend({
     this.extractAction(coordinatorApp, coordinator);
     this.extractParameters(coordinatorApp, coordinator);
     this.extractControls(coordinatorApp, coordinator);
+    if (coordinatorApp.action.info && coordinatorApp.action.info.__prefix==="sla")
{
+      coordinator.slaEnabled=true;
+      this.get("slaMapper").handleImport(coordinator, coordinatorApp.action.info, "slaInfo");
+    }
     return {coordinator: coordinator, errors: errors};
   },
   extractDateField(value){


Mime
View raw message