Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (2)
Mentor

This is a second in the series of articles on WFM.

Part 1: https://community.hortonworks.com/articles/82964/getting-started-with-apache-ambari-workflow-design....

Part 3: https://community.hortonworks.com/articles/82988/apache-ambari-workflow-designer-view-for-apache-oo-...

Part 4: https://community.hortonworks.com/articles/83051/apache-ambari-workflow-designer-view-for-apache-oo-...

Part 5: https://community.hortonworks.com/articles/83361/apache-ambari-workflow-manager-view-for-apache-ooz....

Part 6: https://community.hortonworks.com/articles/83787/apache-ambari-workflow-manager-view-for-apache-ooz-...

Part 7: https://community.hortonworks.com/articles/84071/apache-ambari-workflow-manager-view-for-apache-ooz-...

Part 8: https://community.hortonworks.com/articles/84394/apache-ambari-workflow-manager-view-for-apache-ooz-...

Part 9: https://community.hortonworks.com/articles/85091/apache-ambari-workflow-manager-view-for-apache-ooz-...

Part 10: https://community.hortonworks.com/articles/85354/apache-ambari-workflow-manager-view-for-apache-ooz-...

Part 11: https://community.hortonworks.com/articles/85361/apache-ambari-workflow-manager-view-for-apache-ooz-...

Part 12: https://community.hortonworks.com/articles/131389/apache-ambari-workflow-manager-view-for-apache-ooz...

In this tutorial, we're going to import an existing workflow with a Python script wrapped in a shell action. The existing workflows can exist on HDFS or in your local file system. Let's fetch it onto the canvas.

12327--1-import.png

My workflow is already on HDFS and therefore that's the option I select. WFM view is integrated with WEBHDFS browser and it makes navigating the directory tree very easy.

12328--2-file-browser.png

Navigate to the directory in HDFS with the desired workflow and hit select. Once imported, WFM will run validation on the syntax and present it for further modification.

12329--3-imported.png

Now you can modify the python-node by hovering over it and clicking the gear icon.

12330--4-modify.png

Once clicked, you can configure the rest of the action to your liking.

12331--5-configure.png

it inherits all of the old properties of your workflow.

12332--6-inherited-proerties.png

Notice you can specify a directory and script file in the File text box.

My Oozie workflow also has old properties like specification of YARN Queue, WFM correctly parses and inherits that property.

12333--7-oozie-properties.png

Also notice I have capture output as I'd like to see the result of the output to the console by my script.

At this point, I'm ready to preview my workflow, WFM comes with a handy XML preview.

12334--8-preview-xml.png

12335--9-xml-preview-window.png

Looks all right to me, I'm ready to submit. Notice WFM doesn't know what $jobTracker is and prompts me to fill that out along with queue.

12336--10-on-submit-fill-out-custom-inherited.png

At this point we can navigate to the WFM Dashboard tab as you've seen in my previous tutorial and track the job status.

12337--11-dashboard-tab.png

My job failed, I can debug the job status directly from WFM

12338--12-check-job-status.png

Turns out, issue is with my parameter $jobTracker, in WFM, it was renamed to $resourceManager and it comes by default, I need to remove my custom parameter and let WFM do what it does best. Here's preview of my XML after the change

12339--13-rename-jobtracker-to-rm.png

Back in the dashboard, I can click on the job and investigate the status.

12340--14-preview-active-job-status.png

My job completed successfully, I can navigate to the YARN job status straight from WFM.

12341--15-job-completed-successfully.png

I need to click on my succeeded wf and click on the arrow icon. It is right there on the right, same row asthe python-node

12342--16-view-job-output.png

12343--17-navigate-to-yarn-job-history.png

Finally, navigate to the logs of your YARN job to view the output

12344--18-view-yarn-job-output.png

And that's all for this tutorial, you learned how to import an existing Python Oozie workflow and further edit it via WFM. My Python script by the way has the following code

#! /usr/bin/env python
import os, pwd, sysprint 
"who am I? " + pwd.getpwuid(os.getuid())[0]
print "this is a Python script" 
print "Python Interpreter Version: " + sys.version

You can find my workflow along with other samples on my github page https://github.com/dbist/oozie

Stay tuned!

6,178 Views
Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
2 of 2
Last update:
‎08-17-2019 04:54 AM
Updated by:
 
Contributors
Top Kudoed Authors