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. 34
      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"; public static final String SPARK_QUEUE = "--queue";
/**
* --queue --qu
*/
public static final String FLINK_QUEUE = "--qu";
/** /**
* exit code success * exit code success

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

@ -21,6 +21,7 @@ import cn.escheduler.common.Constants;
import cn.escheduler.common.enums.ProgramType; import cn.escheduler.common.enums.ProgramType;
import cn.escheduler.common.task.flink.FlinkParameters; import cn.escheduler.common.task.flink.FlinkParameters;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -33,16 +34,25 @@ public class FlinkArgsUtils {
/** /**
* build args * build args
*
* @param param * @param param
* @return * @return
*/ */
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(FlinkArgsUtils.class);
public static List<String> buildArgs(FlinkParameters param) { public static List<String> buildArgs(FlinkParameters param) {
List<String> args = new ArrayList<>(); List<String> args = new ArrayList<>();
String deployMode = "cluster";
if (StringUtils.isNotEmpty(param.getDeployMode())) {
deployMode = param.getDeployMode();
}
if (!"local".equals(deployMode)) {
args.add(Constants.FLINK_RUN_MODE); //-m 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) { if (param.getSlot() != 0) {
args.add(Constants.FLINK_YARN_SLOT); args.add(Constants.FLINK_YARN_SLOT);
args.add(String.format("%d", param.getSlot())); //-ys args.add(String.format("%d", param.getSlot())); //-ys
@ -67,11 +77,14 @@ public class FlinkArgsUtils {
args.add(Constants.FLINK_TASK_MANAGE_MEM); args.add(Constants.FLINK_TASK_MANAGE_MEM);
args.add(param.getTaskManagerMemory()); args.add(param.getTaskManagerMemory());
} }
args.add(Constants.FLINK_detach); //-d 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())) { if (StringUtils.isNotEmpty(param.getMainClass())) {
args.add(Constants.FLINK_MAIN_CLASS); //-c args.add(Constants.FLINK_MAIN_CLASS); //-c
args.add(param.getMainClass()); //main class args.add(param.getMainClass()); //main class
@ -83,28 +96,29 @@ public class FlinkArgsUtils {
args.add(param.getMainJar().getRes()); args.add(param.getMainJar().getRes());
} }
if (StringUtils.isNotEmpty(param.getMainArgs())) {
args.add(param.getMainArgs());
}
// --files --conf --libjar ... // --files --conf --libjar ...
if (StringUtils.isNotEmpty(param.getOthers())) { if (StringUtils.isNotEmpty(param.getOthers())) {
String others = param.getOthers(); String others = param.getOthers();
if(!others.contains("--queue")){ if (!others.contains("--qu")) {
if (StringUtils.isNotEmpty(param.getQueue())) { if (StringUtils.isNotEmpty(param.getQueue()) && !deployMode.equals("local")) {
args.add(Constants.SPARK_QUEUE); args.add(Constants.FLINK_QUEUE);
args.add(param.getQueue()); args.add(param.getQueue());
} }
} }
args.add(param.getOthers()); args.add(param.getOthers());
}else if (StringUtils.isNotEmpty(param.getQueue())) { } else if (StringUtils.isNotEmpty(param.getQueue()) && !deployMode.equals("local")) {
args.add(Constants.SPARK_QUEUE); args.add(Constants.FLINK_QUEUE);
args.add(param.getQueue()); args.add(param.getQueue());
} }
if (StringUtils.isNotEmpty(param.getMainArgs())) {
args.add(param.getMainArgs());
}
return args; 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%; background: url("../img/toolbar_SPARK.png") no-repeat 50% 50%;
} }
.icos-FLINK { .icos-FLINK {
background: url("../img/toobar_flink.svg") no-repeat 50% 50%; background: url("../img/toobar_FLINK.png") no-repeat 50% 50%;
} }
.icos-MR { .icos-MR {
background: url("../img/toolbar_MR.png") no-repeat 50% 50%; 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"> <div slot="content">
<x-radio-group v-model="deployMode"> <x-radio-group v-model="deployMode">
<x-radio :label="'cluster'" :disabled="isDetails"></x-radio> <x-radio :label="'cluster'" :disabled="isDetails"></x-radio>
<x-radio :label="'local'" :disabled="isDetails"></x-radio>
</x-radio-group> </x-radio-group>
</div> </div>
</m-list-box> </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