Browse Source

[oozie] Make sure a subworklow gets its graph in the dashboard

Romain Rigaux 10 years ago
parent
commit
947eda8

+ 9 - 0
apps/oozie/src/oozie/models2.py

@@ -210,6 +210,15 @@ class Workflow(Job):
     _data = self.get_data()
     return _data['workflow']['properties']['parameters']
 
+  def override_subworkflow_id(self, sub_wf_action, workflow_id):
+    _data = self.get_data()
+
+    action = [_action for _action in _data['workflow']['nodes'] if _action['id'] == sub_wf_action.id]
+    if action:
+      action[0]['properties']['job_properties'].append({'name': Workflow.HUE_ID, 'value': workflow_id})
+
+    self.data = json.dumps(_data)
+
   @property
   def sla_enabled(self):
     _data = self.get_data()

+ 5 - 3
desktop/libs/liboozie/src/liboozie/submission2.py

@@ -150,9 +150,6 @@ class Submission(object):
       jt_address = cluster.get_cluster_addr_for_job_submission()
       self._update_properties(jt_address) # Needed for coordinator deploying workflows with credentials
 
-    oozie_xml = self.job.to_xml(self.properties)
-    self._do_as(self.user.username , self._copy_files, deployment_dir, oozie_xml, self.properties)
-
     if hasattr(self.job, 'nodes'):
       for action in self.job.nodes:
         # Make sure XML is there
@@ -163,6 +160,11 @@ class Submission(object):
           sub_deploy = Submission(self.user, workflow, self.fs, self.jt, self.properties)
           sub_deploy.deploy()
 
+          self.job.override_subworkflow_id(action, workflow.id) # For displaying the correct graph
+
+    oozie_xml = self.job.to_xml(self.properties)
+    self._do_as(self.user.username, self._copy_files, deployment_dir, oozie_xml, self.properties)
+
     return deployment_dir