本文介绍了AWS EMR 4.0 - 如何添加自定义JAR步骤来运行shell命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用EMR 4.0.0上的步骤运行shell命令,并使用此链接进行引用 -



但我想知道从'JAR位置'字段中放置'command-runner.jar'的位置



我在AWS s3中保存了'command-runner.jar',并尝试从该位置加载它,在'Arguments'中给出了'example.sh'文件的s3位置,并且在添加步骤后它失败并给出此异常

 线程main中的异常java.lang.RuntimeException:java.io.IOException:无法运行程序s3://< path> ; /example.sh(在目录。中):error = 2,没有这样的文件或目录
at com.amazonaws.emr.com mand.runner.ProcessRunner.exec(ProcessRunner.java:139)
处sun.reflect.NativeMethodAccessorImpl com.amazonaws.emr.command.runner.CommandRunner.main(CommandRunner.java:13)
。 invoke0(本机方法)处是java sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

。 lang.reflect.Method.invoke(Method.java:606)
处org.apache.hadoop.util org.apache.hadoop.util.RunJar.run(RunJar.java:221)
。 RunJar.main(RunJar.java:136)
导致:java.io.IOException:无法运行程序s3://< path> /example.sh(在目录。中):error = 2,没有这样的文件或目录
在java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
在com.amazonaws.emr.command.runner.ProcessRunner.exec(ProcessRunner.java:92 )
... 7 more
导致:java.io.IOException:error = 2,没有这样的文件或目录
at java.lan g.UNIXProcess.forkAndExec(本机方法)LT
。在java.lang.UNIXProcess&;初始化>(UNIXProcess.java:187)
。在java.lang.ProcessImpl.start(ProcessImpl.java:130)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
... 8 more


要运行存储在S3中的shell脚本,使用 script-runner.jar ,它位于 s3://elasticmapreduce/libs/script-runner/script-runner.jar



command-runner.jar 仅适用于本地文件。


I am trying to run shell commands using steps on EMR 4.0.0 and used this link for reference - http://docs.aws.amazon.com/ElasticMapReduce/latest/DeveloperGuide/emr-hadoop-script.html

But I want to know from where to put 'command-runner.jar' in 'JAR location' field http://i.stack.imgur.com/CRicz.png

I kept 'command-runner.jar' in AWS s3 and tried to load it from that location and in 'Arguments' gave s3 location of my 'example.sh' file and after adding step it failed giving this exception

Exception in thread "main" java.lang.RuntimeException: java.io.IOException: Cannot run program "s3://<path>/example.sh" (in directory "."): error=2, No such file or directory
    at com.amazonaws.emr.command.runner.ProcessRunner.exec(ProcessRunner.java:139)
    at com.amazonaws.emr.command.runner.CommandRunner.main(CommandRunner.java:13)
    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.hadoop.util.RunJar.run(RunJar.java:221)
    at org.apache.hadoop.util.RunJar.main(RunJar.java:136)
Caused by: java.io.IOException: Cannot run program "s3://<path>/example.sh" (in directory "."): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1047)
    at com.amazonaws.emr.command.runner.ProcessRunner.exec(ProcessRunner.java:92)
    ... 7 more
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.<init>(UNIXProcess.java:187)
    at java.lang.ProcessImpl.start(ProcessImpl.java:130)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1028)
    ... 8 more
解决方案

To run a shell script stored in S3, use script-runner.jar, which is located at s3://elasticmapreduce/libs/script-runner/script-runner.jar.

command-runner.jar will work for local files only.

这篇关于AWS EMR 4.0 - 如何添加自定义JAR步骤来运行shell命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 03:37