简体   繁体   中英

Passing properties file to Oozie Java Action

I have a Oozie java action workflow set up, which I plan to use an Oozie coordinator to schedule. The java action runs a Camus Job, whose jar and properties config file I have put in the workflow/lib directory. Any ideas on how I would pass the -P argument to this? Currently, I'm doing something like this:

<workflow-app xmlns="uri:oozie:workflow:0.5" name="camus-wf">
    <start to="camusJob"/>
    <action name="camusJob">
        <java>
            <job-tracker>${jobTracker}</job-tracker>
            <name-node>${nameNode}</name-node>
            <configuration>
            <property>
                    <name>mapred.job.name</name>
                    <value>camusJob</value>
                </property>
                <property>
                    <name>mapred.job.queue.name</name>
                    <value>${queueName}</value>
                </property>
            </configuration>
            <main-class>com.linkedin.camus.etl.kafka.CamusJob</main-class>
    <arg>-P</arg>
    <arg>${camusJobProperties}</arg>
        </java>
        <ok to="end"/>
        <error to="fail"/>
    </action>
    <kill name="fail">
        <message>${wf:errorMessage(wf:lastErrorNode())}</message>
    </kill>
    <end name="end"/>
</workflow-app>

Where camusJobProperties looks like

hdfs://10.0.2.15:8020/coordCamusJob/workflowAppPath/lib/config.properties

But the workflow doesn't seem to run (gets stuck on PREP). Any ideas how to fix this?

Thanks!

EDIT: After correcting my nameNode URL, I can see that I get the following error:

ACTION[0000002-150804091125207-oozie-oozi-W@camusJob] Launcher exception: java.lang.IllegalArgumentException: Wrong FS: hdfs://10.0.2.15:8020/user/root/app/workflow/lib/config.properties, expected: file:///
org.apache.oozie.action.hadoop.JavaMainException: java.lang.IllegalArgumentException: Wrong FS: hdfs://10.0.2.15:8020/user/root/app/workflow/lib/config.properties, expected: file:///
    at org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:58)
    at org.apache.oozie.action.hadoop.LauncherMain.run(LauncherMain.java:39)
    at org.apache.oozie.action.hadoop.JavaMain.main(JavaMain.java:36)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.oozie.action.hadoop.LauncherMapper.map(LauncherMapper.java:226)
    at org.apache.hadoop.mapred.MapRunner.run(MapRunner.java:54)
    at org.apache.hadoop.mapred.MapTask.runOldMapper(MapTask.java:450)
    at org.apache.hadoop.mapred.MapTask.run(MapTask.java:343)
    at org.apache.hadoop.mapred.YarnChild$2.run(YarnChild.java:163)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAs(Subject.java:415)
    at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1628)
    at org.apache.hadoop.mapred.YarnChild.main(YarnChild.java:158)
Caused by: java.lang.IllegalArgumentException: Wrong FS: hdfs://10.0.2.15:8020/user/root/app/workflow/lib/config.properties, expected: file:///
    at org.apache.hadoop.fs.FileSystem.checkPath(FileSystem.java:645)
    at org.apache.hadoop.fs.RawLocalFileSystem.pathToFile(RawLocalFileSystem.java:82)
    at org.apache.hadoop.fs.RawLocalFileSystem.deprecatedGetFileStatus(RawLocalFileSystem.java:603)
    at org.apache.hadoop.fs.RawLocalFileSystem.getFileLinkStatusInternal(RawLocalFileSystem.java:821)
    at org.apache.hadoop.fs.RawLocalFileSystem.getFileStatus(RawLocalFileSystem.java:598)
    at org.apache.hadoop.fs.FilterFileSystem.getFileStatus(FilterFileSystem.java:414)
    at org.apache.hadoop.fs.ChecksumFileSystem$ChecksumFSInputChecker.<init>(ChecksumFileSystem.java:140)
    at org.apache.hadoop.fs.ChecksumFileSystem.open(ChecksumFileSystem.java:341)
    at org.apache.hadoop.fs.FileSystem.open(FileSystem.java:766)
    at com.linkedin.camus.etl.kafka.CamusJob.run(CamusJob.java:679)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70)
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84)
    at com.linkedin.camus.etl.kafka.CamusJob.main(CamusJob.java:646)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.apache.oozie.action.hadoop.JavaMain.run(JavaMain.java:55)
    ... 15 more

So basically my question is how would I pass the properties file argument when the properties file is located in the HDFS (in particular, in the workflow/lib directory)

For the first part of the question : it might be due to incorrect url of namenode or jobtracker

For the second part : you have to configure the core-site.xml , the property fs.defaultFS to hdfs://host:port/

Also, In your Java program set path of core-site.xml in your config object

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM