浏览代码

[oozie] Support $ parameters in the job name in the editor

Romain Rigaux 10 年之前
父节点
当前提交
5b9f4f4
共有 2 个文件被更改,包括 21 次插入3 次删除
  1. 20 2
      apps/oozie/src/oozie/models2.py
  2. 1 1
      desktop/libs/liboozie/src/liboozie/types.py

+ 20 - 2
apps/oozie/src/oozie/models2.py

@@ -65,10 +65,10 @@ class Job(object):
 
     for c in self.name[:40]:
       if not good_name:
-        if not re.match('[a-zA-Z_]', c):
+        if not re.match('[a-zA-Z_\{\$\}]', c):
           c = '_'
       else:
-        if not re.match('[\-_a-zA-Z0-9]', c):
+        if not re.match('[\-_a-zA-Z0-9\{\$\}]', c):
           c = '_'
       good_name.append(c)
 
@@ -227,6 +227,9 @@ class Workflow(Job):
   def find_parameters(self):
     params = set()
 
+    for param in find_dollar_braced_variables(self.name):
+      params.add(param)
+
     if self.sla_enabled:
       for param in find_json_parameters(self.sla):
         params.add(param)
@@ -258,6 +261,10 @@ class Workflow(Job):
   def get_absolute_url(self):
     return reverse('oozie:edit_workflow') + '?workflow=%s' % self.id
 
+  @classmethod
+  def get_application_path_key(cls):
+    return 'oozie.wf.application.path'
+
 
 class Node():
   def __init__(self, data):
@@ -1625,6 +1632,9 @@ class Coordinator(Job):
   def find_parameters(self):
     params = set()
 
+    for param in find_dollar_braced_variables(self.name):
+      params.add(param)
+
     for param in find_json_parameters([self.data['properties']]):
       params.add(param)
 
@@ -1722,6 +1732,10 @@ class Coordinator(Job):
   def get_absolute_url(self):
     return reverse('oozie:edit_coordinator') + '?coordinator=%s' % self.id
 
+  @classmethod
+  def get_application_path_key(cls):
+    return 'oozie.coord.application.path'
+
 
 class Dataset():
 
@@ -1897,6 +1911,10 @@ class Bundle(Job):
   def find_parameters(self):
     return {}
 
+  @classmethod
+  def get_application_path_key(cls):
+    return 'oozie.bundle.application.path'
+
 
 class History(object):
 

+ 1 - 1
desktop/libs/liboozie/src/liboozie/types.py

@@ -435,7 +435,7 @@ class Workflow(Job):
     return reverse('oozie:list_oozie_workflow', kwargs={'job_id': self.id}) + extra_params
 
   def get_progress(self, full_node_list=None):
-    if self.status == 'SUCCEEDED':
+    if self.status in ('SUCCEEDED', 'KILLED'):
       return 100 # Case of decision nodes
     else:
       if full_node_list is not None:            # Should remove the un-reached branches if decision node