Эх сурвалжийг харах

[oozie] Add a Fork Example with Pig and Sub-workflow

Support running any workflow as a sub-workflow.
Romain Rigaux 10 жил өмнө
parent
commit
5c1a734

+ 3 - 0
apps/oozie/examples/workflows/fork/dump.pig

@@ -0,0 +1,3 @@
+a = LOAD '$input';
+b = LIMIT a $limit;
+DUMP b;

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 23 - 0
apps/oozie/src/oozie/fixtures/initial_oozie_examples.json


+ 21 - 19
apps/oozie/src/oozie/templates/editor2/common_workflow.mako

@@ -1066,6 +1066,27 @@
       <!-- /ko -->
     </div>
 
+    <div data-bind="visible: $root.isEditing()">
+      <h6>
+        <a class="pointer" data-bind="click: function(){ properties.job_properties.push({'name': '', 'value': ''}); $(document).trigger('drawArrows') }">
+          ${ _('Properties') } <i class="fa fa-plus"></i>
+        </a>
+      </h6>
+      <ul data-bind="visible: properties.job_properties().length > 0, foreach: properties.job_properties" class="unstyled">
+        <li>
+          <input type="text" data-bind="value: name"/>
+
+          <input type="text" class="input-xlarge filechooser-input" data-bind="filechooser: value, filechooserOptions: globalFilechooserOptions, hdfsAutocomplete: value, attr: { placeholder:  $root.workflow_properties.spark_arguments.help_text }" />
+          <span data-bind='template: { name: "common-fs-link", data: {path: value, with_label: false}}'></span>              
+              
+           <a href="#" data-bind="click: function(){ $parent.properties.job_properties.remove(this); $(document).trigger('drawArrows') }">
+             <i class="fa fa-minus"></i>
+           </a>
+         </li>
+       </ul>
+      <em data-bind="visible: properties.job_properties().length == 0">${ _('No properties defined.') }</em>
+    </div>
+
     <div data-bind="visible: $parent.ooziePropertiesExpanded">
       <ul class="nav nav-tabs">
         <li class="active"><a data-bind="attr: { href: '#properties-' + id()}" data-toggle="tab">${ _('Properties') }</a></li>
@@ -1077,25 +1098,6 @@
         <div class="tab-pane active" data-bind="attr: { id: 'properties-' + id() }">
           <span data-bind="text: $root.workflow_properties.propagate_configuration.label"></span>
           <input type="checkbox" data-bind="checked: properties.propagate_configuration" />
-
-          <br/>
-
-          <h6>
-            <a class="pointer" data-bind="click: function(){ properties.job_properties.push({'name': '', 'value': ''}); $(document).trigger('drawArrows') }">
-              ${ _('Properties') } <i class="fa fa-plus"></i>
-            </a>
-          </h6>
-          <ul data-bind="visible: properties.job_properties().length > 0, foreach: properties.job_properties" class="unstyled">
-            <li>
-              <input type="text" data-bind="value: name"/>
-              <input type="text" data-bind="value: value"/>
-              <a href="#" data-bind="click: function(){ $parent.properties.job_properties.remove(this); $(document).trigger('drawArrows') }">
-                <i class="fa fa-minus"></i>
-              </a>
-            </li>
-          </ul>
-          <em data-bind="visible: properties.job_properties().length == 0">${ _('No properties defined.') }</em>
-
         </div>
 
         <div class="tab-pane" data-bind="attr: { id: 'sla-' + id() }">

+ 1 - 1
apps/oozie/src/oozie/templates/editor2/gen/workflow-subworkflow.xml.mako

@@ -19,7 +19,7 @@
 
     <action name="${ node['name'] }"${ common.credentials(node['properties']['credentials']) }>
         <sub-workflow>
-            <app-path>${'${'}nameNode}${ workflow_mapping[node['properties']['workflow']].deployment_dir }</app-path>
+            <app-path>${'${'}nameNode}${ mapping['workspace_%s' % node['properties']['workflow']] }</app-path>
 
             % if node['properties']['propagate_configuration']:
               <propagate-configuration/>

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

@@ -153,14 +153,15 @@ class Submission(object):
     if hasattr(self.job, 'nodes'):
       for action in self.job.nodes:
         # Make sure XML is there
-        # Don't support shared sub-worfklow, ore more than one level sub-workflow
+        # Don't support more than one level sub-workflow
         if action.data['type'] == 'subworkflow':
           from oozie.models2 import Workflow
           workflow = Workflow(document=Document2.objects.get(uuid=action.data['properties']['workflow']))
           sub_deploy = Submission(self.user, workflow, self.fs, self.jt, self.properties)
-          sub_deploy.deploy()
+          workspace = sub_deploy.deploy()
 
           self.job.override_subworkflow_id(action, workflow.id) # For displaying the correct graph
+          self.properties['workspace_%s' % workflow.uuid] = workspace # For pointing to the correct workspace
 
     oozie_xml = self.job.to_xml(self.properties)
     self._do_as(self.user.username, self._copy_files, deployment_dir, oozie_xml, self.properties)

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно