【发布时间】:2014-03-11 21:42:04
【问题描述】:
从前面的问题继续...
我有一个 Oozie 工作流,其中包含一个调用 Python 脚本的 shell 操作,该脚本失败并出现以下错误。
IOError: [Errno 13] Permission denied: '/home/test/myfile.txt'
所有 Python 脚本 (hello.py) 试图做的就是打开一个文件。此代码在 Hadoop 外部执行时可以正常工作。
if __name__ == '__main__':
print ('Starting script')
filein = '/home/test/myfile.txt'
file = open(filein, 'r')
这是我的 Oozie 工作流程。
<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>
如果我尝试给出文件所在位置的绝对路径,我会被拒绝。
filein = '/home/test/myfile.txt'
如果我只尝试文件名,我会得到文件未找到。我不明白这个,Python脚本和文件在同一个HDFS位置
filein = 'myfile.txt'
也许我需要修改我的 Oozie 脚本以将文件添加为参数?
【问题讨论】: