Browse Source

pr#711 flink task edit (#906)

* pr #711
flink task edit flink icon and add flink  local deployMode task

* pr #711
flink task edit flink icon and add flink  local deployMode task
pull/2/head
LoveEvenWong 5 years ago committed by qiaozhanwei
parent
commit
3e3ee3d20b
  1. 4
      escheduler-common/src/main/java/cn/escheduler/common/Constants.java
  2. 88
      escheduler-server/src/main/java/cn/escheduler/server/utils/FlinkArgsUtils.java
  3. 2
      escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
  4. 1
      escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
  5. BIN
      escheduler-ui/src/js/conf/home/pages/dag/img/toobar_FLINK.png
  6. 211
      escheduler-ui/src/js/conf/home/pages/dag/img/toobar_flink.svg

4
escheduler-common/src/main/java/cn/escheduler/common/Constants.java

@ -696,6 +696,10 @@ public final class Constants {
*/
public static final String SPARK_QUEUE = "--queue";
/**
* --queue --qu
*/
public static final String FLINK_QUEUE = "--qu";
/**
* exit code success

88
escheduler-server/src/main/java/cn/escheduler/server/utils/FlinkArgsUtils.java

@ -21,57 +21,70 @@ import cn.escheduler.common.Constants;
import cn.escheduler.common.enums.ProgramType;
import cn.escheduler.common.task.flink.FlinkParameters;
import org.apache.commons.lang.StringUtils;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
/**
* spark args utils
* spark args utils
*/
public class FlinkArgsUtils {
/**
* build args
* build args
*
* @param param
* @return
*/
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(FlinkArgsUtils.class);
public static List<String> buildArgs(FlinkParameters param) {
List<String> args = new ArrayList<>();
String deployMode = "cluster";
if (StringUtils.isNotEmpty(param.getDeployMode())) {
deployMode = param.getDeployMode();
args.add(Constants.FLINK_RUN_MODE); //-m
}
if (!"local".equals(deployMode)) {
args.add(Constants.FLINK_RUN_MODE); //-m
args.add(Constants.FLINK_YARN_CLUSTER); //yarn-cluster
args.add(Constants.FLINK_YARN_CLUSTER); //yarn-cluster
if (param.getSlot() != 0) {
args.add(Constants.FLINK_YARN_SLOT);
args.add(String.format("%d", param.getSlot())); //-ys
}
if (StringUtils.isNotEmpty(param.getAppName())) { //-ynm
args.add(Constants.FLINK_APP_NAME);
args.add(param.getAppName());
}
if (param.getSlot() != 0) {
args.add(Constants.FLINK_YARN_SLOT);
args.add(String.format("%d", param.getSlot())); //-ys
}
if (param.getTaskManager() != 0) { //-yn
args.add(Constants.FLINK_TASK_MANAGE);
args.add(String.format("%d", param.getTaskManager()));
}
if (StringUtils.isNotEmpty(param.getAppName())) { //-ynm
args.add(Constants.FLINK_APP_NAME);
args.add(param.getAppName());
}
if (StringUtils.isNotEmpty(param.getJobManagerMemory())) {
args.add(Constants.FLINK_JOB_MANAGE_MEM);
args.add(param.getJobManagerMemory()); //-yjm
}
if (param.getTaskManager() != 0) { //-yn
args.add(Constants.FLINK_TASK_MANAGE);
args.add(String.format("%d", param.getTaskManager()));
}
if (StringUtils.isNotEmpty(param.getTaskManagerMemory())) { // -ytm
args.add(Constants.FLINK_TASK_MANAGE_MEM);
args.add(param.getTaskManagerMemory());
}
args.add(Constants.FLINK_detach); //-d
if (StringUtils.isNotEmpty(param.getJobManagerMemory())) {
args.add(Constants.FLINK_JOB_MANAGE_MEM);
args.add(param.getJobManagerMemory()); //-yjm
}
if (StringUtils.isNotEmpty(param.getTaskManagerMemory())) { // -ytm
args.add(Constants.FLINK_TASK_MANAGE_MEM);
args.add(param.getTaskManagerMemory());
}
args.add(Constants.FLINK_detach); //-d
}
if(param.getProgramType() !=null ){
if(param.getProgramType()!=ProgramType.PYTHON){
if (param.getProgramType() != null) {
if (param.getProgramType() != ProgramType.PYTHON) {
if (StringUtils.isNotEmpty(param.getMainClass())) {
args.add(Constants.FLINK_MAIN_CLASS); //-c
args.add(param.getMainClass()); //main class
@ -83,28 +96,29 @@ public class FlinkArgsUtils {
args.add(param.getMainJar().getRes());
}
if (StringUtils.isNotEmpty(param.getMainArgs())) {
args.add(param.getMainArgs());
}
// --files --conf --libjar ...
if (StringUtils.isNotEmpty(param.getOthers())) {
if (StringUtils.isNotEmpty(param.getOthers())) {
String others = param.getOthers();
if(!others.contains("--queue")){
if (StringUtils.isNotEmpty(param.getQueue())) {
args.add(Constants.SPARK_QUEUE);
if (!others.contains("--qu")) {
if (StringUtils.isNotEmpty(param.getQueue()) && !deployMode.equals("local")) {
args.add(Constants.FLINK_QUEUE);
args.add(param.getQueue());
}
}
args.add(param.getOthers());
}else if (StringUtils.isNotEmpty(param.getQueue())) {
args.add(Constants.SPARK_QUEUE);
} else if (StringUtils.isNotEmpty(param.getQueue()) && !deployMode.equals("local")) {
args.add(Constants.FLINK_QUEUE);
args.add(param.getQueue());
}
if (StringUtils.isNotEmpty(param.getMainArgs())) {
args.add(param.getMainArgs());
}
return args;
}
}
}

2
escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss

@ -71,7 +71,7 @@
background: url("../img/toolbar_SPARK.png") no-repeat 50% 50%;
}
.icos-FLINK {
background: url("../img/toobar_flink.svg") no-repeat 50% 50%;
background: url("../img/toobar_FLINK.png") no-repeat 50% 50%;
}
.icos-MR {
background: url("../img/toolbar_MR.png") no-repeat 50% 50%;

1
escheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue

@ -52,6 +52,7 @@
<div slot="content">
<x-radio-group v-model="deployMode">
<x-radio :label="'cluster'" :disabled="isDetails"></x-radio>
<x-radio :label="'local'" :disabled="isDetails"></x-radio>
</x-radio-group>
</div>
</m-list-box>

BIN
escheduler-ui/src/js/conf/home/pages/dag/img/toobar_FLINK.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

211
escheduler-ui/src/js/conf/home/pages/dag/img/toobar_flink.svg

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 79 KiB

Loading…
Cancel
Save