user2254180
user2254180

Reputation: 856

Python Oozie Shell Action Failing

I have an Oozie workflow that contains a shell action that invokes a Python script that is failing with the following error.

Launcher ERROR, reason: Main class [org.apache.oozie.action.hadoop.ShellMain], exit code [1]

The Python script (hello.py) is simple.

print("Hello, World!")

Here is my Oozie workflow.

<workflow-app xmlns="uri:oozie:workflow:0.4" name="hello">
<start to="shell-check-hour"/>

<action name="shell-check-hour">
<shell xmlns="uri:oozie:shell-action:0.2">
<job-tracker>${jobTracker}</job-tracker>
<name-node>${nameNode}</name-node>
<configuration>
<property>
<name>mapred.job.queue.name</name>
<value>${queueName}</value>
</property>
</configuration>
<exec>hello.py</exec>
<file>hdfs://localhost:8020/user/test/hello.py</file>
<capture-output/>
</shell>
<ok to="end"/>
<error to="fail"/>
</action>
<kill name="fail">
<message>Workflow failed, error message[${wf:errorMessage(wf:lastErrorNode())}]</message>
</kill>
<end name="end"/>
</workflow-app>

Can someone see anything wrong with what I am doing? If I replace the Python script with a shell script, the shell script executes fine (both files are in the same directory). This leads me to believe that the problem is that for whatever reason, Python isn't being recognised by Oozie.

Upvotes: 2

Views: 3192

Answers (1)

TG Gowda
TG Gowda

Reputation: 11957

Add Hash-Bang to your script

For example, my script started with

#!/usr/bin/env python

Upvotes: 3

Related Questions