1
spark 2.0.0を使用しています。 sparkドライバからエグゼキュータにパラメータを渡す方法はありますか?私は次のことを試みた。sparkのドライバからexecutorへのパラメータの受け渡し
class SparkDriver {
public static void main(String argv[]){
SparkConf conf = new SparkConf().setAppName("test").setMaster("yarn");
SparkSession sparkSession = SparkSession.builder().config(conf).getOrCreate();
Dataset<Row> input = sparkSession.read().load("inputfilepath");
Dataset<Row> modifiedinput = input.mapPartitions(new customMapPartition(5),Encoders.bean(Row.class));
}
class customMapPartition implements MapPartitionsFunction{
private static final long serialVersionUID = -6513655566985939627L;
private static Integer variableThatHastobePassed = null;
public customMapPartition(Integer passedInteger){
customMapPartition.variableThatHastobePassed= passedInteger;
}
@Override
public Iterator<Row> call(Iterator<Row> input) throws Exception {
System.out.println("number that is passed " + variableThatHastobePassed);
}
}
上記のとおり、私はパラメータを渡すカスタムのmappartition関数を書きました。 partition関数の呼び出しメソッドで静的変数にアクセスしています。これは私のローカルで "setmaster(" local ")を使って走ったときに働いていましたが、.setmaster(" yarn ")を使ってクラスタ上で走ったときにはうまくいかなかったのです(system.out.println文でヌルに印刷)
は執行にドライバからパラメータを渡す方法はあります