Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
flink task edit flink icon and add flink  local deployMode task
  • Loading branch information
LoveEvenWong committed Sep 26, 2019
1 parent caf3f9e commit c240bc5
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 245 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
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;
Expand All @@ -36,39 +37,49 @@ public class FlinkArgsUtils {
* @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){
Expand All @@ -83,28 +94,29 @@ public static List<String> buildArgs(FlinkParameters param) {
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 changes: 1 addition & 1 deletion escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss
Original file line number Diff line number Diff line change
Expand Up @@ -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%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c240bc5

Please sign in to comment.