浏览代码

[oozie] Adding SLA to Workflow properties

Romain Rigaux 11 年之前
父节点
当前提交
5d3e881

+ 13 - 1
apps/oozie/src/oozie/models2.py

@@ -42,6 +42,17 @@ LOG = logging.getLogger(__name__)
 class Workflow():
 class Workflow():
   XML_FILE_NAME = 'workflow.xml'
   XML_FILE_NAME = 'workflow.xml'
   PROPERTY_APP_PATH = 'oozie.wf.application.path'
   PROPERTY_APP_PATH = 'oozie.wf.application.path'
+  SLA_DEFAULT = [
+      {'key': 'enabled', 'value': False},
+      {'key': 'nominal-time', 'value': ''},
+      {'key': 'should-start', 'value': ''},
+      {'key': 'should-end', 'value': ''},
+      {'key': 'max-duration', 'value': ''},
+      {'key': 'alert-events', 'value': ''},
+      {'key': 'alert-contact', 'value': ''},
+      {'key': 'notification-msg', 'value': ''},
+      {'key': 'upstream-apps', 'value': ''},
+  ]
   HUE_ID = 'hue-id-w'
   HUE_ID = 'hue-id-w'
   
   
   def __init__(self, data=None, document=None, workflow=None):
   def __init__(self, data=None, document=None, workflow=None):
@@ -69,7 +80,8 @@ class Workflow():
                     "schema_version": "uri:oozie:workflow:0.4",
                     "schema_version": "uri:oozie:workflow:0.4",
                     "sla_workflow_enabled": False,
                     "sla_workflow_enabled": False,
                     "credentials": [],
                     "credentials": [],
-                    "properties": []
+                    "properties": [],
+                    "sla": Workflow.SLA_DEFAULT
               },
               },
               "nodes":[
               "nodes":[
                   {"id":"3f107997-04cc-8733-60a9-a4bb62cebffc","name":"Start","type":"start-widget","properties":{},"children":[{'to': '33430f0f-ebfa-c3ec-f237-3e77efa03d0a'}]},            
                   {"id":"3f107997-04cc-8733-60a9-a4bb62cebffc","name":"Start","type":"start-widget","properties":{},"children":[{'to': '33430f0f-ebfa-c3ec-f237-3e77efa03d0a'}]},            

+ 8 - 1
apps/oozie/src/oozie/templates/editor/workflow_editor.mako

@@ -533,9 +533,16 @@ ${ dashboard.layout_skeleton() }
 	  </button>
 	  </button>
 
 
       <br/>
       <br/>
-      ${_("Job XML")}
+      ${ _("Job XML") }
       <input data-bind="value: $root.workflow.properties.job_xml"/>
       <input data-bind="value: $root.workflow.properties.job_xml"/>
 
 
+      <br/>
+      <div class="control-group">
+        <label class="control-label">${ _('SLA Configuration') }</label>
+        <div class="controls" data-bind="with: $root.workflow.properties">
+          ${ utils.slaForm() }
+        </div>
+      </div>
     </div>
     </div>
   </div>
   </div>
 </div>
 </div>

+ 1 - 11
apps/oozie/src/oozie/views/editor2.py

@@ -190,17 +190,7 @@ def add_node(request):
       'prepares': [],
       'prepares': [],
       'job_xml': '',
       'job_xml': '',
       'properties': [],
       'properties': [],
-      'sla': [
-          {'key': 'enabled', 'value': False},
-          {'key': 'nominal-time', 'value': ''},
-          {'key': 'should-start', 'value': ''},
-          {'key': 'should-end', 'value': ''},
-          {'key': 'max-duration', 'value': ''},
-          {'key': 'alert-events', 'value': ''},
-          {'key': 'alert-contact', 'value': ''},
-          {'key': 'notification-msg', 'value': ''},
-          {'key': 'upstream-apps', 'value': ''},
-      ],
+      'sla': Workflow.SLA_DEFAULT,
       'credentials': []
       'credentials': []
   })
   })