正确的方法提供火花应用程序的参数/在空间精氨酸火花提交 [英] Proper way to provide spark application a parameter/arg with spaces in spark-submit

查看:195
本文介绍了正确的方法提供火花应用程序的参数/在空间精氨酸火花提交的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有类似于以下,用shell脚本:

  FOO =酒吧胶
$火花提交--verbose --class SomeApp some.jar$ FOO

然而,这将导致:

 主类:
SomeApp
参数:
酒吧

在哪里为我所期待的是巴胶

的一个参数

/更新

这么多的弱智化这个问题。

什么我真的是:

  FOO =酒吧胶
$的ssh主机火花提交--verbose --class SomeApp some.jar$ FOO

这应该已经过:

  FOO =酒吧胶
$的ssh主机火花提交--verbose --class SomeApp some.jar \\$ FOO \\


解决方案

当您通过ssh命令发送一个命令,任何双引号是由当地的,当前的shell PTED间$ P $。

假设你有一个简单的脚本,print-first-arg.sh遥控器上的:

 #!/斌/庆典
回声$ 1

然后

  $ SSH主机print-first-arg.sh的hello world

结果

  $ SSH主机print-first-arg.sh的hello world
你好

在遥控器。

使用:

  $ SSH主机回声\\的hello world \\

和它导致:

  $ SSH主机print-first-arg.sh的hello world
你好,世界

在远程

I have something like the following, a shell script with:

FOO="bar gum"
$ spark-submit --verbose --class SomeApp some.jar "$FOO"

However this would result in:

Main class:
SomeApp
Arguments:
bar
gum

Where as what I expected was a single argument of 'bar gum'

/update

So much for dumbing down this question

What I really had was:

FOO="bar gum"
$ ssh host spark-submit --verbose --class SomeApp some.jar "$FOO"

This should've been:

FOO="bar gum"
$ ssh host spark-submit --verbose --class SomeApp some.jar \"$FOO\"

解决方案

When you send a command through the ssh command, any double quotes are interpreted by your local, current shell.

Say you have a simple script, print-first-arg.sh on the remote:

#!/bin/bash
echo $1

Then

$ ssh host print-first-arg.sh "hello world"

Results in

$ ssh host print-first-arg.sh hello world
hello

On the remote.

Use:

$ ssh host echo \"hello world\"

and it results in:

$ ssh host print-first-arg.sh "hello world"
hello world

On the remote

这篇关于正确的方法提供火花应用程序的参数/在空间精氨酸火花提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆