feat(all): flink job增加tags属性
flink job级别增加标签属性,用于区分调用测试包和非测试包
This commit is contained in:
@@ -408,6 +408,14 @@ public interface SQLConstants {
|
||||
* 字段 one_in_one_yarn_job_id 别名值 tafjc.one_in_one_yarn_job_id ONE_IN_ONE yarn 配置
|
||||
*/
|
||||
String ONE_IN_ONE_YARN_JOB_ID_A = _alias_.getAlias() + "." + ONE_IN_ONE_YARN_JOB_ID_O;
|
||||
/**
|
||||
* 字段 tags 原始值 tags 标签
|
||||
*/
|
||||
String TAGS_O = "tags";
|
||||
/**
|
||||
* 字段 tags 别名值 tafjc.tags 标签
|
||||
*/
|
||||
String TAGS_A = _alias_.getAlias() + "." + TAGS_O;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.lanyuanxiaoyao.service.common.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Flink Job
|
||||
@@ -14,6 +15,7 @@ public class FlinkJob implements Serializable {
|
||||
private String name;
|
||||
private RunMode runMode;
|
||||
private TableMeta.YarnMeta oneInOneSyncYarn;
|
||||
private List<String> tags;
|
||||
|
||||
public FlinkJob() {
|
||||
}
|
||||
@@ -23,6 +25,7 @@ public class FlinkJob implements Serializable {
|
||||
this.name = builder.name;
|
||||
this.runMode = builder.runMode;
|
||||
this.oneInOneSyncYarn = builder.oneInOneSyncYarn;
|
||||
this.tags = builder.tags;
|
||||
}
|
||||
|
||||
public static Builder builder() {
|
||||
@@ -61,14 +64,23 @@ public class FlinkJob implements Serializable {
|
||||
this.oneInOneSyncYarn = oneInOneSyncYarn;
|
||||
}
|
||||
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(List<String> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FlinkJob{" +
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", runMode=" + runMode +
|
||||
", oneInOneSyncYarn=" + oneInOneSyncYarn +
|
||||
'}';
|
||||
"id=" + id +
|
||||
", name='" + name + '\'' +
|
||||
", runMode=" + runMode +
|
||||
", oneInOneSyncYarn=" + oneInOneSyncYarn +
|
||||
", tags='" + tags + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
public enum RunMode {
|
||||
@@ -92,6 +104,7 @@ public class FlinkJob implements Serializable {
|
||||
private String name;
|
||||
private RunMode runMode;
|
||||
private TableMeta.YarnMeta oneInOneSyncYarn;
|
||||
private List<String> tags;
|
||||
|
||||
private Builder() {}
|
||||
|
||||
@@ -115,6 +128,11 @@ public class FlinkJob implements Serializable {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder tags(List<String> tags) {
|
||||
this.tags = tags;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FlinkJob build() {
|
||||
return new FlinkJob(this);
|
||||
}
|
||||
|
||||
@@ -575,16 +575,4 @@ public class TableMetaHelper {
|
||||
.findFirst();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean existsTag(TableMeta meta, String tag) {
|
||||
return existsTag(meta.getTags(), tag);
|
||||
}
|
||||
|
||||
public static boolean existsTag(String sourceTags, String tag) {
|
||||
return existsTag(Arrays.asList(sourceTags.split(",")), tag);
|
||||
}
|
||||
|
||||
public static boolean existsTag(List<String> sourceTags, String tag) {
|
||||
return sourceTags != null && sourceTags.contains(tag);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.lanyuanxiaoyao.service.common.utils;
|
||||
|
||||
import com.lanyuanxiaoyao.service.common.entity.FlinkJob;
|
||||
import com.lanyuanxiaoyao.service.common.entity.TableMeta;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标签比对
|
||||
*
|
||||
* @author lanyuanxiaoyao
|
||||
* @date 2024-07-29
|
||||
*/
|
||||
public class TagsHelper {
|
||||
public static boolean existsTag(FlinkJob job, String tag) {
|
||||
return existsTag(job.getTags(), tag);
|
||||
}
|
||||
|
||||
public static boolean existsTag(TableMeta meta, String tag) {
|
||||
return existsTag(meta.getTags(), tag);
|
||||
}
|
||||
|
||||
public static boolean existsTag(String sourceTags, String tag) {
|
||||
return existsTag(Arrays.asList(sourceTags.split(",")), tag);
|
||||
}
|
||||
|
||||
public static boolean existsTag(List<String> sourceTags, String tag) {
|
||||
return sourceTags != null && sourceTags.contains(tag);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user