Commit c61d1a6e authored by wenmo's avatar wenmo

执行持久化联调

parent 0ece94bc
......@@ -13,19 +13,19 @@ import lombok.Setter;
@Getter
@Setter
public class StudioDDLDTO {
private boolean isResult;
private boolean isSession;
private boolean useResult;
private boolean useSession;
private String session;
private boolean isRemote;
private boolean useRemote;
private Integer clusterId;
private String statement;
public JobConfig getJobConfig() {
return new JobConfig(isResult, isSession, getSession(), isRemote, clusterId);
return new JobConfig(useResult, useSession, getSession(), useRemote, clusterId);
}
public String getSession() {
if(isRemote) {
if(useRemote) {
return clusterId + "_" + session;
}else{
return "0_" + session;
......
......@@ -13,10 +13,10 @@ import lombok.Setter;
@Getter
@Setter
public class StudioExecuteDTO {
private boolean isResult;
private boolean isSession;
private boolean useResult;
private boolean useSession;
private String session;
private boolean isRemote;
private boolean useRemote;
private Integer clusterId;
private boolean fragment;
private String statement;
......@@ -28,11 +28,11 @@ public class StudioExecuteDTO {
private String savePointPath;
public JobConfig getJobConfig() {
return new JobConfig(isResult, isSession, getSession(), isRemote, clusterId, taskId, jobName, fragment, maxRowNum, checkPoint, parallelism, savePointPath);
return new JobConfig(useResult, useSession, getSession(), useRemote, clusterId, taskId, jobName, fragment, maxRowNum, checkPoint, parallelism, savePointPath);
}
public String getSession() {
if(isRemote) {
if(useRemote) {
return clusterId + "_" + session;
}else{
return "0_" + session;
......
......@@ -6,7 +6,7 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
/**
* History
......@@ -32,8 +32,8 @@ public class History implements Serializable {
private String error;
private String result;
private String config;
private LocalDate startTime;
private LocalDate endTime;
private LocalDateTime startTime;
private LocalDateTime endTime;
private Integer taskId;
@TableField(exist = false)
......
......@@ -72,7 +72,7 @@ public class StudioServiceImpl implements StudioService {
@Override
public JobResult executeSql(StudioExecuteDTO studioExecuteDTO) {
JobConfig config = studioExecuteDTO.getJobConfig();
if(config.isRemote()) {
if(config.isUseRemote()) {
config.setHost(clusterService.getJobManagerAddress(
clusterService.getById(studioExecuteDTO.getClusterId())
));
......@@ -84,7 +84,7 @@ public class StudioServiceImpl implements StudioService {
@Override
public IResult executeDDL(StudioDDLDTO studioDDLDTO) {
JobConfig config = studioDDLDTO.getJobConfig();
if(config.isRemote()) {
if(config.isUseRemote()) {
config.setHost(clusterService.getJobManagerAddress(
clusterService.getById(studioDDLDTO.getClusterId())
));
......
......@@ -49,6 +49,6 @@ public class Job {
}
public JobResult getJobResult(){
return new JobResult(id,jobConfig,jobManagerAddress,status,statement,jobId,error,result,executorSetting,startTime,endTime);
return new JobResult(id,jobConfig,jobManagerAddress,status,statement,jobId,error,result,startTime,endTime);
}
}
......@@ -15,10 +15,10 @@ import lombok.Setter;
@Setter
public class JobConfig {
private boolean isResult;
private boolean isSession;
private boolean useResult;
private boolean useSession;
private String sessionKey;
private boolean isRemote;
private boolean useRemote;
private Integer clusterId;
private String host;
private Integer taskId;
......@@ -29,13 +29,13 @@ public class JobConfig {
private Integer parallelism;
private String savePointPath;
public JobConfig(boolean isResult, boolean isSession, String sessionKey, boolean isRemote, Integer clusterId,
public JobConfig(boolean useResult, boolean useSession, String sessionKey, boolean useRemote, Integer clusterId,
Integer taskId, String jobName, boolean useSqlFragment, Integer maxRowNum, Integer checkpoint,
Integer parallelism, String savePointPath) {
this.isResult = isResult;
this.isSession = isSession;
this.useResult = useResult;
this.useSession = useSession;
this.sessionKey = sessionKey;
this.isRemote = isRemote;
this.useRemote = useRemote;
this.clusterId = clusterId;
this.taskId = taskId;
this.jobName = jobName;
......@@ -46,17 +46,17 @@ public class JobConfig {
this.savePointPath = savePointPath;
}
public JobConfig(boolean isResult, boolean isSession, String sessionKey, boolean isRemote, Integer clusterId) {
this.isResult = isResult;
this.isSession = isSession;
public JobConfig(boolean useResult, boolean useSession, String sessionKey, boolean useRemote, Integer clusterId) {
this.useResult = useResult;
this.useSession = useSession;
this.sessionKey = sessionKey;
this.isRemote = isRemote;
this.useRemote = useRemote;
this.clusterId = clusterId;
}
public ExecutorSetting getExecutorSetting(){
String type = Executor.LOCAL;
if(isRemote){
if(useRemote){
type = Executor.REMOTE;
}
return new ExecutorSetting(host,type,checkpoint,parallelism,useSqlFragment,savePointPath,jobName);
......
......@@ -91,7 +91,7 @@ public class JobManager extends RunTime {
}
private Executor createExecutor() {
if (config.isRemote()) {
if (config.isUseRemote()) {
executor = Executor.build(new EnvironmentSetting(jobManagerHost, jobManagerPort), config.getExecutorSetting());
return executor;
} else {
......@@ -116,7 +116,7 @@ public class JobManager extends RunTime {
}*/
private Executor createExecutorWithSession() {
if(config.isSession()) {
if(config.isUseSession()) {
ExecutorEntity executorEntity = SessionPool.get(config.getSessionKey());
if (executorEntity != null) {
executor = executorEntity.getExecutor();
......@@ -134,7 +134,7 @@ public class JobManager extends RunTime {
public boolean init() {
handler = JobHandler.build();
String host = config.getHost();
if (config.isRemote() && host != null && !("").equals(host)) {
if (config.isUseRemote() && host != null && !("").equals(host)) {
String[] strs = host.split(NetConstant.COLON);
if (strs.length >= 2) {
jobManagerHost = strs[0];
......@@ -295,7 +295,7 @@ public class JobManager extends RunTime {
if (tableResult.getJobClient().isPresent()) {
job.setJobId(tableResult.getJobClient().get().getJobID().toHexString());
}
if(config.isResult()) {
if(config.isUseResult()) {
IResult result = ResultBuilder.build(operationType, maxRowNum, "", false).getResult(tableResult);
job.setResult(result);
}
......
......@@ -20,24 +20,24 @@ public class JobResult {
private JobConfig jobConfig;
private String jobManagerAddress;
private Job.JobStatus status;
private boolean success;
private String statement;
private String jobId;
private String error;
private IResult result;
private ExecutorSetting executorSetting;
private LocalDate startTime;
private LocalDate endTime;
public JobResult(Integer id, JobConfig jobConfig, String jobManagerAddress, Job.JobStatus status, String statement, String jobId, String error, IResult result, ExecutorSetting executorSetting, LocalDate startTime, LocalDate endTime) {
public JobResult(Integer id, JobConfig jobConfig, String jobManagerAddress, Job.JobStatus status, String statement, String jobId, String error, IResult result, LocalDate startTime, LocalDate endTime) {
this.id = id;
this.jobConfig = jobConfig;
this.jobManagerAddress = jobManagerAddress;
this.status = status;
this.success = (status==(Job.JobStatus.SUCCESS))?true:false;
this.statement = statement;
this.jobId = jobId;
this.error = error;
this.result = result;
this.executorSetting = executorSetting;
this.startTime = startTime;
this.endTime = endTime;
}
......
......@@ -74,7 +74,7 @@ const StudioConfig = (props: any) => {
<Row>
<Col span={12}>
<Form.Item
label="预览结果" className={styles.form_item} name="isResult" valuePropName="checked"
label="预览结果" className={styles.form_item} name="useResult" valuePropName="checked"
tooltip={{ title: '开启预览结果,将同步运行并返回数据结果', icon: <InfoCircleOutlined /> }}
>
<Switch checkedChildren="启用" unCheckedChildren="禁用"
......@@ -91,7 +91,7 @@ const StudioConfig = (props: any) => {
</Col>
</Row>
<Form.Item
label="远程执行" className={styles.form_item} name="isRemote" valuePropName="checked"
label="远程执行" className={styles.form_item} name="useRemote" valuePropName="checked"
tooltip={{ title: '开启远程执行,将在远程集群进行任务执行', icon: <InfoCircleOutlined /> }}
>
<Switch checkedChildren="启用" unCheckedChildren="禁用"
......@@ -100,7 +100,7 @@ const StudioConfig = (props: any) => {
<Row>
<Col span={10}>
<Form.Item
label="共享会话" className={styles.form_item} name="isSession" valuePropName="checked"
label="共享会话" className={styles.form_item} name="useSession" valuePropName="checked"
tooltip={{ title: '开启共享会话,将进行 Flink Catalog 的共享', icon: <InfoCircleOutlined /> }}
>
<Switch checkedChildren="启用" unCheckedChildren="禁用"
......
......@@ -13,18 +13,18 @@ const StudioMsg = (props:any) => {
{current.console.result.map((item,index)=> {
if(index==0) {
return (<Paragraph>
<blockquote><Link href={`http://${item.flinkHost}:${item.flinkPort}`} target="_blank">
[{item.sessionId}:{item.flinkHost}:{item.flinkPort}]
</Link> <Divider type="vertical"/>{item.finishDate}
<blockquote><Link href={`http://${item.jobConfig.host}`} target="_blank">
[{item.jobConfig.sessionKey}:{item.jobConfig.host}]
</Link> <Divider type="vertical"/>{item.startTime}
<Divider type="vertical"/>{item.endTime}
<Divider type="vertical"/>
{!item.success ? <><Badge status="error"/><Text type="danger">Error</Text></> :
{!(item.status=='SUCCESS') ? <><Badge status="error"/><Text type="danger">Error</Text></> :
<><Badge status="success"/><Text type="success">Success</Text></>}
<Divider type="vertical"/>
{item.jobName&&<Text code>{item.jobName}</Text>}
{item.jobConfig.jobName&&<Text code>{item.jobConfig.jobName}</Text>}
{item.jobId&&<Text code>{item.jobId}</Text>}
<Text keyboard>{item.time}ms</Text></blockquote>
</blockquote>
{item.statement && (<pre style={{height: '100px'}}>{item.statement}</pre>)}
{item.msg ? item.msg : ''}
{item.error && (<pre style={{height: '100px'}}>{item.error}</pre>)}
</Paragraph>)
}else{
......
......@@ -109,7 +109,7 @@ const StudioTable = (props:any) => {
onChange={onChange}
>
{current.console.result.map((item,index)=> {
if(item.success) {
if(item.status=='SUCCESS') {
let tag = (<> <Tooltip placement="topLeft" title={item.statement}><Tag color="processing">{item.finishDate}</Tag>
<Text underline>[{item.sessionId}:{item.flinkHost}:{item.flinkPort}]</Text>
{item.jobName&&<Text code>{item.jobName}</Text>}
......
......@@ -44,9 +44,9 @@ const StudioMenu = (props: any) => {
fragment:current.task.fragment,
savePointPath:current.task.savePointPath,
jobName:current.task.jobName,
isResult:current.task.isResult,
isSession:current.task.isSession,
remote:current.task.isRemote,
useResult:current.task.useResult,
useSession:current.task.useSession,
useRemote:current.task.useRemote,
};
const key = current.key;
const taskKey = (Math.random()*1000)+'';
......
......@@ -139,9 +139,9 @@ const StudioTree: React.FC<StudioTreeProps> = (props) => {
session:'',
maxRowNum: 100,
jobName:node.name,
isResult:false,
isSession:false,
isRemote:true,
useResult:false,
useSession:false,
useRemote:true,
...result.datas
},
console:{
......
......@@ -41,9 +41,9 @@ export type TaskType = {
session: string;
maxRowNum: number;
jobName: string;
isResult:boolean;
isSession:boolean;
isRemote:boolean;
useResult:boolean;
useSession:boolean;
useRemote:boolean;
};
export type ConsoleType = {
......@@ -151,9 +151,9 @@ const Model: ModelType = {
maxRowNum: 100,
session: '',
alias: '草稿',
isResult:true,
isSession:false,
isRemote:false,
useResult:true,
useSession:false,
useRemote:false,
},
console: {
result: [],
......@@ -182,9 +182,9 @@ const Model: ModelType = {
session: '',
maxRowNum: 100,
alias: '草稿',
isResult:true,
isSession:false,
isRemote:false,
useResult:true,
useSession:false,
useRemote:false,
},
console: {
result: [],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment