spark-submit允许使用,配置执行程序环境变量--conf spark.executorEnv.FOO=bar,并且Spark REST API允许使用该environmentVariables字段传递一些环境变量.不幸的是,spark-submit在集群模式下提交驱动程序时,我发现没有类似配置驱动程序的环境变量:
spark-submit --deploy-mode cluster myapp.jar
Run Code Online (Sandbox Code Playgroud)
是否可以spark-submit在群集模式下设置驱动程序的环境变量?
在这个极简程序中,我希望file_size函数在其中包含路径/not/there,Err以便可以在main函数中显示:
use std::fs::metadata;
use std::io;
use std::path::Path;
use std::path::PathBuf;
fn file_size(path: &Path) -> io::Result<u64> {
Ok(metadata(path)?.len())
}
fn main() {
if let Err(err) = file_size(&PathBuf::from("/not/there")) {
eprintln!("{}", err);
}
}
Run Code Online (Sandbox Code Playgroud)