mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-11-30 03:08:01 +08:00
[Improvement] The spark version is associated with the spark command (#7544)
* [Improvement] The spark version is associated with the spark command
This commit is contained in:
parent
4b22ad6cf6
commit
a4168ae24e
@ -34,18 +34,6 @@ import java.util.Map;
|
||||
|
||||
public class SparkTask extends AbstractYarnTask {
|
||||
|
||||
/**
|
||||
* spark1 command
|
||||
* usage: spark-submit [options] <app jar | python file> [app arguments]
|
||||
*/
|
||||
private static final String SPARK1_COMMAND = "${SPARK_HOME1}/bin/spark-submit";
|
||||
|
||||
/**
|
||||
* spark2 command
|
||||
* usage: spark-submit [options] <app jar | python file> [app arguments]
|
||||
*/
|
||||
private static final String SPARK2_COMMAND = "${SPARK_HOME2}/bin/spark-submit";
|
||||
|
||||
/**
|
||||
* spark parameters
|
||||
*/
|
||||
@ -90,10 +78,10 @@ public class SparkTask extends AbstractYarnTask {
|
||||
List<String> args = new ArrayList<>();
|
||||
|
||||
// spark version
|
||||
String sparkCommand = SPARK2_COMMAND;
|
||||
String sparkCommand = SparkVersion.SPARK2.getCommand();
|
||||
|
||||
if (SparkVersion.SPARK1.name().equals(sparkParameters.getSparkVersion())) {
|
||||
sparkCommand = SPARK1_COMMAND;
|
||||
sparkCommand = SparkVersion.SPARK1.getCommand();
|
||||
}
|
||||
|
||||
args.add(sparkCommand);
|
||||
|
@ -23,16 +23,22 @@ public enum SparkVersion {
|
||||
* 0 SPARK1
|
||||
* 1 SPARK2
|
||||
*/
|
||||
SPARK1(0, "SPARK1"),
|
||||
SPARK2(1, "SPARK2");
|
||||
|
||||
SparkVersion(int code, String descp) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
}
|
||||
SPARK1(0, "SPARK1", "${SPARK_HOME1}/bin/spark-submit"),
|
||||
SPARK2(1, "SPARK2", "${SPARK_HOME2}/bin/spark-submit"),
|
||||
;
|
||||
|
||||
private final int code;
|
||||
private final String descp;
|
||||
/**
|
||||
* usage: spark-submit [options] <app jar | python file> [app arguments]
|
||||
*/
|
||||
private final String command;
|
||||
|
||||
SparkVersion(int code, String descp, String command) {
|
||||
this.code = code;
|
||||
this.descp = descp;
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
@ -41,4 +47,8 @@ public enum SparkVersion {
|
||||
public String getDescp() {
|
||||
return descp;
|
||||
}
|
||||
|
||||
public String getCommand() {
|
||||
return command;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user