How azkaban execute base java job?

578 views
Skip to first unread message

elka...@gmail.com

unread,
Sep 3, 2017, 10:49:32 PM9/3/17
to azkaban
I found the Azkaban support java code in schedule job on search engine. And the I deploy the last release package and write a simple code which use out the properties's value. Like below:

package io.github.elkan1788;

import azkaban.utils.Props;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *
 * @author 凡梦星尘(elkan1788@gmail.com)
 */
public class JobMain {

    private static final Logger logger = LoggerFactory.getLogger(JobMain.class);

    private int fileRows;
    private int fileLine;

    public JobMain(String name, Props props) throws Exception {
        this.fileRows = props.getInt("file.rows");
        this.fileLine = props.getInt("file.line");
    }

    public void run() throws Exception {
        logger.info(" ### this is JavaMain method ###");
        logger.info("fileRows value is ==> " + fileRows);
        logger.info("fileLine value is ==> " + fileLine);
    }
   
}



Then I submit this job in Azkaban web server click the execute button, but it  run failed!!!. The log output like this:

04-09-2017 10:22:54 CST java INFO - Starting job java at 1504491774017
04-09-2017 10:22:54 CST java INFO - azkaban.webserver.url property was not set
04-09-2017 10:22:54 CST java INFO - job JVM args: -Dazkaban.flowid=java -Dazkaban.execid=216 -Dazkaban.jobid=java
04-09-2017 10:22:54 CST java INFO - Building java job executor.
04-09-2017 10:22:54 CST java INFO - Memory granted for job java
04-09-2017 10:22:54 CST java INFO - HADOOP_HOME not set, using default hadoop config.
04-09-2017 10:22:54 CST java INFO - 1 commands to execute.
04-09-2017 10:22:54 CST java INFO - effective user is: tyadmin
04-09-2017 10:22:54 CST java INFO - Command: java -Dazkaban.flowid=java -Dazkaban.execid=216 -Dazkaban.jobid=java -Xms64M -Xmx256M -cp /data/azkaban-java-job.jar: /data/azkaban_3.32.1/exec-server/lib/hadoop-common-2.6.1.jar:/data/azkaban_3.32.1/exec-server/plugins/jobtypes/java/azkaban-jobtype-3.0.0.jar:/data/azkaban_3.32.1/exec-server/lib/azkaban-common-0.1.0-SNAPSHOT.jar:/data/azkaban_3.32.1/exec-server/lib/azkaban-hadoop-security-plugin-0.1.0-SNAPSHOT.jar:/data/azkaban_3.32.1/exec-server/executions/216/_resources_java:/data/azkaban_3.32.1/exec-server/lib/log4j-1.2.17.jar:/usr/hdp/current/hadoop-client/conf:/usr/hdp/current/hadoop-client/lib:/data/azkaban_3.32.1/exec-server/plugins/jobtypes/java/lib azkaban.jobtype.JavaJobRunnerMain
04-09-2017 10:22:54 CST java INFO - Environment variables: {JOB_OUTPUT_PROP_FILE=/data/azkaban_3.32.1/exec-server/executions/216/java_output_5323325473225255157_tmp, JOB_PROP_FILE=/data/azkaban_3.32.1/exec-server/executions/216/java_props_6479628124977045358_tmp, KRB5CCNAME=/tmp/krb5cc__Java_Job__java__java__216__tyadmin, JOB_NAME=java}
04-09-2017 10:22:54 CST java INFO - Working directory: /data/azkaban_3.32.1/exec-server/executions/216
04-09-2017 10:22:55 CST java INFO - Error: Could not find or load main class .data.azkaban_3.32.1.exec-server.lib.hadoop-common-2.6.1.jar:.data.azkaban_3.32.1.exec-server.plugins.jobtypes.java.azkaban-jobtype-3.0.0.jar:.data.azkaban_3.32.1.exec-server.lib.azkaban-common-0.1.0-SNAPSHOT.jar:.data.azkaban_3.32.1.exec-server.lib.azkaban-hadoop-security-plugin-0.1.0-SNAPSHOT.jar:.data.azkaban_3.32.1.exec-server.executions.216._resources_java:.data.azkaban_3.32.1.exec-server.lib.log4j-1.2.17.jar:.usr.hdp.current.hadoop-client.conf:.usr.hdp.current.hadoop-client.lib:.data.azkaban_3.32.1.exec-server.plugins.jobtypes.java.lib
04-09-2017 10:22:55 CST java INFO - Process completed unsuccessfully in 0 seconds.
04-09-2017 10:22:55 CST java ERROR - Job run failed!
java
.lang.RuntimeException: azkaban.jobExecutor.utils.process.ProcessFailureException
        at azkaban
.jobExecutor.ProcessJob.run(ProcessJob.java:270)
        at azkaban
.jobtype.JavaJob.run(JavaJob.java:158)
        at azkaban
.execapp.JobRunner.runJob(JobRunner.java:745)
        at azkaban
.execapp.JobRunner.doRun(JobRunner.java:587)
        at azkaban
.execapp.JobRunner.run(JobRunner.java:548)
        at java
.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java
.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java
.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java
.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java
.lang.Thread.run(Thread.java:745)
Caused by: azkaban.jobExecutor.utils.process.ProcessFailureException
        at azkaban
.jobExecutor.utils.process.AzkabanProcess.run(AzkabanProcess.java:131)
        at azkaban
.jobExecutor.ProcessJob.run(ProcessJob.java:261)
       
... 9 more
04-09-2017 10:22:55 CST java ERROR - azkaban.jobExecutor.utils.process.ProcessFailureException cause: azkaban.jobExecutor.utils.process.ProcessFailureException
04-09-2017 10:22:55 CST java INFO - Finishing job java attempt: 0 at 1504491775082 with status FAILED


There so strange why it said not found main class!!! The configure file content is here:

type=java


job.class=io.github.elkan1788.JobMain


#指定执行jar包的路径


classpath=lib/*,/data/azkaban_3.32.1/exec-server/lib/hadoop-common-2.6.1.jar


#用户参数1


file.rows=10


#用户参数2


file.line=50



Who can tell me how to resolve it. Thanks.

0x4c...@gmail.com

unread,
Sep 5, 2017, 5:21:08 AM9/5/17
to azkaban
Firstly, you should specify "type" in job file by "javaprocess". Secondly, the Main Class contains Main Method should be specified by "java.class". And your zip should include jar.  

在 2017年9月4日星期一 UTC+8上午10:49:32,Senhui Lee写道:
Reply all
Reply to author
Forward
0 new messages